From 4842bdabde24f5300708a31ff09362dac4d9ac1e Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Thu, 19 Jan 2023 16:51:32 +0000 Subject: [PATCH 1/3] Add missing worker types to start_for_complement We were missing some possible worker types from the list that is used in CI and complement.sh. This will likely cause CI to be slower, but comes with the benefit of more complete test coverage. 'account_data' being missing from this list caused CI to not catch https://github.com/matrix-org/synapse/pull/14869. --- docker/complement/conf/start_for_complement.sh | 9 ++++++++- docker/configure_workers_and_start.py | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docker/complement/conf/start_for_complement.sh b/docker/complement/conf/start_for_complement.sh index 49d79745b064..a92f55cb5ed4 100755 --- a/docker/complement/conf/start_for_complement.sh +++ b/docker/complement/conf/start_for_complement.sh @@ -50,6 +50,8 @@ if [[ -n "$SYNAPSE_COMPLEMENT_USE_WORKERS" ]]; then # -n True if the length of string is non-zero. # -z True if the length of string is zero. if [[ -z "$SYNAPSE_WORKER_TYPES" ]]; then + # This list corresponds to the keys of the WORKERS_CONFIG dict in + # synapse/docker/configure_workers_and_start.py export SYNAPSE_WORKER_TYPES="\ event_persister, \ event_persister, \ @@ -64,7 +66,12 @@ if [[ -n "$SYNAPSE_COMPLEMENT_USE_WORKERS" ]]; then synchrotron, \ client_reader, \ appservice, \ - pusher" + pusher, \ + account_data, \ + presence, \ + receipts, \ + to_device, \ + typing" fi log "Workers requested: $SYNAPSE_WORKER_TYPES" diff --git a/docker/configure_workers_and_start.py b/docker/configure_workers_and_start.py index 58c62f2231f3..e50e3242a5a0 100755 --- a/docker/configure_workers_and_start.py +++ b/docker/configure_workers_and_start.py @@ -57,6 +57,11 @@ # Stream Writers require "client" and "replication" listeners because they # have to attach by instance_map to the master process and have client endpoints. WORKERS_CONFIG: Dict[str, Dict[str, Any]] = { + # NOTE: Any new entries added to this list should also be added to the + # SYNAPSE_WORKER_TYPES environment variable in + # docker/complement/conf/start_for_complement.sh in order to include + # those workers in the worker-mode Complement runs in CI, and when + # using scripts-dev/complement.sh locally. "pusher": { "app": "synapse.app.generic_worker", "listener_resources": [], From 1a398983a92b7a5c38486b04abeb57c064d32582 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Thu, 19 Jan 2023 16:54:30 +0000 Subject: [PATCH 2/3] changelog --- changelog.d/14871.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/14871.misc diff --git a/changelog.d/14871.misc b/changelog.d/14871.misc new file mode 100644 index 000000000000..0637569b1161 --- /dev/null +++ b/changelog.d/14871.misc @@ -0,0 +1 @@ +Add more worker types in worker-enabled Complement runs. \ No newline at end of file From 5ae078465f97f61710cc860db6f88f11049f5dc8 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Thu, 9 Feb 2023 19:32:39 +0000 Subject: [PATCH 3/3] Raise number of allowed postgres clients to 200 --- docker/complement/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker/complement/Dockerfile b/docker/complement/Dockerfile index be1aa1c55e09..40b6391b5f6b 100644 --- a/docker/complement/Dockerfile +++ b/docker/complement/Dockerfile @@ -28,6 +28,10 @@ FROM $FROM # We also initialize the database at build time, rather than runtime, so that it's faster to spin up the image. RUN gosu postgres initdb --locale=C --encoding=UTF-8 --auth-host password + # Raise the number of maximum client connections to postgres. + # This is necessary when running Synapse in worker mode in Complement. + RUN echo "ALTER SYSTEM SET max_connections = '200'" | gosu postgres postgres --single + # Configure a password and create a database for Synapse RUN echo "ALTER USER postgres PASSWORD 'somesecret'" | gosu postgres postgres --single RUN echo "CREATE DATABASE synapse" | gosu postgres postgres --single