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

services:
  db:
    image: postgres:{{ services.rallly.postgres_version }}
    restart: always
    shm_size: 256mb
    volumes:
      - "./postgres:/var/lib/postgresql/data"
    environment:
      POSTGRES_PASSWORD: "{{ postgres_passwords.rallly }}"
      POSTGRES_DB: rallly_db
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 5s
      timeout: 5s
      retries: 5

  app:
    image: lukevella/rallly:{{ services.rallly.version }}
    restart: always
    networks:
      - default
      - external_services
      - postfix
    env_file: rallly.env
    environment:
      VIRTUAL_HOST: "{{ services.rallly.domain }}"
      VIRTUAL_PORT: "3000"
      LETSENCRYPT_HOST: "{{ services.rallly.domain }}"
      LETSENCRYPT_EMAIL: "{{ letsencrypt_email }}"
    depends_on:
      db:
        condition: service_healthy

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