diff --git a/Dockerfile b/Dockerfile index a94cec7..554a12c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -13,11 +13,9 @@ RUN apt-get update && \ ca-certificates \ nginx \ curl \ - jq \ openssl \ privoxy \ iproute2 \ - wget \ sqlite3; \ apt clean; \ rm -rf \ @@ -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 @@ -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 diff --git a/Dockerfile.vps b/Dockerfile.vps index aca30a8..8a23578 100644 --- a/Dockerfile.vps +++ b/Dockerfile.vps @@ -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 diff --git a/README.md b/README.md index ebbc59b..6ee87f1 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Project Logo

-# 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. @@ -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 diff --git a/check-ui.sh b/check-ui.sh new file mode 100755 index 0000000..012f78c --- /dev/null +++ b/check-ui.sh @@ -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 diff --git a/docker_entrypoint.sh b/docker_entrypoint.sh index 4e7e1a3..34a1533 100755 --- a/docker_entrypoint.sh +++ b/docker_entrypoint.sh @@ -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 diff --git a/manifest.yaml b/manifest.yaml index e648f11..165eca3 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -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 @@ -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 diff --git a/scripts/procedures/migrations.ts b/scripts/procedures/migrations.ts index b9d020f..eefc95a 100644 --- a/scripts/procedures/migrations.ts +++ b/scripts/procedures/migrations.ts @@ -32,4 +32,4 @@ export const migration: T.ExpectedExports.migration = compat.migrations { version: "1.75.0", type: "down" }, ), }, - }, "1.94.0" ); + }, "1.95.1" );