Synapse matrix homeserver with systemd

I run a Matrix homeserver and until recently I was using the virtualenv + synctl method to start the service, which they describe in the README. What I really wanted was to put it into systemd so that I can start and stop it like any other system service.

There is a basic synapse.service file in the synapse repository for Arch Linux. It needs tweaking a bit to work with a virtualenv installation. In my case I have a user called synapse and all the homeserver files are in /home/synapse.

I created a file /etc/systemd/system/synapse.service:

The main trick is to use the python associated with the virtual environment so that it can find the homeserver and all its dependencies. By running python directly systemd is able to track that the process is running – if you use synctl start it forks off into the background shortly after and systemd thinks it failed.

Then it’s just matter of:


This entry was posted in sysadmin. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *