You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/12/10 09:14:27 UTC

[GitHub] [airflow] mik-laj commented on issue #8605: Add Production-ready docker compose for the production image

mik-laj commented on issue #8605:
URL: https://github.com/apache/airflow/issues/8605#issuecomment-742389282


   My docker compose:
   ```yaml
   version: '3'
   x-airflow-common:
     &airflow-common
     image: apache/airflow:1.10.12
     environment:
       - AIRFLOW__CORE__EXECUTOR=CeleryExecutor
       - AIRFLOW__CORE__SQL_ALCHEMY_CONN=mysql://root@mysql/airflow?charset=utf8mb4
       - AIRFLOW__CORE__SQL_ENGINE_COLLATION_FOR_IDS=utf8mb3_general_ci
       - AIRFLOW__CELERY__BROKER_URL=redis://:@redis:6379/0
       - AIRFLOW__CELERY__RESULT_BACKEND=redis://:@redis:6379/0
       - AIRFLOW__CORE__FERNET_KEY=FB0o_zt4e3Ziq3LdUUO7F2Z95cvFFx16hU8jTeR1ASM=
       - AIRFLOW__CORE__LOAD_EXAMPLES=False
       - AIRFLOW__CORE__LOGGING_LEVEL=Debug
       - AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION=False
       - AIRFLOW__WEBSERVER__RBAC=True
       - AIRFLOW__CORE__STORE_SERIALIZED_DAGS=True
       - AIRFLOW__CORE__STORE_DAG_CODE=True
     volumes:
       - ./dags:/opt/airflow/dags
       - ./airflow-data/logs:/opt/airflow/logs
       - ./airflow-data/plugins:/opt/airflow/plugins
       - ./dagrun_id_dep.py:/home/airflow/.local/lib/python3.6/site-packages/airflow/ti_deps/deps/dagrun_id_dep.py
     depends_on:
       - redis
       - mysql
   
   services:
     mysql:
       image: mysql:5.7
       environment:
         - MYSQL_ALLOW_EMPTY_PASSWORD=true
         - MYSQL_ROOT_HOST=%
         - MYSQL_DATABASE=airflow
       volumes:
         - ./mysql/conf.d:/etc/mysql/conf.d:ro
         - /dev/urandom:/dev/random   # Required to get non-blocking entropy source
         - ./airflow-data/mysql-db-volume:/var/lib/mysql
       ports:
         - "3306:3306"
       command:
         - mysqld
         - --character-set-server=utf8mb4
         - --collation-server=utf8mb4_unicode_ci
   
     redis:
       image: redis:latest
       ports:
         - 6379:6379
   
     flower:
       << : *airflow-common
       command: flower
       ports:
         - 5555:5555
   
     airflow-init:
       << : *airflow-common
       container_name: airflow_init
       entrypoint: /bin/bash
       command:
         - -c
         - airflow list_users || (
             airflow initdb &&
             airflow create_user
               --role Admin
               --username airflow
               --password airflow
               --email airflow@airflow.com
               --firstname airflow
               --lastname airflow
           )
       restart: on-failure
   
     airflow-webserver:
       << : *airflow-common
       command: webserver
       ports:
         - 8080:8080
       restart: always
   
     airflow-scheduler:
       << : *airflow-common
       container_name: airflow_scheduler
       command:
         - scheduler
         - --run-duration
         - '30'
       restart: always
   
     airflow-worker:
       << : *airflow-common
       container_name: airflow_worker1
       command: worker
       restart: always
   
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org