Skip to content

Instantly share code, notes, and snippets.

@joenas
Last active March 26, 2022 14:14
Show Gist options
  • Save joenas/be7e1ca587301b8910c9fd44c3751c08 to your computer and use it in GitHub Desktop.
Save joenas/be7e1ca587301b8910c9fd44c3751c08 to your computer and use it in GitHub Desktop.
Matrix docker-compose with Postgres and docker network
### To use this file you need to run
### $ docker network create matrix-network
version: "2"
services:
postgres:
image: postgres:9.6.4
restart: always
# I like to be able to use psql on the host to connect to the database
# for maintenance. If you already have a postgres running you should remove
# the 'ports' section and uncomment 'expose'
# expose:
# - 5432
# Adding 127.0.0.1 ensures the port isn't exposed ON the host
ports:
- "127.0.0.1:5432:5432"
volumes:
- /opt/matrix/pgdata:/var/lib/postgresql/data
# These will be used on homeserver.yaml later on
environment:
- POSTGRES_PASSWORD=YOUR_PASSWORD_HERE
- POSTGRES_USER=synapse
synapse:
image: silviof/docker-matrix
# Exposing 8008 (no TLS) on localhost means we can reverse proxy with nginx
# 8448 is for federation and should be exposed on host
# 3478 is for TURN (voip calls)
ports:
- "127.0.0.1:8008:8008"
- "8448:8448"
- "3478:3478"
volumes:
- /opt/matrix/synapse:/data
# Our docker network!
networks:
default:
external:
name: matrix-network
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment