compose/synapse/docker-compose.yaml
2025-05-30 04:22:50 +08:00

87 lines
2.5 KiB
YAML

services:
homeserver:
image: ghcr.io/element-hq/synapse:v1.130.0
container_name: synapse
restart: unless-stopped
environment:
SYNAPSE_CONFIG_PATH: /data/homeserver.yaml
UID: 1000
GID: 1000
volumes:
- ${DATA_DIR:-./data}/synapse:/data
- ${DATA_DIR:-./data}/homeserver.yaml:/data/homeserver.yaml:ro
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
ports:
- 8008:8008
postgres:
image: postgres:17.5
container_name: synapse-postgres
restart: always
environment:
POSTGRES_DB: synapse
POSTGRES_USER: synapse
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-synapse}
# 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"
volumes:
- ${DATA_DIR:-./data}/postgres:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U synapse"]
interval: 10s
timeout: 5s
retries: 3
start_period: 30s
redis:
image: redis:8
container_name: synapse-redis
restart: always
command: --save 60 1 --loglevel warning
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
start_period: 20s
interval: 30s
retries: 5
timeout: 3s
volumes:
- ${DATA_DIR:-./data}/redis:/data
mas:
image: ghcr.io/element-hq/matrix-authentication-service:0.16.0
container_name: mas
restart: unless-stopped
command: ["server", "--config", "/data/mas.yaml"]
volumes:
- ${DATA_DIR:-./data}/mas.yaml:/data/mas.yaml:ro
- ${DATA_DIR:-./data}/homeserver.yaml:/data/homeserver.yaml:ro
depends_on:
mas-postgres:
condition: service_healthy
ports:
- 8080:8080
mas-postgres:
image: postgres:17.5
container_name: mas-postgres
restart: always
environment:
POSTGRES_DB: mas
POSTGRES_USER: mas
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-synapse}
# 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"
volumes:
- ${DATA_DIR:-./data}/mas-postgres:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U mas"]
interval: 10s
timeout: 5s
retries: 3
start_period: 30s