mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2025-06-25 10:47:51 +02:00
Add initial support for synapse workers
· needs documentation; no checks yet for port clashes or typos in worker name · according to https://github.com/matrix-org/synapse/wiki/Workers-setup-with-nginx#results about 90% of requests go to the synchrotron endpoint · thus, the synchrotron worker is especially suited to be load-balanced · most of the other workers are documented to support only a single instance · https://github.com/matrix-org/synapse/blob/master/docs/workers.md
This commit is contained in:
@ -0,0 +1,29 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
# c.f. https://github.com/matrix-org/synapse/pull/4662
|
||||
[Unit]
|
||||
Description=Synapse Matrix Worker
|
||||
After=matrix-synapse.service
|
||||
BindsTo=matrix-synapse.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
||||
# Intentional delay, so that the homeserver (we likely depend on) can manage to start.
|
||||
ExecStartPre=/bin/sleep 5
|
||||
|
||||
# systemd ftw 🤦♂️
|
||||
# https://github.com/systemd/systemd/issues/14895#issuecomment-594123923
|
||||
ExecStart=/bin/sh -c "WORKER=%i; WORKER=$${WORKER%%:*}; \
|
||||
exec /usr/bin/docker exec \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
matrix-synapse \
|
||||
python -m synapse.app.$${WORKER} -c /data/homeserver.yaml -c /data/worker.%i.yaml"
|
||||
|
||||
ExecStop=/usr/bin/docker exec matrix-synapse pkill -f %i
|
||||
KillMode=process
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
SyslogIdentifier=matrix-synapse-%i
|
||||
|
||||
[Install]
|
||||
WantedBy=matrix-synapse.service
|
Reference in New Issue
Block a user