# vim: ft=yaml.docker-compose
version: "3.8"

services:
  postgres:
    image: postgres:{{ services.matrix.postgres_version }}
    restart: unless-stopped
    volumes:
      - "./db:/var/lib/postgresql/data"
    environment:
      POSTGRES_USER: synapse
      POSTGRES_PASSWORD: "{{ postgres_passwords.matrix }}"

  synapse:
    image: matrixdotorg/synapse:{{ services.matrix.version }}
    restart: unless-stopped
    networks:
      - default
      - external_services
      - postfix
    volumes:
      - "./data:/data"
    environment:
      SYNAPSE_CONFIG_PATH: /data/homeserver.yaml
      SYNAPSE_CACHE_FACTOR: "2"
      SYNAPSE_LOG_LEVEL: INFO
      VIRTUAL_HOST: "{{ services.matrix.domain }}"
      VIRTUAL_PORT: "8008"
      LETSENCRYPT_HOST: "{{ services.matrix.domain }}"
      LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"

networks:
  external_services:
    external: true
  postfix:
    external: true