docker-compose.yml - A work in progress.
--- version: '3.3' networks: traefik_network: external: name: homelabos_traefik services: app: image: matrixdotorg/synapse restart: always networks: - traefik_network volumes: - /var/homelabos/Matrix/matrix:/data labels: - "traefik.http.services.matrix.loadbalancer.server.scheme=http" - "traefik.http.services.matrix.loadbalancer.server.port=8008" - "traefik.enable=true" - "traefik.docker.network=homelabos_traefik" - "traefik.http.routers.matrix-http.service=matrix" - "traefik.http.routers.matrix-http.rule=Host(`matrix.<DOMAIN NAME>`)" - "traefik.http.routers.matrix-http.entrypoints=http" # - "traefik.http.routers.matrix-http.middlewares=authelia@file, customFrameHomelab@file" - "traefik.http.routers.matrix.service=matrix" - "traefik.http.routers.matrix.rule=Host(`matrix.<DOMAIN NAME>`)" - "traefik.http.routers.matrix.entrypoints=https" # - "traefik.http.routers.matrix.middlewares=authelia@file, customFrameHomelab@file" - "traefik.http.routers.matrix.tls=true" - "traefik.http.routers.matrix.tls.certresolver=http"
The following steps are then needed:
docker run -it --rm -v /var/homelabos/Matrix/matrix:/data -e SYNAPSE_SERVER_NAME=matrix.<DOMAIN> -e SYNAPSE_REPORT_STATS=yes matrixdotorg/synapse:latest generate
This generates the configuration files for editing in /var/homelabos/Matrix/matrix/
There will be a file called 'homeserver.yaml' which is a big long configuration file. Still getting my head around it..
docker-compose up -d
I found the least sucky way to generate an admin user was the following which is adapted specifically for the setup above. You can enable user registration in the homeserver yaml but leaves your server open to others registering.
docker exec -it matrix_app_1 register_new_matrix_user http://localhost:8008 -c /data/homeserver.yaml
Snakes on a plane! we can register an admin user:
New user localpart [root]: username Password: password Confirm password: password Make admin [no]: yes|no Sending registration request... Success.
username and password of your choice are set here. Make admin..
docker-compose up -d
Actually ignore me restarting probably unecessary there.
So: we now move on to https://matrix.<DOMAIN> to see that Synape now does indeed live.
Give it a few seconds to start but then it will redirect to:
Have a cup of tea. Have another one. Eat some cheese crackers. Let the dogs out for a piss.
You can head over to
riot.im or a matrix client of your choice and select your new custom server to log in to your server. You'll be talking to yourself of course, but hey, lockdown, what's new?
Federation and base domain is explained in more detail here and getting Matrix to talk to other Matrix servers is kind of the whole point unless you just want a private chat invite only instance.
Much of the above work was adapted from:
Now certain groovy fellas (and ladies, lets be correct here) have also adapted the docker-compose.yml to have an all in one of teh Synapse server, an admin utility for user management and also host a matrix client all on the same server. That sounds really sexy doesn't it?
Zblesk has the best clues on how to do this:
A few more clues here about SRV records on the domain but a bit over my head..