Skip to content

Instantly share code, notes, and snippets.

@jivanpal
Created June 16, 2021 00:20
Show Gist options
  • Select an option

  • Save jivanpal/2fd7cd403b46faaed00671f370f2fba2 to your computer and use it in GitHub Desktop.

Select an option

Save jivanpal/2fd7cd403b46faaed00671f370f2fba2 to your computer and use it in GitHub Desktop.

Revisions

  1. jivanpal created this gist Jun 16, 2021.
    35 changes: 35 additions & 0 deletions synapse-docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    # 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