Skip to content

Instantly share code, notes, and snippets.

@jivanpal
Created June 16, 2021 00:20
Show Gist options
  • Save jivanpal/2fd7cd403b46faaed00671f370f2fba2 to your computer and use it in GitHub Desktop.
Save jivanpal/2fd7cd403b46faaed00671f370f2fba2 to your computer and use it in GitHub Desktop.
# Version 2 required in order to impose resource limits in Docker Compose (non-Swarm) environment
version: '2.2'
services:
synapse:
image: matrixdotorg/synapse:latest
container_name: synapse
# Since synapse does not retry to connect to the database, restart upon failure
restart: unless-stopped
environment:
- SYNAPSE_CONFIG_PATH=/data/homeserver.yaml
volumes:
- ./files:/data
depends_on:
- db
ports:
- 8008:8008
# Resource limits
#cpus: 0.5
mem_limit: 1536m
memswap_limit: 8G
db:
image: postgres:12-alpine
container_name: synapse_db
restart: unless-stopped
environment:
- POSTGRES_USER=synapse
- POSTGRES_PASSWORD=obviously not my actual password
# Ensure the database gets created correctly
# See: https://github.com/matrix-org/synapse/blob/master/docs/postgres.md#set-up-database
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
volumes:
- ./schemas:/var/lib/postgresql/data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment