wmair e789b845cb Rewrite all documentation to reflect current project state
- README: add quickstart.sh as primary entry point, update deployment options
- SETUP.md: replace stale manual wizard with accurate manual config reference
- QUICK_REFERENCE.md: remove emojis/AI fluff, update compose commands, fix stale paths
- BUGFIXES.md: fix compose command references, add CVE-2025-49090, remove emojis

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 14:37:09 +01:00

Matrix Server - Docker Compose Setup

A self-hosted Matrix server stack with modern OIDC authentication, web client, optional video calling, and optional messaging bridges.

What's Included

Core (always on)

Optional: Element Call (--profile element-call)

  • LiveKit — WebRTC SFU media server (self-hosted, media stays on your server)
  • lk-jwt-service — LiveKit token issuer
  • Element Call — Self-hosted video/voice calling frontend

Optional: Messaging Bridges (via setup-bridges.sh)

Optional: Upstream OIDC (--profile authelia)

  • Authelia — SSO / identity provider with 2FA

Quick Start

Simple production deployment — three prompts, everything else is automatic:

./quickstart.sh

Asks for: your domain, a Let's Encrypt email, and whether to enable Element Call. Generates all secrets and configs, starts the stack.

Advanced deployment — local testing, Authelia SSO, multi-machine setups:

./deploy.sh

Bridges are set up separately after the core stack is running:

./setup-bridges.sh

Architecture

Browser
  |
Caddy (HTTPS, Let's Encrypt)
  |
  +-- matrix.example.com  -->  Synapse :8008
  |     /.well-known       -->  (served inline by Caddy)
  |     /login, /logout    -->  MAS :8080
  +-- auth.example.com    -->  MAS :8080
  +-- element.example.com -->  Element Web :80
  +-- admin.example.com   -->  Element Admin :8080
  +-- call.example.com    -->  Element Call :8080   (optional)
  +-- rtc.example.com     -->  lk-jwt-service :8080 (optional)
                               LiveKit :7880         (optional)

All services communicate over an internal Docker network. The database is not exposed.

Deployment Options

Simple production — single machine, Let's Encrypt, no Authelia:

./quickstart.sh

Local testing — self-signed certificates, *.example.test domains:

./deploy.sh  # choose "Local Testing"

Production with Authelia — SSO, 2FA, upstream OIDC:

./deploy.sh  # choose "Production", answer yes to Authelia

Multi-machine — Matrix backend on one server, Caddy on another:

./deploy.sh  # choose "Production" (multi-server mode)

Generates a caddy/Caddyfile.production for the Caddy machine.

Element Call

When enabled, all three components are self-hosted. Media streams never leave your server (they route through your LiveKit SFU). The Element Call frontend is served from your own call. subdomain.

Required open ports in addition to 80 and 443:

  • TCP 7881 (WebRTC signaling)
  • UDP 5010050200 (media streams)

Bridges

setup-bridges.sh configures WhatsApp and Signal automatically. Telegram requires API credentials from my.telegram.org — add them to .env before running:

TELEGRAM_API_ID=your_id
TELEGRAM_API_HASH=your_hash

Bridges use double puppet support (messages appear from your actual Matrix user, not a bridge bot) and have encryption disabled for compatibility with MAS. See BRIDGE_SETUP_GUIDE.md for details.

Requirements

  • Docker and Docker Compose v2
  • A domain with DNS control
  • Ports 80 and 443 accessible from the internet
  • For Element Call: ports 7881/TCP and 5010050200/UDP open

Common Operations

# Status
docker compose ps

# Logs
docker compose logs -f [service]

# Restart a service
docker compose restart synapse

# Update all images
docker compose pull && docker compose up -d

# Bridge logs
docker compose logs mautrix-whatsapp

Data Directories

postgres/data/    database (back this up)
synapse/data/     media store, signing keys
mas/data/         MAS sessions
.env              all secrets and domain config

Backup:

tar -czf matrix-backup-$(date +%Y%m%d).tar.gz postgres/data synapse/data mas/data .env

Documentation

License

  • Synapse: Apache 2.0
  • Matrix Authentication Service: Apache 2.0
  • Element Web / Element Admin / Element Call: Apache 2.0
  • PostgreSQL: PostgreSQL License
  • Caddy: Apache 2.0
  • LiveKit: Apache 2.0
S
Description
Element Server Suite on Docker Compose
Readme 270 KiB
Languages
Shell 100%