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

services:
  db:
    image: postgres:{{ services.passit.postgres_version }}
    restart: always
    volumes:
      - "./data:/var/lib/postgresql/data"
    environment:
      POSTGRES_USER: passit
      POSTGRES_PASSWORD: "{{ postgres_passwords.passit }}"

  app:
    image: passit/passit:{{ services.passit.version }}
    command: bin/start.sh
    restart: always
    networks:
      - default
      - postfix
      - external_services
    environment:
      DATABASE_URL: postgres://passit:{{ postgres_passwords.passit }}@db:5432/passit
      SECRET_KEY: "{{ passit_secret_key }}"
      IS_DEBUG: "False"
      EMAIL_URL: smtp://noop@{{ smtp_host }}:{{ smtp_port }}
      DEFAULT_FROM_EMAIL: noreply@{{ services.passit.domain }}
      EMAIL_CONFIRMATION_HOST: https://{{ services.passit.domain }}
      FIDO_SERVER_ID: "{{ services.passit.domain }}"
      VIRTUAL_HOST: "{{ services.passit.domain }}"
      LETSENCRYPT_HOST: "{{ services.passit.domain }}"
      LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"

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