# Base docker composition. For development, this composition is augmented in docker-compose.override.yml.

services:
  www:
    image: ictu/quality-time_proxy:${QUALITY_TIME_VERSION}
    ports:
      - "${PROXY_PORT:-80}:80"
    environment:
      - FRONTEND_HOST=${FRONTEND_HOST:-frontend}
      - FRONTEND_PORT=${FRONTEND_PORT:-5000}
      - API_SERVER_HOST=${API_SERVER_HOST:-api_server}
      - API_SERVER_PORT=${API_SERVER_PORT:-5001}
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
    depends_on:
      - api_server
      - frontend
  frontend:
    image: ictu/quality-time_frontend:${QUALITY_TIME_VERSION}
    environment:
      - FRONTEND_PORT=${FRONTEND_PORT:-5000}
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
    depends_on:
      - api_server
    cap_drop:
      - ALL
  collector:
    image: ictu/quality-time_collector:${QUALITY_TIME_VERSION}
    environment:
      - DATABASE_URL=${DATABASE_URL:-mongodb://root:root@database:27017}
      - COLLECTOR_MEASUREMENT_FREQUENCY=${COLLECTOR_MEASUREMENT_FREQUENCY:-900}
      - COLLECTOR_MEASUREMENT_LIMIT=${COLLECTOR_MEASUREMENT_LIMIT:-30}
      - COLLECTOR_MEASUREMENT_TIMEOUT=${COLLECTOR_MEASUREMENT_TIMEOUT:-120}
      - COLLECTOR_SLEEP_DURATION=${COLLECTOR_SLEEP_DURATION:-20}
      - COLLECTOR_LOG_LEVEL=${COLLECTOR_LOG_LEVEL:-WARNING}
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
    depends_on:
      - database
    cap_drop:
      - ALL
  notifier:
    image: ictu/quality-time_notifier:${QUALITY_TIME_VERSION}
    environment:
      - DATABASE_URL=${DATABASE_URL:-mongodb://root:root@database:27017}
      - NOTIFIER_SLEEP_DURATION=${NOTIFIER_SLEEP_DURATION:-60}
      - NOTIFIER_LOG_LEVEL=${NOTIFIER_LOG_LEVEL:-WARNING}
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
    depends_on:
      - database
    cap_drop:
      - ALL
  api_server:
    image: ictu/quality-time_api_server:${QUALITY_TIME_VERSION}
    environment:
      - API_SERVER_PORT=${API_SERVER_PORT:-5001}
      - API_SERVER_LOG_LEVEL=${API_SERVER_LOG_LEVEL:-WARNING}
      - DATABASE_URL=${DATABASE_URL:-mongodb://root:root@database:27017}
      - LDAP_URL=${LDAP_URL:-ldap://ldap:389}
      - LDAP_ROOT_DN=${LDAP_ROOT_DN:-dc=example,dc=org}
      - LDAP_LOOKUP_USER_DN=${LDAP_LOOKUP_USER_DN:-cn=admin,dc=example,dc=org}
      - LDAP_LOOKUP_USER_PASSWORD=${LDAP_LOOKUP_USER_PASSWORD:-admin}
      - LDAP_SEARCH_FILTER=${LDAP_SEARCH_FILTER:-(|(uid=$$username)(cn=$$username))}
      - LOAD_EXAMPLE_REPORTS=${LOAD_EXAMPLE_REPORTS:-True}
      - FORWARD_AUTH_ENABLED=${FORWARD_AUTH_ENABLED:-False}
      - FORWARD_AUTH_HEADER=${FORWARD_AUTH_HEADER:-X-Forwarded-User}
      - RENDERER_HOST=${RENDERER_HOST:-renderer}
      - RENDERER_PORT=${RENDERER_PORT:-9000}
      - USER_SESSION_DURATION=${USER_SESSION_DURATION:-120}
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
    depends_on:
      - database
    cap_drop:
      - ALL
  database:
    image: ictu/quality-time_database:${QUALITY_TIME_VERSION}
    command: --quiet
    restart: always
    environment:
      - MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME:-root}
      - MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD:-root}
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "dbdata:/data/db"
  renderer:
    image: ictu/quality-time_renderer:${QUALITY_TIME_VERSION}
    environment:
      - PROXY_HOST=${PROXY_HOST:-www}
      - PROXY_PORT=${PROXY_PORT:-80}
      - LC_ALL=${LC_ALL:-en_GB.UTF-8}  # Set the date format in the PDF export to DD-MM-YYYY
      - TZ=${TZ:-Europe/Amsterdam}  # Make the PDF export use the correct timezone
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
volumes:
  dbdata:
