2018-02-04 15:18:40 +00:00
|
|
|
# This compose file is compatible with Compose itself, it might need some
|
2018-02-04 11:55:20 +00:00
|
|
|
# adjustments to run properly with stack.
|
|
|
|
|
|
|
|
version: '3'
|
|
|
|
|
|
|
|
services:
|
|
|
|
|
|
|
|
synapse:
|
2018-08-31 12:40:17 +00:00
|
|
|
build:
|
2023-12-13 16:15:22 +00:00
|
|
|
context: ../..
|
|
|
|
dockerfile: docker/Dockerfile
|
2018-02-10 20:59:58 +00:00
|
|
|
image: docker.io/matrixdotorg/synapse:latest
|
2018-08-31 12:40:17 +00:00
|
|
|
# Since synapse does not retry to connect to the database, restart upon
|
2018-02-04 14:04:26 +00:00
|
|
|
# failure
|
|
|
|
restart: unless-stopped
|
2018-02-04 11:55:20 +00:00
|
|
|
# See the readme for a full documentation of the environment settings
|
2022-01-05 10:50:28 +00:00
|
|
|
# NOTE: You must edit homeserver.yaml to use postgres, it defaults to sqlite
|
2018-02-04 11:55:20 +00:00
|
|
|
environment:
|
2020-02-29 23:32:26 +00:00
|
|
|
- SYNAPSE_CONFIG_PATH=/data/homeserver.yaml
|
2018-02-04 11:55:20 +00:00
|
|
|
volumes:
|
2018-02-08 18:46:11 +00:00
|
|
|
# You may either store all the files in a local folder
|
2018-02-04 11:55:20 +00:00
|
|
|
- ./files:/data
|
2018-02-08 18:46:11 +00:00
|
|
|
# .. or you may split this between different storage points
|
|
|
|
# - ./files:/data
|
|
|
|
# - /path/to/ssd:/data/uploads
|
|
|
|
# - /path/to/large_hdd:/data/media
|
2018-02-04 14:04:26 +00:00
|
|
|
depends_on:
|
|
|
|
- db
|
2018-02-04 15:18:40 +00:00
|
|
|
# In order to expose Synapse, remove one of the following, you might for
|
|
|
|
# instance expose the TLS port directly:
|
2018-02-04 11:55:20 +00:00
|
|
|
ports:
|
|
|
|
- 8448:8448/tcp
|
2018-02-04 15:18:40 +00:00
|
|
|
# ... or use a reverse proxy, here is an example for traefik:
|
2018-02-04 11:55:20 +00:00
|
|
|
labels:
|
2019-10-18 09:23:33 +00:00
|
|
|
# The following lines are valid for Traefik version 1.x:
|
2018-02-04 11:55:20 +00:00
|
|
|
- traefik.enable=true
|
|
|
|
- traefik.frontend.rule=Host:my.matrix.Host
|
2019-01-02 07:38:18 +00:00
|
|
|
- traefik.port=8008
|
2019-10-18 09:23:33 +00:00
|
|
|
# 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 11:55:20 +00:00
|
|
|
|
|
|
|
db:
|
2020-06-17 12:29:08 +00:00
|
|
|
image: docker.io/postgres:12-alpine
|
2018-02-04 11:55:20 +00:00
|
|
|
# Change that password, of course!
|
|
|
|
environment:
|
2018-02-08 19:42:57 +00:00
|
|
|
- POSTGRES_USER=synapse
|
2018-02-04 11:55:20 +00:00
|
|
|
- POSTGRES_PASSWORD=changeme
|
2020-02-14 16:27:29 +00:00
|
|
|
# ensure the database gets created correctly
|
2023-12-13 16:15:22 +00:00
|
|
|
# https://element-hq.github.io/synapse/latest/postgres.html#set-up-database
|
2020-02-25 10:48:13 +00:00
|
|
|
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
|
2018-02-04 11:55:20 +00:00
|
|
|
volumes:
|
2018-02-08 18:46:11 +00:00
|
|
|
# You may store the database tables in a local folder..
|
2018-02-04 14:04:26 +00:00
|
|
|
- ./schemas:/var/lib/postgresql/data
|
2018-02-08 18:46:11 +00:00
|
|
|
# .. or store them on some high performance storage for better results
|
2018-10-31 14:46:47 +00:00
|
|
|
# - /path/to/ssd/storage:/var/lib/postgresql/data
|