services:
  postgres:
    image: postgres:16
    container_name: matrix-postgres
    restart: always
    environment:
      POSTGRES_DB: synapse
      POSTGRES_USER: synapse
      POSTGRES_PASSWORD: "REDACTED"
      POSTGRES_INITDB_ARGS: "--encoding=UTF8 --locale=C"
    volumes:
      - /srv/matrix/postgres/data:/var/lib/postgresql/data

  synapse:
    image: matrixdotorg/synapse:latest
    container_name: synapse
    restart: always
    depends_on:
      - postgres
    environment:
      SYNAPSE_CONFIG_PATH: /data/homeserver.yaml
    volumes:
      - /srv/matrix/synapse/data:/data
    ports:
      - "127.0.0.1:8008:8008"
