[arch-commits] Commit in matrix-synapse/trunk (5 files)

Johannes Löthberg demize at archlinux.org
Sun May 23 22:01:14 UTC 2021


    Date: Sunday, May 23, 2021 @ 22:01:14
  Author: demize
Revision: 943521

Add support for worker processes

Fixes FS#65304.

Added:
  matrix-synapse/trunk/generic_worker.yaml.example
  matrix-synapse/trunk/synapse-worker at .service
  matrix-synapse/trunk/synapse.target
Modified:
  matrix-synapse/trunk/PKGBUILD
  matrix-synapse/trunk/synapse.service

-----------------------------+
 PKGBUILD                    |   11 +++++++++--
 generic_worker.yaml.example |   34 ++++++++++++++++++++++++++++++++++
 synapse-worker at .service     |   22 ++++++++++++++++++++++
 synapse.service             |    6 ++++--
 synapse.target              |    7 +++++++
 5 files changed, 76 insertions(+), 4 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2021-05-23 21:59:24 UTC (rev 943520)
+++ PKGBUILD	2021-05-23 22:01:14 UTC (rev 943521)
@@ -33,7 +33,10 @@
             'python-hiredis')
 
 source=("synapse-$pkgver.tar.gz::https://github.com/matrix-org/synapse/archive/v$pkgver.tar.gz"
+        'generic_worker.yaml.example'
         'synapse.service'
+        'synapse.target'
+        'synapse-worker at .service'
         'sysusers-synapse.conf'
         'tmpfiles-synapse.conf')
 
@@ -40,6 +43,9 @@
 sha256sums=('d74654ca8859dc4d0794dd46663d2f88d5bd36b38fd48a820e235ab50cc8a726'
             'SKIP'
             'SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
             'SKIP')
 
 backup=('etc/synapse/log_config.yaml')
@@ -60,10 +66,11 @@
 	export PYTHONHASHSEED=0
 	python setup.py install --root "$pkgdir" --optimize=1 --skip-build
 
-	install -dm755 -o 198 -g 198 "$pkgdir"/etc/synapse
+	install -dm755 -o 198 -g 198 "$pkgdir"/etc/synapse{,workers}
 	install -Dm644 contrib/systemd/log_config.yaml "$pkgdir"/etc/synapse/log_config.yaml
+	install -Dm644 "$srcdir"/generic_worker.yaml.example "$pkgdir"/etc/synapse/workers/generic_worker.yaml.example
 
-	install -Dm644 -t "$pkgdir"/usr/lib/systemd/system/ "$srcdir"/synapse.service
+	install -Dm644 -t "$pkgdir"/usr/lib/systemd/system/ "$srcdir"/synapse{,-worker@}.service "$srcdir"/synapse.target
 	install -Dm644 "$srcdir"/sysusers-synapse.conf "$pkgdir"/usr/lib/sysusers.d/synapse.conf
 	install -Dm644 "$srcdir"/tmpfiles-synapse.conf "$pkgdir"/usr/lib/tmpfiles.d/synapse.conf
 }

Added: generic_worker.yaml.example
===================================================================
--- generic_worker.yaml.example	                        (rev 0)
+++ generic_worker.yaml.example	2021-05-23 22:01:14 UTC (rev 943521)
@@ -0,0 +1,34 @@
+# To configure workers please refer to:
+# https://github.com/matrix-org/synapse/blob/master/docs/workers.md
+
+# The type of the worker. A generic_worker can handle a part of the
+# client/federation API requests, taking some load from the master
+# process.
+# If used, the reverse proxy has to be configured accordingly.
+worker_app: synapse.app.generic_worker
+
+# The name of the worker. Must be unique among all workers.
+worker_name: worker1
+
+# The replication listener on the main synapse process.
+worker_replication_host: '127.0.0.1'
+worker_replication_http_port: 9093
+
+
+worker_listeners:
+ - type: http
+   bind_address: '127.0.0.1'
+   port: 8083
+
+# Uncomment the following to make this worker respect the
+# X-Forwarded-For header set by your reverse proxy.
+#   x_forwarded: true
+
+# Because a generic_worker handles client and federation API requests
+# it needs the client and federation resources.
+   resources:
+     - names:
+       - client
+       - federation
+
+worker_log_config: /etc/synapse/log_config.yaml

Added: synapse-worker at .service
===================================================================
--- synapse-worker at .service	                        (rev 0)
+++ synapse-worker at .service	2021-05-23 22:01:14 UTC (rev 943521)
@@ -0,0 +1,22 @@
+[Unit]
+Description=Synapse Matrix homeserver (%i)
+AssertPathExists=/etc/synapse/workers/%i.yaml
+PartOf=synapse.target
+ReloadPropagatedFrom=synapse.target
+After=synapse.service
+
+[Service]
+Type=notify
+User=synapse
+Group=synapse
+SyslogIdentifier=synapse-%i
+Environment=LANG=en_US.UTF-8
+WorkingDirectory=/var/lib/synapse
+ExecStart=/usr/bin/python3 -m synapse.app.generic_worker --config-path=/etc/synapse/homeserver.yaml --config-path=/etc/synapse/workers/%i.yaml
+ExecReload=/bin/kill -HUP $MAINPID
+EnvironmentFile=-/etc/default/synapse
+Restart=always
+RestartSec=3
+
+[Install]
+WantedBy=synapse.target

Modified: synapse.service
===================================================================
--- synapse.service	2021-05-23 21:59:24 UTC (rev 943520)
+++ synapse.service	2021-05-23 22:01:14 UTC (rev 943521)
@@ -1,7 +1,9 @@
 [Unit]
-Description=Synapse Matrix homeserver
+Description=Synapse Matrix homeserver (master)
 After=network-online.target
 Wants=network-online.target
+PartOf=synapse.target
+ReloadPropagatedFrom=synapse.target
 
 [Service]
 Type=notify
@@ -18,4 +20,4 @@
 RestartSec=3
 
 [Install]
-WantedBy=multi-user.target
+WantedBy=multi-user.target synapse.target

Added: synapse.target
===================================================================
--- synapse.target	                        (rev 0)
+++ synapse.target	2021-05-23 22:01:14 UTC (rev 943521)
@@ -0,0 +1,7 @@
+[Unit]
+Description=Synapse parent target
+After=network-online.target
+Wants=network-online.target
+
+[Install]
+WantedBy=multi-user.target



More information about the arch-commits mailing list