Deploy Synapse
Synapse 1.165 Matrix homeserver: pinned, Postgres, keys on a volume
Just deployed
/var/lib/postgresql/data
Just deployed
/data
Deploy and Host Synapse on Railway
Synapse is the Matrix homeserver developed by Element. It stores your users, rooms and message history, serves Matrix clients such as Element, Cinny and FluffyChat, and federates with other Matrix servers. You keep your accounts and data on your own server, and your users can still talk to anyone else on the Matrix network.
About Hosting Synapse
This template runs Synapse v1.165.0 from the official image, pinned by version and digest, with Railway PostgreSQL. It needs no prompts. On first start it creates a synapse database with the C locale that Synapse requires. It also generates the signing key and the server secrets and stores them on the /data volume, next to the uploaded media. It creates an admin account with a generated password, which you can read in the Synapse service's Variables tab. Your Railway domain becomes the server name. Synapse serves /.well-known/matrix/server itself, so federation works over HTTPS port 443 without a reverse proxy. Sign-up is closed by default.
Common Use Cases
- Private, end-to-end encrypted chat for a team, family or community, with the data on your own server
- A Matrix server for your own domain that federates with matrix.org and other homeservers
- A base for Matrix bridges and bots (Slack, Discord, Telegram, IRC) that you run yourself
Dependencies for Synapse Hosting
- PostgreSQL (included: Railway's Postgres service, with a volume)
- A Matrix client to sign in, such as Element at app.element.io (Synapse has no web interface of its own)
Deployment Dependencies
- Synapse source and releases: https://github.com/element-hq/synapse/releases
- Configuration manual: https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html
- Template repo (Dockerfile, start script, changelog): https://github.com/aalfath/synapse-railway-template
Implementation Details
After deploy:
- Open
https://YOUR-DOMAIN/health. It answersOK. - In Element (or another Matrix client), choose "Edit" next to the homeserver, enter
https://YOUR-DOMAIN, and sign in asadminwith theSYNAPSE_ADMIN_PASSWORDfrom the Synapse service's Variables tab. - Add users with the admin API. Or set
SYNAPSE_ENABLE_REGISTRATION=true: sign-up then still needs a registration token that you create with the admin API. - Check federation at federationtester.matrix.org.
Server name. SYNAPSE_SERVER_NAME is the :domain part of every user ID, and Synapse can't change it after the first start. To use your own domain, add it to the service and set both SYNAPSE_SERVER_NAME and SYNAPSE_PUBLIC_BASEURL before you create accounts. If they don't match the volume, the start script refuses to start rather than corrupt your data.
Configuration. homeserver.yaml is rewritten from the variables on every start, so a changed variable takes effect on the next deploy. Put any other setting (SMTP, OIDC login, TURN, URL previews) in a YAML file under /data/conf.d/.
Updates. The Synapse service builds from the template's GitHub repo. When we bump the pinned Synapse version there, Railway shows an "update available" notice in your project, and you choose when to apply it. Read CHANGELOG.md first. Synapse migrates its database on start.
Why Deploy Synapse on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Synapse on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
