version: "3.8"

services:
  nginx:
    image: esc-vm-scheduler-docker-local.bin.swisscom.com/esc-vm-scheduler-nginx:latest
    platform: linux/x86_64
    ports:
      - 80:80
    restart: always
    volumes:
      - static_volume:/app/staticfiles

  # nginx-ssl:
  #   image: esc-vm-scheduler-docker-local.bin.swisscom.com/esc-vm-scheduler-nginx-ssl:latest
  #   ports:
  #     - 443:443
  #   restart: always
  #   volumes:
  #     - static_volume:/app/staticfiles

  mysqldb:
    image: mysql:5.7
    platform: linux/x86_64
    expose:
      - 3306
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_DATABASE: "vm_scheduler"
    restart: always
    volumes:
      - mysqldata:/var/lib/mysql

  web:
    image: esc-vm-scheduler-docker-local.bin.swisscom.com/esc-vm-scheduler-web:latest
    platform: linux/x86_64
    expose:
      - 80
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      INITIAL_ADMIN_PASSWORD: ${INITIAL_ADMIN_PASSWORD}
      INITIAL_USER_PASSWORD: ${INITIAL_USER_PASSWORD}
      SECRET_KEY: ${SECRET_KEY}
      DEBUG: 0
      ALLOWED_HOSTS: ${ALLOWED_HOSTS:-*}
      LDAP_SERVER_URI: ${LDAP_SERVER_URI:-}
      LDAP_START_TLS: ${LDAP_START_TLS:-false}
      LDAP_BASE_DN: ${LDAP_BASE_DN:-}
      LDAP_GROUP_TYPE: ${LDAP_GROUP_TYPE:-group}
      LDAP_GROUP_DN: ${LDAP_GROUP_DN:-}
      LDAP_SUPERUSER_GROUP_DN: ${LDAP_SUPERUSER_GROUP_DN:-}
      LDAP_BIND_DN: ${LDAP_BIND_DN:-}
      LDAP_BIND_PASSWORD: ${LDAP_BIND_PASSWORD:-}
      LDAP_IGNORE_CERT: ${LDAP_IGNORE_CERT:-false}
      LDAP_CERTIFICATE_PATH: ${LDAP_CERTIFICATE_PATH:-}
      LDAP_WITH_LOCAL_AUTH: ${LDAP_WITH_LOCAL_AUTH:-false}
    restart: always
    volumes:
      - static_volume:/app/staticfiles
      - ${LDAP_CERTIFICATE_PATH:-/dev/null}:/etc/ssl/certs/escvmscheduler_ldap_cert.pem

volumes:
  static_volume:
  mysqldata:
