# Copyright Broadcom, Inc. All Rights Reserved.
# SPDX-License-Identifier: APACHE-2.0

services:
  postgresql:
    image: docker.io/bitnami/postgresql:latest
    volumes:
      - 'postgresql_data:/bitnami/postgresql'
    environment:
      - POSTGRESQL_DATABASE=bitnami_airflow
      - POSTGRESQL_USERNAME=bn_airflow
      - POSTGRESQL_PASSWORD=bitnami1
      - ALLOW_EMPTY_PASSWORD=yes
  redis:
    image: docker.io/bitnami/redis:latest
    volumes:
      - 'redis_data:/bitnami'
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
  airflow-scheduler:
    image: docker.io/bitnami/airflow:3
    environment:
      - AIRFLOW_COMPONENT_TYPE=scheduler
      - AIRFLOW_DATABASE_NAME=bitnami_airflow
      - AIRFLOW_DATABASE_USERNAME=bn_airflow
      - AIRFLOW_DATABASE_PASSWORD=bitnami1
      - AIRFLOW_EXECUTOR=CeleryExecutor
      - AIRFLOW_APISERVER_HOST=airflow
    volumes:
      - airflow_scheduler_data:/bitnami
  airflow-triggerer:
    image: docker.io/bitnami/airflow:3
    environment:
      - AIRFLOW_COMPONENT_TYPE=triggerer
      - AIRFLOW_DATABASE_NAME=bitnami_airflow
      - AIRFLOW_DATABASE_USERNAME=bn_airflow
      - AIRFLOW_DATABASE_PASSWORD=bitnami1
      - AIRFLOW_EXECUTOR=CeleryExecutor
      - AIRFLOW_APISERVER_HOST=airflow
    volumes:
      - airflow_triggerer_data:/bitnami
  airflow-dag-processor:
    image: docker.io/bitnami/airflow:3
    environment:
      - AIRFLOW_COMPONENT_TYPE=dag-processor
      - AIRFLOW_DATABASE_NAME=bitnami_airflow
      - AIRFLOW_DATABASE_USERNAME=bn_airflow
      - AIRFLOW_DATABASE_PASSWORD=bitnami1
      - AIRFLOW_EXECUTOR=CeleryExecutor
      - AIRFLOW_APISERVER_HOST=airflow
    volumes:
      - airflow_dag_processor_data:/bitnami
  airflow-worker:
    image: docker.io/bitnami/airflow:3
    environment:
      - AIRFLOW_COMPONENT_TYPE=worker
      - AIRFLOW_DATABASE_NAME=bitnami_airflow
      - AIRFLOW_DATABASE_USERNAME=bn_airflow
      - AIRFLOW_DATABASE_PASSWORD=bitnami1
      - AIRFLOW_EXECUTOR=CeleryExecutor
      - AIRFLOW_APISERVER_HOST=airflow
    volumes:
      - airflow_worker_data:/bitnami
  airflow:
    image: docker.io/bitnami/airflow:3
    environment:
      - AIRFLOW_LDAP_ENABLE=yes
      - AIRFLOW_LDAP_URI=ldap://openldap:1389
      - AIRFLOW_LDAP_SEARCH=dc=example,dc=org
      - AIRFLOW_LDAP_BIND_USER=cn=admin,dc=example,dc=org
      - AIRFLOW_LDAP_BIND_PASSWORD=adminpassword
      - AIRFLOW_LDAP_UID_FIELD=uid
      - AIRFLOW_LDAP_USE_TLS=False
      - AIRFLOW_LDAP_ROLES_MAPPING="{ 'cn=All,ou=Groups,dc=example,dc=org':['User'], 'cn=Admins,ou=Groups,dc=example,dc=org':['Admin'], }"
      - AIRFLOW_LDAP_USER_REGISTRATION_ROLE=Public
      - AIRFLOW_USER_REGISTRATION_ROLE=Public
      - AIRFLOW_DATABASE_NAME=bitnami_airflow
      - AIRFLOW_DATABASE_USERNAME=bn_airflow
      - AIRFLOW_DATABASE_PASSWORD=bitnami1
      - AIRFLOW_EXECUTOR=CeleryExecutor
      - AIRFLOW_PASSWORD=bitnami123
      - AIRFLOW_USERNAME=customuser
      - AIRFLOW_EMAIL=user@example.com
    ports:
      - '8080:8080'
    volumes:
      - airflow_data:/bitnami
  openldap:
    image: 'docker.io/bitnami/openldap:latest'
    ports:
      - '1389:1389'
    environment:
      - LDAP_ADMIN_USERNAME=admin
      - LDAP_ADMIN_PASSWORD=adminpassword
      - LDAP_USERS=customuser
      - LDAP_PASSWORDS=custompassword
    volumes:
      - 'openldap_data:/bitnami/openldap'

volumes:
  airflow_scheduler_data:
    driver: local
  airflow_triggerer_data:
    driver: local
  airflow_dag_processor_data:
    driver: local
  airflow_worker_data:
    driver: local
  airflow_data:
    driver: local
  postgresql_data:
    driver: local
  redis_data:
    driver: local
  openldap_data:
    driver: local
