WIP: postgres db support

Part of https://git.coopcloud.tech/coop-cloud/matrix-synapse/issues/2.
This commit is contained in:
cellarspoon
2021-12-12 20:00:51 +01:00
parent 93ae4d6c8a
commit b7cce0a516
5 changed files with 2704 additions and 12 deletions

View File

@ -6,16 +6,21 @@ services:
image: "matrixdotorg/synapse:v1.48.0"
volumes:
- "data:/data"
secrets:
- db_password
environment:
- VIRTUAL_HOST=${DOMAIN}
- VIRTUAL_PORT=8008
- LETSENCRYPT_HOST=${DOMAIN}
- SYNAPSE_SERVER_NAME=${DOMAIN}
- SYNAPSE_REPORT_STATS=no
- SYNAPSE_DB_PASSWORD_FILE=/run/secrets/db_password
networks:
- proxy
entrypoint: /docker-entrypoint.sh
configs:
- source: homeserver_yaml
target: /data/homeserver.yaml
- source: entrypoint_conf
target: /docker-entrypoint.sh
mode: 0555
@ -33,8 +38,26 @@ services:
max_attempts: 3
window: 120s
db:
image: postgres:13-alpine
secrets:
- db_password
environment:
POSTGRES_DB: synapse
POSTGRES_USER: synapse
POSTGRES_PASSWORD_FILE: /run/secrets/db_password
# https://matrix-org.github.io/synapse/latest/postgres.html#set-up-database
POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --lc-collate=C --lc-ctype=C"
networks:
- internal
healthcheck:
test: ["CMD", "pg_isready", "-U", "synapse"]
volumes:
- postgres:/var/lib/postgresql/data
volumes:
data:
postgres:
networks:
proxy:
@ -46,3 +69,12 @@ configs:
name: ${STACK_NAME}_entrypoint_${ENTRYPOINT_CONF_VERSION}
file: entrypoint.sh.tmpl
template_driver: golang
homeserver_yaml:
name: ${STACK_NAME}_homserver_yaml_${HOMESERVER_YAML_VERSION}
file: homeserver.yaml.tmpl
template_driver: golang
secrets:
db_password:
external: true
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}