User Tools

Site Tools


computing:synapse

This is an old revision of the document!



  • synapse
  • Jonathan Haack
  • Haack's Networking
  • webmaster@haacksnetworking.org

synapse


This tutorial is for users of Debian GNU/Linux who want to create their own Synapse instance. The official documentation was pretty solid, but/and I also used some online tutorials, especially the one at Hack Liberty. Although I give credit to these sites, I must say that they both had tons of small to medium mistakes which, combined with the complexity of the project, made this a fairly challenging instance to create. I am quite glad the VM is built, backed up and tarballed. Okay, so first, install synapse and add the gpg keys for their repo, etc.:

sudo apt install -y lsb-release wget apt-transport-https
sudo wget -O /usr/share/keyrings/matrix-org-archive-keyring.gpg https://packages.matrix.org/debian/matrix-org-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/matrix-org-archive-keyring.gpg] https://packages.matrix.org/debian/ $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/matrix-org.list
sudo apt update
sudo apt install matrix-synapse-py3

You now need to install postgresql and create a database with a dedicated non-root user:

sudo apt install postgresql
sudo -u postgres bash
createuser --pwprompt synapse_user
createdb --encoding=UTF8 --locale=C --template=template0 --owner=synapse_user synapse
exit

After creating the database, inform synapse of how to reach it in the pg_hba.conf file as follows:

nano /etc/postgresql/13/main/pg_hba.conf
<host    synapse     synapse_user    ::1/128     md5>
sudo systemctl reload postgresql

It's now time to edit the file /etc/matrix-synapse/homeserver.yaml. Remove the default database configuration, and replace it with the credentials you just made:

<database:>
<name: psycopg2>
<txn_limit: 10000>
<args:>
  <user: synapse_user>
  <password: secretpassword>
  <database: synapse>
  <host: localhost>
  <port: 5432>
  <cp_min: 5>
  <cp_max: 10>

There are now some options that you can configure based on personal preference. Hack Liberty has its own recommendations, and I agreed with some and not with others. Moreover, I also found that Matrix/Synapse is currently requiring a stricter recipe for the yaml config than their template or even the official docs recommend. I was unable to get to the homeserver.yaml to work without adding a base_url line and a Google V2 challenge. Here are the configurations that I have active:

oemb1905 2022/11/19 22:17

computing/synapse.1668924110.txt.gz · Last modified: 2022/11/20 06:01 by oemb1905