synapse-product/contrib/docker/docker-compose.yml

66 lines
2.6 KiB
YAML
Raw Normal View History

2018-02-04 10:18:40 -05:00
# This compose file is compatible with Compose itself, it might need some
2018-02-04 06:55:20 -05:00
# adjustments to run properly with stack.
version: '3'
services:
synapse:
build:
context: ../..
dockerfile: docker/Dockerfile
image: docker.io/matrixdotorg/synapse:latest
# Since synapse does not retry to connect to the database, restart upon
# failure
restart: unless-stopped
2018-02-04 06:55:20 -05:00
# See the readme for a full documentation of the environment settings
environment:
- SYNAPSE_CONFIG_PATH=/data/homeserver.yaml
2018-02-04 06:55:20 -05:00
volumes:
# You may either store all the files in a local folder
2018-02-04 06:55:20 -05:00
- ./files:/data
# .. or you may split this between different storage points
# - ./files:/data
# - /path/to/ssd:/data/uploads
# - /path/to/large_hdd:/data/media
depends_on:
- db
2018-02-04 10:18:40 -05:00
# In order to expose Synapse, remove one of the following, you might for
# instance expose the TLS port directly:
2018-02-04 06:55:20 -05:00
ports:
- 8448:8448/tcp
2018-02-04 10:18:40 -05:00
# ... or use a reverse proxy, here is an example for traefik:
2018-02-04 06:55:20 -05:00
labels:
# The following lines are valid for Traefik version 1.x:
2018-02-04 06:55:20 -05:00
- traefik.enable=true
- traefik.frontend.rule=Host:my.matrix.Host
- traefik.port=8008
# Alternatively, for Traefik version 2.0:
- traefik.enable=true
- traefik.http.routers.http-synapse.entryPoints=http
- traefik.http.routers.http-synapse.rule=Host(`my.matrix.host`)
- traefik.http.middlewares.https_redirect.redirectscheme.scheme=https
- traefik.http.middlewares.https_redirect.redirectscheme.permanent=true
- traefik.http.routers.http-synapse.middlewares=https_redirect
- traefik.http.routers.https-synapse.entryPoints=https
- traefik.http.routers.https-synapse.rule=Host(`my.matrix.host`)
- traefik.http.routers.https-synapse.service=synapse
- traefik.http.routers.https-synapse.tls=true
- traefik.http.services.synapse.loadbalancer.server.port=8008
- traefik.http.routers.https-synapse.tls.certResolver=le-ssl
2018-02-04 06:55:20 -05:00
db:
image: docker.io/postgres:12-alpine
2018-02-04 06:55:20 -05:00
# Change that password, of course!
environment:
- POSTGRES_USER=synapse
2018-02-04 06:55:20 -05:00
- POSTGRES_PASSWORD=changeme
# ensure the database gets created correctly
# https://matrix-org.github.io/synapse/latest/postgres.html#set-up-database
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
2018-02-04 06:55:20 -05:00
volumes:
# You may store the database tables in a local folder..
- ./schemas:/var/lib/postgresql/data
# .. or store them on some high performance storage for better results
# - /path/to/ssd/storage:/var/lib/postgresql/data