Skip to content

Commit

Permalink
Update/1.95.1 (#61)
Browse files Browse the repository at this point in the history
* Bump version

* Check if user exists before creating

* Better health checks

* Cleaning

* Update readme

* manifest update

* fix typo
  • Loading branch information
k0gen authored Nov 3, 2023
1 parent 1de4d06 commit 31660f7
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 16 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM awesometechnologies/synapse-admin:0.8.7 as synapse-admin

FROM matrixdotorg/synapse:v1.94.0
FROM matrixdotorg/synapse:v1.95.1

ARG PLATFORM
ENV YQ_VER v4.3.2
Expand All @@ -13,11 +13,9 @@ RUN apt-get update && \
ca-certificates \
nginx \
curl \
jq \
openssl \
privoxy \
iproute2 \
wget \
sqlite3; \
apt clean; \
rm -rf \
Expand All @@ -26,7 +24,7 @@ RUN apt-get update && \
/var/lib/apt/lists/* \
/var/tmp/*

RUN wget -O /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/${YQ_VER}/yq_linux_${PLATFORM} \
RUN curl -skLo /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/${YQ_VER}/yq_linux_${PLATFORM} \
&& chmod a+x /usr/local/bin/yq

ADD ./www /var/www
Expand All @@ -37,6 +35,8 @@ ADD ./docker_entrypoint.sh /usr/local/bin/docker_entrypoint.sh
RUN chmod a+x /usr/local/bin/docker_entrypoint.sh
ADD ./check-federation.sh /usr/local/bin/check-federation.sh
RUN chmod a+x /usr/local/bin/check-federation.sh
ADD ./check-ui.sh /usr/local/bin/check-ui.sh
RUN chmod a+x /usr/local/bin/check-ui.sh
ADD ./user-signups-off.sh /usr/local/bin/user-signups-off.sh
RUN chmod a+x /usr/local/bin/user-signups-off.sh
ADD ./configurator.py /configurator.py
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.vps
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM matrixdotorg/synapse:v1.94.0
FROM matrixdotorg/synapse:v1.95.1

RUN sed -i 's#timeout=10000#timeout=20000#g' /usr/local/lib/python3*/site-packages/synapse/crypto/keyring.py
RUN sed -i 's#timeout=10000#timeout=20000#g' /usr/local/lib/python3*/site-packages/synapse/federation/transport/client.py
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img src="icon.png" alt="Project Logo" width="21%">
</p>

# Wrapper for Synapse
# Synapse for StartOS

[Synapse](https://github.com/matrix-org/synapse) is a homeserver software for the Matrix protocol, enabling decentralized and federated communication across different Matrix servers to send messages and interact with each other seamlessly.

Expand All @@ -19,7 +19,7 @@ Prior to building the `synapse` package, it's essential to configure your build

## Cloning

Clone the Synapse wrapper locally.
Clone the Synapse package repository locally.

```
git clone https://github.com/Start9Labs/synapse-wrapper.git
Expand Down
34 changes: 34 additions & 0 deletions check-ui.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh
FEDERATION=$(yq e '.federation' /data/start9/config.yaml)

if [ "$FEDERATION" = 'false' ]; then
CHCK='curl -skf https://synapse.embassy/_matrix/client/versions >/dev/null 2>&1'
eval "$CHCK"
exit_code=$?
if [ "$exit_code" -ne 0 ]; then
echo "Initializing Homeserver ..." >&2
exit 61
sleep 25
eval "$CHCK"
exit_code=$?
if [ "$exit_code" -ne 0 ]; then
echo "Homeserver is unreachable" >&2
exit 1
fi
fi
else
while true; do
if [ ! -f /data/start9/stats.yaml ]; then
echo "Waiting for Synapse to finish initialization ..." >&2
exit 61
else
chkstats=$(yq e '.data["Admin Username"].value' /data/start9/stats.yaml)
if [ "$chkstats" = "admin" ]; then
exit 0
else
echo "Failed to retrieve admin credentials." >&2
exit 1
fi
fi
done
fi
12 changes: 8 additions & 4 deletions docker_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,14 @@ else
echo "Synapse-admin user not found. Creating ..."
echo
admin_password=$(cat /dev/urandom | base64 | head -c 16)
timeout 210s /start.py &
sleep 205
register_new_matrix_user --config /data/homeserver.yaml --user admin --password $admin_password --admin
echo $admin_password > /data/start9/adm.key
timeout 25s /start.py &
sleep 20
admin_exists=$(sqlite3 /data/homeserver.db "SELECT name FROM users WHERE name LIKE '@admin%';")
if [ -z "$admin_exists" ]; then
# Create the admin user and key
register_new_matrix_user --config /data/homeserver.yaml --user admin --password $admin_password --admin
echo $admin_password > /data/start9/adm.key
fi
python /configurator.py
fi

Expand Down
21 changes: 17 additions & 4 deletions manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
id: synapse
title: Synapse
version: 1.94.0
version: 1.95.1
release-notes: |
* Minor code changes and performace improvements
* Security [fix](https://github.com/matrix-org/synapse/security/advisories/GHSA-mp92-3jfm-3575)
* Added Synapse Admin health check
* Minor code changes and performance improvements
* Standardized and optimized icon
* Use bookworm as the package base
* Readme update
* Full list of upstream changes available [here](https://github.com/matrix-org/synapse/compare/v1.87.0...v1.94.0)
license: apache
* Full list of upstream changes available [here](https://github.com/matrix-org/synapse/compare/v1.87.0...v1.95.1)
license: Apache-2.0
wrapper-repo: https://github.com/Start9Labs/synapse-wrapper
upstream-repo: https://github.com/matrix-org/synapse
support-site: https://github.com/matrix-org/synapse/issues
Expand Down Expand Up @@ -40,6 +42,17 @@ health-checks:
mounts: {}
io-format: json
inject: true
synapse-admin:
name: Admin interface
success-message: Synapse Admin is ready to be visited in a web browser.
type: docker
image: main
system: false
entrypoint: check-ui.sh
args: []
mounts: {}
io-format: yaml
inject: true
user-signups-off:
name: User Signups Off
type: docker
Expand Down
2 changes: 1 addition & 1 deletion scripts/procedures/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ export const migration: T.ExpectedExports.migration = compat.migrations
{ version: "1.75.0", type: "down" },
),
},
}, "1.94.0" );
}, "1.95.1" );

0 comments on commit 31660f7

Please sign in to comment.