Skip to content

Infra - matrix synapse postgres swarm stack

Matrix Swarm Stack

Right now the elementary matrix swarm stack (synapse + postgres) is just missing a configuration yaml that needs to be generated on at its instantiation. We can import the postgres database being used at the current matrix.atitlan.io into this.

Create the homeserver.yaml file in /var/lib/docker/volumes/synapse-data/

docker run -it --rm \
    --mount type=volume,src=synapse-data,dst=/data \
    -e SYNAPSE_SERVER_NAME=my.matrix.host \
    -e SYNAPSE_REPORT_STATS=no \
    matrixdotorg/synapse:latest generate

reference : https://hub.docker.com/r/matrixdotorg/synapse (Generating a Configuration File) installation: https://element-hq.github.io/synapse/latest/setup/installation.html (Note: we can use type=bind with a full path here in order to generate the configuration file + its contents to a custom path)

  • DOUBLE CHECK THIS the SYNAPSE_SERVER_NAME my.matrix.host corresponds to what you would see in the full user name @user:my.matrix.host so in the case of the atitlanio matrix it will simply be atitlan.io (note that this is without the matrix subdomain) so you have @user:atitlan.io link

modify the homeserver.yaml file, e.g., for federation (which is one by default), user registration, etc

user registration

https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html#registration

  • we can now create the docker swarm stack using the local volume which has the same name as the src specificed above synapse-data

Other tasks (to be determined which make sense for this story and which deserve, maybe, their own story)

Element web client

Specific References

using matrix.example.com and element.example.com and .well-known (required for federation discovery)

link 1 - element-hq link 2 - ansible deploy reference

More on federation

link - element-hq

Turn Server for audio/video calls

Link 1 - element-hq link 2 - ansible deploy incl other services

Ansible Deploy Github repo link

Conclusion

There are more moving parts than expected,

Edited by Patrick Mulligan