[__matrix_synapse_worker] various tweaks and fixes following testing

This commit is contained in:
fnux 2021-02-18 14:10:19 +01:00
parent adc335669d
commit 6487839cf5
No known key found for this signature in database
GPG Key ID: 4502C902C00A1E12
5 changed files with 23 additions and 11 deletions

View File

@ -15,9 +15,9 @@ NotifyAccess=main
User=matrix-synapse User=matrix-synapse
WorkingDirectory=/var/lib/matrix-synapse WorkingDirectory=/var/lib/matrix-synapse
EnvironmentFile=/etc/default/matrix-synapse EnvironmentFile=/etc/default/matrix-synapse
ExecStart=/opt/venvs/matrix-synapse/bin/python -m synapse.app.generic_worker --config-path=/etc/matrix-synapse/homeserver.yaml --config-path=/etc/matrix-synapse/conf.d/ --config-path=/etc/matrix-synapse/workers/%i.yaml ExecStart=/usr/bin/python3 -m synapse.app.generic_worker --config-path=/etc/matrix-synapse/homeserver.yaml --config-path=/etc/matrix-synapse/conf.d/ --config-path=/etc/matrix-synapse/workers/
ExecReload=/bin/kill -HUP $MAINPID ExecReload=/bin/kill -HUP $MAINPID
Restart=always Restart=on-failure
RestartSec=3 RestartSec=3
SyslogIdentifier=matrix-synapse-%i SyslogIdentifier=matrix-synapse-%i

View File

@ -6,11 +6,11 @@ worker_name: "${WORKER_NAME:?}"
# The replication listener on the main synapse process. # The replication listener on the main synapse process.
worker_replication_host: "${WORKER_REPLICATION_HOST:?}" worker_replication_host: "${WORKER_REPLICATION_HOST:?}"
worker_replication_http_port: "${WORKER_REPLICATION_PORT:?}" worker_replication_http_port: ${WORKER_REPLICATION_PORT:?}
worker_listeners: worker_listeners:
- type: http - type: http
port: "${WORKER_PORT:?}" port: ${WORKER_PORT:?}
resources: resources:
- names: - names:
EOF EOF

View File

@ -0,0 +1,12 @@
#!/bin/sh
# Designed for Debian/systemd - make sure to adapt when you add support for other
# distributions/OSs.
name=$__object_id
synapse_conf_dir='/etc/matrix-synapse'
synapse_workers_conf_dir="$synapse_conf_dir/workers"
systemd_worker_service="matrix-synapse-worker@$name"
if grep -qE "^__file$synapse_workers_conf_dir/$name" "${__messages_in}"; then
echo "systemctl restart $systemd_worker_service"
fi

View File

@ -8,7 +8,7 @@ os=$(cat "$__global/explorer/os")
case "$os" in case "$os" in
debian) debian)
synapse_conf_dir='/etc/synapse' synapse_conf_dir='/etc/matrix-synapse'
synapse_workers_conf_dir="$synapse_conf_dir/workers" synapse_workers_conf_dir="$synapse_conf_dir/workers"
# Synapse log configuration on debian - default value of config-log # Synapse log configuration on debian - default value of config-log
@ -53,14 +53,15 @@ require="__directory/$synapse_workers_conf_dir" \
--source "$__object/files/worker.yaml" \ --source "$__object/files/worker.yaml" \
--mode 0644 --mode 0644
__file "/etc/systemd/systemd/matrix-synapse-worker@.service" \ __file "/etc/systemd/system/matrix-synapse-worker@.service" \
--source "$__type/files/matrix-synapse-worker@.service" \ --source "$__type/files/matrix-synapse-worker@.service" \
--mode 0644 \ --mode 0644 \
--state $systemd_worker_service_override --state $systemd_worker_service_override
# Start service, enable at boot. # Start service, enable at boot.
require="__file/$synapse_workers_conf_dir/$name.yaml \ service_req=
__file/etc/systemd/systemd/matrix-synapse-worker@.service" \ if [ "$systemd_worker_service_override" ]; then
__service "$systemd_worker_service" --action start service_req="__file/etc/systemd/system/matrix-synapse-worker@.service"
require="__service/$systemd_worker_service" \ fi
require="__file/$synapse_workers_conf_dir/$name.yaml $service_req" \
__start_on_boot "$systemd_worker_service" __start_on_boot "$systemd_worker_service"

View File

@ -1,3 +1,2 @@
app app
name
port port