This guide assumes that example.com
is your server name, so user IDs will in the format @user:example.com
, and that
matrix.example.com
is the domain name of your actual server.
At least 512 MB memory. Approximate memory usage of services:
- Traefik: 20 MB
- Postgres: 70 MB
- Synapse: 150 MB
Inbound traffic on port 443/tcp.
- Copy the docker-compose.yaml file to your server. Look for the
TODO
comments and edit as necessary. - Create a Docker network for external services:
docker network create proxy
. - Configure DNS A and AAAA records to your server's IP address. This is absolutely necessary so that Traefik can get a TLS certificate.
- Generate a Synapse configuration file:
docker-compose run --rm -e SYNAPSE_SERVER_NAME=example.com -e SYNAPSE_REPORT_STATS=yes matrix_synapse generate
- Edit the Synapse configuration file at synapse/homeserver.yaml and set the following values:
server_name
: set this toexample.com
notmatrix.example.com
.public_baseurl
: set this tohttps://matrix.example.com
.use_presence
: set totrue
database
: should be like:
database:
name: psycopg2
args:
user: synapse
# TODO: change to what you previously set
password: asdf
database: synapse
host: matrix_db
enable_registration
: set totrue
if you don't want to manually register users.
- Start services:
docker-compose up -d
- Register new user:
docker exec -it matrix_synapse register_new_matrix_user -c /data/homeserver.yaml http://localhost:8008
.
Well-Known URIs are to facilitate automatic setup for clients and federation between servers.
The URL https://example.com/.well-known/matrix/client should return JSON in the following format:
{
"m.homeserver": {
"base_url": "https://matrix.example.com"
}
}
To work in browser based clients, the file must be served with the appropriate Cross-Origin Resource Sharing (CORS)
headers. A recommended value would be Access-Control-Allow-Origin: *
which would allow all browser based clients
to view it.
The URL https://example.com/.well-known/matrix/server should return JSON in the following format:
{
"m.server": "matrix.example.com:443"
}
Test that federation is setup properly using the federation tester.
Use example.com
not matrix.example.com
.
References:
If you want to use Cloudflare Tunnels, replace the Traefik service with a cloudflared image. Or if you don't want to run cloudflared in Docker then remove the Traefik service and make configure
matrix_synapse
so it's on an external network and configure cloudflared to point to it.