Skip to content

Instantly share code, notes, and snippets.

@sdg-1
Created November 21, 2024 19:02
Show Gist options
  • Save sdg-1/bc4ae0cfb2e2263c92c3efb2f0b1f624 to your computer and use it in GitHub Desktop.
Save sdg-1/bc4ae0cfb2e2263c92c3efb2f0b1f624 to your computer and use it in GitHub Desktop.
version: '3'
services:
postgres:
image: postgres:13
environment:
- POSTGRES_USER=airflow
- POSTGRES_PASSWORD=airflow
- POSTGRES_DB=airflow
airflow-init:
image: apache/airflow:2.10.3
environment:
- AIRFLOW__CORE__LOAD_EXAMPLES=False
- AIRFLOW__CORE__EXECUTOR=LocalExecutor
- AIRFLOW__CORE__SQL_ALCHEMY_CONN=postgresql+psycopg2://airflow:airflow@postgres/airflow
- AIRFLOW__CORE__FERNET_KEY=46BKJoQYlPPOofyDDAmhZ37Si56s9PJVMBlAZJABtig=
entrypoint: "bash -c 'airflow db init && airflow users create --username admin --password admin --firstname Admin --lastname Admin --role Admin --email [email protected]'"
depends_on:
- postgres
airflow-webserver:
image: apache/airflow:2.10.3
environment:
- AIRFLOW__CORE__LOAD_EXAMPLES=False
- AIRFLOW__CORE__EXECUTOR=LocalExecutor
- AIRFLOW__CORE__SQL_ALCHEMY_CONN=postgresql+psycopg2://airflow:airflow@postgres/airflow
- AIRFLOW__CORE__FERNET_KEY=46BKJoQYlPPOofyDDAmhZ37Si56s9PJVMBlAZJABtig=
ports:
- "8080:8080"
command: "airflow webserver"
depends_on:
- airflow-init
volumes:
- /Users/rogoben/Downloads/basic-airflow/dags:/opt/airflow/dags
- /Users/rogoben/Downloads/basic-airflow/logs:/opt/airflow/logs
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 10s
timeout: 5s
retries: 5
airflow-scheduler:
image: apache/airflow:2.10.3
environment:
- AIRFLOW__CORE__SQL_ALCHEMY_CONN=postgresql+psycopg2://airflow:airflow@postgres/airflow
command: "airflow scheduler"
depends_on:
airflow-webserver:
condition: service_healthy
volumes:
- /Users/rogoben/Downloads/basic-airflow/dags:/opt/airflow/dags
- /Users/rogoben/Downloads/basic-airflow/logs:/opt/airflow/logs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment