services: synapse: image: ghcr.io/element-hq/synapse:v1.128.0 restart: unless-stopped environment: - SYNAPSE_CONFIG_PATH=/data/homeserver.yaml volumes: - ${DATA_DIR:-./data}/data:/data depends_on: db: condition: service_healthy ports: - 8448:8448 db: image: postgres:17.5-bookworm environment: POSTGRES_DB: ${POSTGRES_DB:-synapse} POSTGRES_USER: ${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}/db:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-synapse}"] interval: 10s timeout: 5s retries: 3 start_period: 30s