A comprehensive Docker Compose setup for running a complete Matrix ecosystem with Element clients, including video calling capabilities.
This project provides a production-ready Docker Compose setup for:
- Synapse - Matrix homeserver
- Element Web - Web-based Matrix client
- Element Call - Video calling application
- Synapse Admin - Administration interface for Synapse
- LiveKit - Video/audio infrastructure for Element Call
- PostgreSQL - Database backend
- Redis - Caching and session storage
- ✅ Complete Matrix server setup with federation support
- ✅ Video calling with LiveKit integration
- ✅ Email notifications and registration
- ✅ reCAPTCHA support for registration
- ✅ Admin interface for user management
- ✅ Secure secret management
- ✅ Health checks and proper service dependencies
- ✅ Template-based configuration system
- Docker and Docker Compose
- A domain name with DNS properly configured
- Ports 8008-8012, 7880-7885 available
-
Clone and prepare the environment:
git clone <repository-url> cd "Element Docker" chmod +x setup.sh ./setup.sh
-
Configure your domain:
- The setup script will prompt for your base domain (e.g.,
example.com) - Update DNS records to point subdomains to your server:
matrix.example.com→ Synapse homeserverelement.example.com→ Element Web clientcall.example.com→ Element Calllivekit.example.com→ LiveKit server
- The setup script will prompt for your base domain (e.g.,
-
Start the services:
docker compose up -d
The first startup will:
- Generate Synapse configuration and secrets
- Initialize the PostgreSQL database
- Template all configuration files
- Start all services in the correct order
All configuration is managed through the .env file (created from .env-sample):
| Variable | Description | Example |
|---|---|---|
DOMAIN |
Your base domain | example.com |
HOMESERVER_FQDN |
Matrix server URL | matrix.example.com |
ELEMENT_WEB_FQDN |
Element Web URL | element.example.com |
ELEMENT_CALL_FQDN |
Element Call URL | call.example.com |
LIVEKIT_FQDN |
LiveKit server URL | livekit.example.com |
LIVEKIT_NODE_IP |
LiveKit public IP | Your server's public IP |
REPORT_STATS |
Send usage stats to Matrix.org | yes or no |
To enable email notifications and registration:
# Uncomment and configure in .env
SMTP_HOST=your.smtp.server
SMTP_PORT=587
[email protected]
SMTP_USER=your_email_userThen create the SMTP password secret:
echo "your_smtp_password" > secrets/smtp_passwordTo enable reCAPTCHA for registration:
- Get keys from Google reCAPTCHA
- Save them:
echo "your_site_key" > secrets/recaptcha/public echo "your_secret_key" > secrets/recaptcha/private
After setup, access your services at:
- Element Web: http://localhost:8010 (or https://element.example.com)
- Synapse Admin: http://localhost:8009
- Element Call: http://localhost:8012
- LiveKit JWT Service: http://localhost:8011
- Synapse: http://localhost:8008
├── compose.yml # Main Docker Compose file
├── .env # Environment configuration
├── setup.sh # Initial setup script
├── data/ # Runtime data (auto-generated)
├── data-template/ # Configuration templates
│ ├── synapse/
│ ├── element-web/
│ ├── element-call/
│ └── livekit/
├── secrets/ # Generated secrets
│ ├── synapse/
│ ├── postgres/
│ └── livekit/
├── init/ # Initialization scripts
└── scripts/ # Helper scripts
Use Synapse Admin (http://localhost:8009) or the command line:
docker compose exec synapse register_new_matrix_user -c /data/homeserver.yaml http://localhost:8008# All services
docker compose logs
# Specific service
docker compose logs synapse
docker compose logs element-webdocker compose pull
docker compose up -d- Check that
LIVEKIT_NODE_IPin.envmatches your server's public IP - Ensure UDP ports 7882-7885 are open in your firewall
- Verify LiveKit is accessible at your configured FQDN
- Verify DNS records for
matrix.example.com - Check that port 8008 is accessible externally
- Test federation with the Matrix Federation Tester
- Verify SMTP configuration in
.env - Check that
secrets/smtp_passwordexists and contains the correct password - Review Synapse logs for email-related errors
- All secrets are automatically generated and stored in the
secrets/directory - Database passwords are randomly generated
- Synapse signing keys are properly managed
- Services run with non-root users where possible
Modify files in data-template/ to customize configurations. The init container will template these with environment variables.
The PostgreSQL setup creates separate databases for synapse and mas (Matrix Authentication Service).
For production, use a reverse proxy like Nginx or Traefik to handle TLS termination and routing to the various services.
- Fork the repository
- Create a feature branch
- Make your changes
- Test with a clean environment
- Submit a pull request
See LICENSE.md for details.
- Issues: GitHub Issues
- Documentation: Matrix.org docs
- Documentation: Synapse docs