Self-host Matrix Synapse (Postgres) with Levelrail

A Matrix homeserver backed by Postgres, for self-hosted federated chat and voice/video signaling.

  • Memory1 GiB
  • Archarm64
  • Services2

How to self-host Matrix Synapse (Postgres)

  1. Pull the images

    2 images are pulled on your server.

    Show images
    • postgres:16-alpine
    • matrixdotorg/synapse:latest
  2. Create the app

    2 services start in a single Compose app, with 2 named volume mounts for your data, on port 8008.

  3. Fill in the secrets

    4 secrets are generated and stored encrypted, 7 settings are preset, you do not have to fill in anything.

  4. Open it

    Without a domain the app gets an sslip.io address; add --domain SERVICE=HOST to use your own.

Matrix Synapse (Postgres) requirements

Memory
About 1 GiB
Architectures
amd64 image published, arm64 image published
Ports
8008
Domain
Optional, an sslip.io address is used without one
Settings
none to fill in
License
not yet recorded
  • Listed. It is in the catalog but not verified. Back up the data volume before changing an image tag.
  • Host ports. It publishes port 8008 on the host, so open them in the VPS firewall only if you want that.
  • Review. Image is not pinned to a version tag, so a redeploy can pull different code (matrixdotorg/synapse:latest).

Install Levelrail first

On a server with Levelrail running, run the command above, or open the dashboard: Apps, New app, Browse templates, then Matrix Synapse (Postgres). New to Levelrail? Install it on a fresh VPS first.

docker pull ghcr.io/glincker/levelrail:latest

Then levelrail-cli login --device. See Getting started and the Matrix Synapse (Postgres) docs page.

Deploy Matrix Synapse (Postgres) your way

Every format below deploys the same pinned images. Pick the one that fits how you work.

Deploy Matrix Synapse (Postgres) from the CLI

levelrail-cli templates deploy matrix-synapse-postgres --name my-matrix-synapse-postgres

Deploy Matrix Synapse (Postgres) with the API

Create a token in the dashboard first. This one-click route deploys it as a trial app you can keep or remove.

curl -X POST -H "Authorization: Bearer $TOKEN" \
  https://levelrail.example.com/api/v1/service-templates/matrix-synapse-postgres/deploy

Matrix Synapse (Postgres) configuration

Matrix Synapse (Postgres) services

ServiceImagePortsVolumes
postgres postgres:16-alpine none synapse_postgres_data -> /var/lib/postgresql/data
synapse matrixdotorg/synapse:latest 8008 synapse_data -> /data

Matrix Synapse (Postgres) environment variables

VariableServiceValue
POSTGRES_DB postgres Preset by the template
POSTGRES_INITDB_ARGS postgres Preset by the template
POSTGRES_PASSWORD postgres Generated at deploy
POSTGRES_USER postgres Preset by the template
ADMIN_PASSWORD synapse Generated at deploy
ADMIN_USERNAME synapse Generated at deploy
DB_PASSWORD synapse Generated at deploy
ENABLE_REGISTRATION synapse Preset by the template
Show all 11 variables
  • SYNAPSE_PUBLIC_BASEURLsynapsePreset by the template
  • SYNAPSE_REPORT_STATSsynapsePreset by the template
  • SYNAPSE_SERVER_NAMEsynapsePreset by the template

Ports and volumes

Ports
8008
Volumes
2 named mounts: synapse_postgres_data -> /var/lib/postgresql/data, synapse_data -> /data

Matrix Synapse (Postgres) FAQ

How much memory does Matrix Synapse (Postgres) need?

The catalog lists about 1 GiB of memory for Matrix Synapse (Postgres) across its 2 services.

Does Matrix Synapse (Postgres) run on arm64?

For Matrix Synapse (Postgres), an arm64 image is published; amd64 is image published.

Does Matrix Synapse (Postgres) need configuration before it starts?

No. The template fills in its own defaults and generates secrets at deploy time.

Which database does Matrix Synapse (Postgres) bundle?

The template includes Postgres, running as its own service.

Which ports does Matrix Synapse (Postgres) use?

Matrix Synapse (Postgres) listens on port 8008 inside the stack.

Where does Matrix Synapse (Postgres) keep its data?

In named volumes: synapse_postgres_data mounted at /var/lib/postgresql/data and synapse_data mounted at /data.

Can I deploy Matrix Synapse (Postgres) on Dokploy or Dokku?

The services and pinned images on this page can be run on any Docker host. The public Dokploy templates list we compared does not have an entry with the same id for Matrix Synapse (Postgres), so on Dokploy you would use a Docker Compose application with the file from this page. Dokku deploys container images with its own commands, so the pinned image postgres:16-alpine, matrixdotorg/synapse:latest is what you deploy there.

levelrail-cli templates deploy matrix-synapse-postgres --name my-matrix-synapse-postgres