diff --git a/.env.example b/.env.example index 37fd070..89945f0 100644 --- a/.env.example +++ b/.env.example @@ -1,8 +1,11 @@ -IMAGE_TAG=latest +# synapse +SYNAPSE_IMAGE_TAG=latest SERVER_NAME=localhost HTTP_PORT=8008 CONFIG_DIR=/data CONFIG_FILE_NAME=homeserver.yaml UID=991 GID=991 -TZ=UTC \ No newline at end of file +TZ=UTC + +POSTGRESQL_IMAGE_TAG=14 \ No newline at end of file diff --git a/.gitignore b/.gitignore index 2eea525..594f347 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.env \ No newline at end of file +.env +postgres_password.txt \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 12c28e9..6818f7b 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,9 +1,27 @@ volumes: synapse-data: + postgres: + +secrets: + postgres_password: + file: ./postgres_password.txt services: + postgres: + image: postgres:${POSTGRESQL_IMAGE_TAG} + restart: unless-stopped + volumes: + - postgres:/var/lib/postgresql/data:rw + secrets: + - postgres_password + environment: + POSTGRES_DB: synapse + POSTGRES_USER: synapse_user + POSTGRES_PASSWORD_FILE: /run/secrets/postgres_password + POSTGRES_INITDB_ARGS: --encoding=UTF8 --locale=C + synapse: - image: matrixdotorg/synapse:${IMAGE_TAG} + image: matrixdotorg/synapse:${SYNAPSE_IMAGE_TAG} restart: unless-stopped volumes: - synapse-data:${CONFIG_DIR} @@ -15,3 +33,5 @@ services: TZ: ${TZ} ports: - ${HTTP_PORT}:8008 + depends_on: + - postgres