Deploy Synapse

Synapse 1.165 Matrix homeserver: pinned, Postgres, keys on a volume

Deploy Synapse

/var/lib/postgresql/data

/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

Implementation Details

After deploy:

  1. Open https://YOUR-DOMAIN/health. It answers OK.
  2. In Element (or another Matrix client), choose "Edit" next to the homeserver, enter https://YOUR-DOMAIN, and sign in as admin with the SYNAPSE_ADMIN_PASSWORD from the Synapse service's Variables tab.
  3. 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.
  4. 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

More templates in this category

View Template
Rocky Linux
Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀

codestorm
51
View Template
Foundry Virtual Tabletop
Self-hosted virtual tabletop for role-playing games (license required)

Lucas
71
View Template
NEW
Double Commander in your browser
The Double Commander file manager in the cloud, from any device

Nermin Sabanovic
0