Skip to content

Instantly share code, notes, and snippets.

@airscholar
Created October 8, 2023 22:06
Show Gist options
  • Save airscholar/c181e5f82ab344ee30fc1a62f9b231f4 to your computer and use it in GitHub Desktop.
Save airscholar/c181e5f82ab344ee30fc1a62f9b231f4 to your computer and use it in GitHub Desktop.
version: '3'
services:
webserver:
image: apache/airflow:2.6.0-python3.9
command: webserver
entrypoint: [ "/opt/airflow/script/entrypoint.sh" ]
# restart: always
depends_on:
- postgres
environment:
- AIRFLOW__CORE__LOAD_EXAMPLES=False
- AIRFLOW__CORE__EXECUTOR=SequentialExecutor
- AIRFLOW__DATABASE__SQL_ALCHEMY_CONN=postgresql+psycopg2://airflow:airflow@postgres:5432/airflow
- AIRFLOW__WEBSERVER_BASE_URL=http://localhost:8080
- AIRFLOW__WEBSERVER__SECRET_KEY=46BKJoQYlPPOexq0OhDZnIlNepKFf87WFwLbfzqDDho=
logging:
options:
max-size: 10m
max-file: "3"
volumes:
- ./dags:/opt/airflow/dags
- ./script/entrypoint.sh:/opt/airflow/script/entrypoint.sh
- ./requirements.txt:/opt/airflow/requirements.txt
- ./data:/opt/airflow/data
- ./pipelines:/opt/airflow/pipelines
# - ./airflow.cfg:/opt/airflow/airflow.cfg
# - ./airflow.db:/opt/airflow/airflow.db
ports:
- "8080:8080"
healthcheck:
test: [ "CMD", "curl", "--fail", "http://localhost:8080/health" ]
interval: 30s
timeout: 10s
retries: 3
networks:
- confluent
postgres:
image: postgres:14.0
environment:
- POSTGRES_USER=airflow
- POSTGRES_PASSWORD=airflow
- POSTGRES_DB=airflow
logging:
options:
max-size: 10m
max-file: "3"
networks:
- confluent
scheduler:
image: apache/airflow:2.6.0-python3.9
# restart: always
depends_on:
webserver:
condition: service_healthy
volumes:
- ./dags:/opt/airflow/dags
- ./requirements.txt:/opt/airflow/requirements.txt
- ./data:/opt/airflow/data
- ./pipelines:/opt/airflow/pipelines
environment:
- LOAD_EX=n
- EXECUTOR=Sequential
- AIRFLOW__DATABASE__SQL_ALCHEMY_CONN=postgresql+psycopg2://airflow:airflow@postgres:5432/airflow
- AIRFLOW__WEBSERVER_BASE_URL=http://localhost:8080
- AIRFLOW__WEBSERVER__SECRET_KEY=46BKJoQYlPPOexq0OhDZnIlNepKFf87WFwLbfzqDDho=
command: bash -c "pip install --no-cache-dir -r ./requirements.txt && airflow db upgrade && airflow scheduler"
networks:
- confluent
networks:
confluent:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment