From ff0c0ec17da71a923d955db8367b8b22404fd15a Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Thu, 7 Mar 2024 19:18:42 +0000 Subject: [PATCH 1/3] Prevent start_for_complement.sh from setting START_POSTGRES to false if already set I have a use case where I'd like the Synapse image to start up a postgres instance that I can use, but don't want to force Synapse to use postgres as well. This commit prevents postgres being disabled if it has already been explicitly enabled. --- docker/complement/conf/postgres.supervisord.conf | 2 +- docker/complement/conf/start_for_complement.sh | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docker/complement/conf/postgres.supervisord.conf b/docker/complement/conf/postgres.supervisord.conf index b88bfc772e4..657845dfdbc 100644 --- a/docker/complement/conf/postgres.supervisord.conf +++ b/docker/complement/conf/postgres.supervisord.conf @@ -1,7 +1,7 @@ [program:postgres] command=/usr/local/bin/prefix-log gosu postgres postgres -# Only start if START_POSTGRES=1 +# Only start if START_POSTGRES=true autostart=%(ENV_START_POSTGRES)s # Lower priority number = starts first diff --git a/docker/complement/conf/start_for_complement.sh b/docker/complement/conf/start_for_complement.sh index 7b012ce8abe..a48b44db90e 100755 --- a/docker/complement/conf/start_for_complement.sh +++ b/docker/complement/conf/start_for_complement.sh @@ -32,8 +32,13 @@ case "$SYNAPSE_COMPLEMENT_DATABASE" in ;; sqlite|"") - # Configure supervisord not to start Postgres, as we don't need it - export START_POSTGRES=false + # Check that START_POSTGRES hasn't already been set + # (i.e. by another container image inheriting our own). + # If not, then set it here. + if [ -z "$START_POSTGRES" ]; then + # Configure supervisord not to start Postgres. + export START_POSTGRES=false + fi ;; *) From d68707358eb791c5760ef9fa56db82a970ada743 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Thu, 7 Mar 2024 19:51:19 +0000 Subject: [PATCH 2/3] changelog --- changelog.d/16985.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/16985.misc diff --git a/changelog.d/16985.misc b/changelog.d/16985.misc new file mode 100644 index 00000000000..34d1337a281 --- /dev/null +++ b/changelog.d/16985.misc @@ -0,0 +1 @@ +Allow containers building on top of Synapse's Complement container is use the included PostgreSQL cluster. From 44e898f3036e67d940b30695eaf84de0e53741b5 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Thu, 21 Mar 2024 08:25:49 -0500 Subject: [PATCH 3/3] Use succint bashism and update comment --- docker/complement/conf/start_for_complement.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/docker/complement/conf/start_for_complement.sh b/docker/complement/conf/start_for_complement.sh index a48b44db90e..cc798a32106 100755 --- a/docker/complement/conf/start_for_complement.sh +++ b/docker/complement/conf/start_for_complement.sh @@ -32,13 +32,9 @@ case "$SYNAPSE_COMPLEMENT_DATABASE" in ;; sqlite|"") - # Check that START_POSTGRES hasn't already been set + # Set START_POSTGRES to false unless it has already been set # (i.e. by another container image inheriting our own). - # If not, then set it here. - if [ -z "$START_POSTGRES" ]; then - # Configure supervisord not to start Postgres. - export START_POSTGRES=false - fi + export START_POSTGRES=${START_POSTGRES:-false} ;; *)