-
-
Save tridungle/1c74365d24df46de21f91b958a096f2e to your computer and use it in GitHub Desktop.
Apache Airflow Docker Compose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
volumes: | |
postgres_data: | |
x-airflow-common: | |
&airflow-common | |
image: apache/airflow:2.0.1 | |
environment: | |
- AIRFLOW__CORE__EXECUTOR=LocalExecutor | |
- AIRFLOW__CORE__SQL_ALCHEMY_CONN=postgresql+psycopg2://postgres:postgres@db:5432/airflow | |
- AIRFLOW__CORE__FERNET_KEY=FB0o_zt4e3Ziq3LdUUO7F2Z95cvFFx16hU8jTeR1ASM= | |
- AIRFLOW__CORE__LOAD_EXAMPLES=False | |
- AIRFLOW__CORE__LOGGING_LEVEL=INFO | |
volumes: | |
- ./dags:/opt/airflow/dags | |
- ./airflow-data/logs:/opt/airflow/logs | |
- ./airflow-data/plugins:/opt/airflow/plugins | |
- ./airflow-data/airflow.cfg:/opt/airlfow/airflow.cfg | |
services: | |
db: | |
image: postgres:13.1 | |
environment: | |
- POSTGRES_USER=postgres | |
- POSTGRES_PASSWORD=postgres | |
- POSTGRES_DB=airflow | |
- POSTGRES_PORT=5432 | |
- PGDATA=/var/lib/postgresql/data/pgdata | |
volumes: | |
- postgres_data:/var/lib/postgresql/data/pgdata | |
ports: | |
- 5432:5432 | |
airflow-init: | |
<< : *airflow-common | |
container_name: airflow_init | |
entrypoint: /bin/bash | |
command: -c "airflow db init && airflow users create --firstname airflow --lastname airflow --email airflow --password airflow --username airflow --role Admin" | |
restart: on-failure | |
depends_on: | |
- db | |
airflow-webserver: | |
<< : *airflow-common | |
command: airflow webserver | |
ports: | |
- 8080:8080 | |
container_name: airflow_webserver | |
restart: always | |
depends_on: | |
- airflow-init | |
airflow-scheduler: | |
<< : *airflow-common | |
command: airflow scheduler | |
container_name: airflow_scheduler | |
deploy: | |
restart_policy: | |
condition: on-failure | |
delay: 8s | |
max_attempts: 3 | |
depends_on: | |
- airflow-init |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment