Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Ship worker-enabled services files by default
Browse files Browse the repository at this point in the history
  • Loading branch information
behrmann committed Aug 22, 2022
1 parent 951eb76 commit 13bc29f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ AssertPathExists=/etc/matrix-synapse/workers/%i.yaml
PartOf=matrix-synapse.target
ReloadPropagatedFrom=matrix-synapse.target

# if this is started at the same time as the main, let the main process start
# If this is started at the same time as the main, let the main process start
# first, to initialise the database schema.
After=matrix-synapse.service

Expand Down
7 changes: 6 additions & 1 deletion debian/matrix-synapse.service
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
[Unit]
Description=Synapse Matrix homeserver

# This service should be restarted when the synapse target is restarted.
PartOf=matrix-synapse.target
ReloadPropagatedFrom=matrix-synapse.target

[Service]
Type=notify
NotifyAccess=main
User=matrix-synapse
WorkingDirectory=/var/lib/matrix-synapse
EnvironmentFile=-/etc/default/matrix-synapse
Expand All @@ -14,4 +19,4 @@ RestartSec=3
SyslogIdentifier=matrix-synapse

[Install]
WantedBy=multi-user.target
WantedBy=matrix-synapse.target
File renamed without changes.
1 change: 1 addition & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ PACKAGE_NAME:=`dh_listpackages`

override_dh_installsystemd:
dh_installsystemd --name=matrix-synapse
dh_installsystemd --no-enable --name=matrix-synapse-worker@ [email protected]

# we don't really want to strip the symbols from our object files.
override_dh_strip:
Expand Down
18 changes: 3 additions & 15 deletions docs/systemd-with-workers/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
# Setting up Synapse with Workers and Systemd

This is a setup for managing synapse with systemd, including support for
managing workers. It provides a `matrix-synapse` service for the master, as
well as a `matrix-synapse-worker@` service template for any workers you
require. Additionally, to group the required services, it sets up a
`matrix-synapse.target`.

See the folder [system](https://github.com/matrix-org/synapse/tree/develop/docs/systemd-with-workers/system/)
for the systemd unit files.
The necessary service files are included in the Debian packaging, see
[debian](https://github.com/matrix-org/synapse/tree/develop/debian/) for the
systemd unit files.

The folder [workers](https://github.com/matrix-org/synapse/tree/develop/docs/systemd-with-workers/workers/)
contains an example configuration for the `generic_worker` worker.
Expand All @@ -33,18 +28,11 @@ There is no need for a separate configuration file for the master process.
## Set up

1. Adjust synapse configuration files as above.
1. Copy the `*.service` and `*.target` files in [system](https://github.com/matrix-org/synapse/tree/develop/docs/systemd-with-workers/system/)
to `/etc/systemd/system`.
1. Run `systemctl daemon-reload` to tell systemd to load the new unit files.
1. Run `systemctl enable matrix-synapse.service`. This will configure the
synapse master process to be started as part of the `matrix-synapse.target`
target.
1. For each worker process to be enabled, run `systemctl enable
matrix-synapse-worker@<worker_name>.service`. For each `<worker_name>`, there
should be a corresponding configuration file.
`/etc/matrix-synapse/workers/<worker_name>.yaml`.
1. Start all the synapse processes with `systemctl start matrix-synapse.target`.
1. Tell systemd to start synapse on boot with `systemctl enable matrix-synapse.target`.

## Usage

Expand Down
22 changes: 0 additions & 22 deletions docs/systemd-with-workers/system/matrix-synapse.service

This file was deleted.

0 comments on commit 13bc29f

Please sign in to comment.