From 4e0be3b2eb842772567330d3921bcbfdebd33b18 Mon Sep 17 00:00:00 2001
From: Mariusz Kogen
Date: Tue, 31 Oct 2023 10:50:18 +0100
Subject: [PATCH 1/6] Bump version
---
Dockerfile | 2 +-
Dockerfile.vps | 2 +-
manifest.yaml | 4 ++--
scripts/procedures/migrations.ts | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index a94cec7..cc59905 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.0
ARG PLATFORM
ENV YQ_VER v4.3.2
diff --git a/Dockerfile.vps b/Dockerfile.vps
index aca30a8..62723dd 100644
--- a/Dockerfile.vps
+++ b/Dockerfile.vps
@@ -1,4 +1,4 @@
-FROM matrixdotorg/synapse:v1.94.0
+FROM matrixdotorg/synapse:v1.95.0
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/manifest.yaml b/manifest.yaml
index e648f11..8213c09 100644
--- a/manifest.yaml
+++ b/manifest.yaml
@@ -1,12 +1,12 @@
id: synapse
title: Synapse
-version: 1.94.0
+version: 1.95.0
release-notes: |
* Minor code changes and performace 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)
+ * Full list of upstream changes available [here](https://github.com/matrix-org/synapse/compare/v1.87.0...v1.95.0)
license: apache
wrapper-repo: https://github.com/Start9Labs/synapse-wrapper
upstream-repo: https://github.com/matrix-org/synapse
diff --git a/scripts/procedures/migrations.ts b/scripts/procedures/migrations.ts
index b9d020f..63321af 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.0" );
From ffe270b47ed55b9a157c3ea567a9991a586fa009 Mon Sep 17 00:00:00 2001
From: Mariusz Kogen
Date: Tue, 31 Oct 2023 13:02:42 +0100
Subject: [PATCH 2/6] Check if user exists before creating
---
docker_entrypoint.sh | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
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
From 082f17cadbb2a9b08d28e270c7331a26038b6a0a Mon Sep 17 00:00:00 2001
From: Mariusz Kogen
Date: Fri, 3 Nov 2023 13:18:54 +0100
Subject: [PATCH 3/6] Better health checks * Bump version * Cleaning
---
Dockerfile | 8 ++++----
Dockerfile.vps | 2 +-
check-ui.sh | 34 ++++++++++++++++++++++++++++++++
manifest.yaml | 16 +++++++++++++--
scripts/procedures/migrations.ts | 2 +-
5 files changed, 54 insertions(+), 8 deletions(-)
create mode 100755 check-ui.sh
diff --git a/Dockerfile b/Dockerfile
index cc59905..554a12c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,6 +1,6 @@
FROM awesometechnologies/synapse-admin:0.8.7 as synapse-admin
-FROM matrixdotorg/synapse:v1.95.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 62723dd..8a23578 100644
--- a/Dockerfile.vps
+++ b/Dockerfile.vps
@@ -1,4 +1,4 @@
-FROM matrixdotorg/synapse:v1.95.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/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/manifest.yaml b/manifest.yaml
index 8213c09..00d7f60 100644
--- a/manifest.yaml
+++ b/manifest.yaml
@@ -1,12 +1,13 @@
id: synapse
title: Synapse
-version: 1.95.0
+version: 1.95.1
release-notes: |
+ * Security [fix](https://github.com/matrix-org/synapse/security/advisories/GHSA-mp92-3jfm-3575)
* Minor code changes and performace 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.95.0)
+ * Full list of upstream changes available [here](https://github.com/matrix-org/synapse/compare/v1.87.0...v1.95.1)
license: apache
wrapper-repo: https://github.com/Start9Labs/synapse-wrapper
upstream-repo: https://github.com/matrix-org/synapse
@@ -40,6 +41,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 63321af..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.95.0" );
+ }, "1.95.1" );
From 9ea8c75aac17c2c3efec111766a05e70ebeaf1b3 Mon Sep 17 00:00:00 2001
From: Mariusz Kogen
Date: Fri, 3 Nov 2023 13:24:34 +0100
Subject: [PATCH 4/6] Update readme
---
README.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index ebbc59b..6ee87f1 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
-# 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
From 669fc24a5cf4b1ee0720cf38b622a7ea02eaaa04 Mon Sep 17 00:00:00 2001
From: Mariusz Kogen
Date: Fri, 3 Nov 2023 13:47:15 +0100
Subject: [PATCH 5/6] manifest update
---
manifest.yaml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/manifest.yaml b/manifest.yaml
index 00d7f60..723354f 100644
--- a/manifest.yaml
+++ b/manifest.yaml
@@ -3,12 +3,13 @@ title: Synapse
version: 1.95.1
release-notes: |
* Security [fix](https://github.com/matrix-org/synapse/security/advisories/GHSA-mp92-3jfm-3575)
+ * Added Synapse Admin healthcheck
* Minor code changes and performace 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.95.1)
-license: apache
+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
From 72bc2fcc89168cfdd7b3a304835a02a4e058427f Mon Sep 17 00:00:00 2001
From: Mariusz Kogen
Date: Fri, 3 Nov 2023 13:51:34 +0100
Subject: [PATCH 6/6] fix typo
---
manifest.yaml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/manifest.yaml b/manifest.yaml
index 723354f..165eca3 100644
--- a/manifest.yaml
+++ b/manifest.yaml
@@ -3,8 +3,8 @@ title: Synapse
version: 1.95.1
release-notes: |
* Security [fix](https://github.com/matrix-org/synapse/security/advisories/GHSA-mp92-3jfm-3575)
- * Added Synapse Admin healthcheck
- * Minor code changes and performace improvements
+ * Added Synapse Admin health check
+ * Minor code changes and performance improvements
* Standardized and optimized icon
* Use bookworm as the package base
* Readme update