Docker compose managed Synapse home server with Postgres and Riot.
- Synapse and Coturn: avhost/docker-matrix
- Postgres: postgres
- Element: vectorim/element-web
- Volume provisioner: hasnat/volumes-provisioner
- Docker
- docker-compose
- A reverse proxy
- Python 3 (for admin scripts)
You will need to have a reverse proxy setup. I use a variant of jwilder/nginx-proxy.
Assuming you have some base domain, domain.com, and you want the matrix client to use matrix.domain.com and Element to be at element.domain.com, you will need the following from your reverse proxy:
- Listen on 443 for matrix.domain.com and forward to the Synapse container (name: matrix-synapse) at port 8008
- Listen on 8448 for domain.com and forward to the Synapse container (name: matrix-synapse) at port 8008
- Listen on 443 for element.domain.com and forward to the Riot container (name: matrix-element) at port 80
See docs/reverse_proxy for Synapse docs on reverse proxying.
- Configure env files
- Copy
samples/envto.envand set desired values - Copy
samples/{postgres|synapse|element}.envfiles to top level directory and set desired values
- Copy
- Configure postgres synapse user
- Copy
samples/init.sqltoconfig/init.sql - Add postrgres synapse user password in
config/init.sql
- Copy
- Configure Riot
- Copy
samples/config.jsontoconfig/config.json - Change desired settings
- Copy
- Run
setup/generate.sh - Configure Synapse
- Copy
config/generated/homeserver.yamltoconfig/homeserver.yaml - Configure
databasesection - Make other desired changes (see sample)
- Copy
- Configure Coturn
- Copy
config/generated/turnserver.conftoconfig/turnserver.conf - Add
min-port=49152andmax-port=49300or desired range - Be sure to update the port ranges in
docker-compose.ymlif you change these values - Make other desired changes to
config/turnserver.conf
- Copy
- Run
setup/init.sh - Run
docker-compose up -d
- Register your user
- Make user an admin:
docker-compose exec postgres bashpsql -U postgress\c synapseUPDATE users SET admin = 1 WHERE name = '@foo:bar.com'
The following are the settings I have changed from the generated homeserver config.
public_baseurl: https://matrix.domain.com/- Keys under
Listenersand valueport: 8008:bind_addresses: ['0.0.0.0']
admin_contact: 'mailto:email@email.email'- Keys under
database:name: psycopg2- Keys under
args:user: synapsepassword: "changethisbadpassword"database: synapsehost: postgrescp_min: 5cp_max: 10
enable_registration: true- This enables registration from your Riot client; set to
falseif you want to disable.
- This enables registration from your Riot client; set to
- Values under
registrations_require_3pid:- email
disable_msisdn_registration: trueenable_3pid_lookup: true- Keys under
email:smtp_host: smtp.gmail.comsmtp_port: 587smtp_user: "email@gmail.com"smtp_pass: "gmailpassword"require_transport_security: truenotif_from: "%(app)s Homeserver <email@gmail.com>"app_name: "whatever"enable_notifs: trueclient_base_url: "https://element.domain.com"
- Keys under
push:include_content: true
- Keys under
server_notices:system_mxid_localpart: noticessystem_mxid_display_name: "Server Notices"room_name: "Server Notices"
adm/synapseadm provides a convient command line wrapper around curling the Synapse admin API. This is written with Python 3.
Run adm/synapseadm --help to see available commands.
See docs/admin_api for additional Synapse admin API.
- Synapse docs: synapse
- Generating
homeserver.yaml: synapse/docker - Postgres settings: docs/postgres
- Federation
- Email settings: synapse/install
- Reverse proxy: docs/reverse_proxy
- TURN
- Synapse Admin API: docs/admin_api
- Matrix FAQ
- Matrix API
- Element docs: element
- Configuration: docs/config
- Key backup:
- Used for inspiration