-
Notifications
You must be signed in to change notification settings - Fork 26
/
docker-compose.airflow-scaling-celery.yml
153 lines (145 loc) · 5.23 KB
/
docker-compose.airflow-scaling-celery.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
version: "3.8"
services:
######################################################
# DATASET
######################################################
dataset:
build: ./docker/dataset
image: dataength/dataset:skooldio
restart: always
container_name: dataset
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=breakfast
- PGDATA=/var/lib/postgresql/data/pgdata
######################################################
# DATABASE SERVICE
######################################################
airflow-metastore:
image: postgres:11.4-alpine
restart: always
container_name: airflow-metastore
volumes:
- ./mnt/postgres:/var/lib/postgresql/data/pgdata
environment:
- POSTGRES_USER=airflow
- POSTGRES_PASSWORD=airflow
- POSTGRES_DB=airflow_db
- PGDATA=/var/lib/postgresql/data/pgdata
healthcheck:
test: ["CMD", "pg_isready", "-q", "-d", "airflow_db", "-U", "airflow"]
timeout: 45s
interval: 10s
retries: 10
######################################################
# AIRFLOW
######################################################
airflow:
build: ./docker/airflow
image: dataength/airflow:skooldio
restart: always
container_name: airflow
depends_on:
- airflow-metastore
environment:
AIRFLOW__CORE__EXECUTOR: CeleryExecutor
AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@airflow-metastore:5432/airflow_db
AIRFLOW__CELERY__RESULT_BACKEND: db+postgresql://airflow:airflow@airflow-metastore/airflow_db
AIRFLOW__CELERY__BROKER_URL: redis://redis:6379/1
AIRFLOW__CORE__FERNET_KEY: "EMFOyePzhgJ1OOznc75nT6tWlq4Bk5Un3J8jgOyverQ="
AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: "true"
AIRFLOW__CORE__LOAD_EXAMPLES: "false"
AIRFLOW__WEBSERVER__EXPOSE_CONFIG: "true"
volumes:
- ./mnt/airflow/airflow.cfg:/usr/local/airflow/airflow.cfg
- ./mnt/airflow/dags:/usr/local/airflow/dags
ports:
- 8080:8080
healthcheck:
test: ["CMD", "nc", "-z", "airflow", "8080"]
timeout: 45s
interval: 10s
retries: 10
redis:
image: "redis:5.0.5"
container_name: redis
scheduler:
build: ./docker/airflow
image: dataength/airflow:skooldio
restart: always
container_name: airflow-scheduler
depends_on:
- airflow-metastore
environment:
AIRFLOW__CORE__EXECUTOR: CeleryExecutor
AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@airflow-metastore:5432/airflow_db
AIRFLOW__CELERY__RESULT_BACKEND: db+postgresql://airflow:airflow@airflow-metastore/airflow_db
AIRFLOW__CELERY__BROKER_URL: redis://redis:6379/1
AIRFLOW__CORE__FERNET_KEY: "EMFOyePzhgJ1OOznc75nT6tWlq4Bk5Un3J8jgOyverQ="
AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: "true"
AIRFLOW__CORE__LOAD_EXAMPLES: "false"
AIRFLOW__WEBSERVER__EXPOSE_CONFIG: "true"
volumes:
- ./mnt/airflow/airflow.cfg:/usr/local/airflow/airflow.cfg
- ./mnt/airflow/dags:/usr/local/airflow/dags
command: ["airflow", "scheduler"]
worker:
build: ./docker/airflow
image: dataength/airflow:skooldio
restart: always
depends_on:
- airflow-metastore
environment:
AIRFLOW__CORE__EXECUTOR: CeleryExecutor
AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@airflow-metastore:5432/airflow_db
AIRFLOW__CELERY__RESULT_BACKEND: db+postgresql://airflow:airflow@airflow-metastore/airflow_db
AIRFLOW__CELERY__BROKER_URL: redis://redis:6379/1
AIRFLOW__CORE__FERNET_KEY: "EMFOyePzhgJ1OOznc75nT6tWlq4Bk5Un3J8jgOyverQ="
AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: "true"
AIRFLOW__CORE__LOAD_EXAMPLES: "false"
AIRFLOW__WEBSERVER__EXPOSE_CONFIG: "true"
volumes:
- ./mnt/airflow/airflow.cfg:/usr/local/airflow/airflow.cfg
- ./mnt/airflow/dags:/usr/local/airflow/dags
command: ["airflow", "celery", "worker"]
flower:
build: ./docker/airflow
image: dataength/airflow:skooldio
restart: always
container_name: airflow-flower
depends_on:
- airflow-metastore
- redis
environment:
AIRFLOW__CORE__EXECUTOR: CeleryExecutor
AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@airflow-metastore:5432/airflow_db
AIRFLOW__CELERY__RESULT_BACKEND: db+postgresql://airflow:airflow@airflow-metastore/airflow_db
AIRFLOW__CELERY__BROKER_URL: redis://redis:6379/1
AIRFLOW__CORE__FERNET_KEY: ""
AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: "true"
AIRFLOW__CORE__LOAD_EXAMPLES: "false"
AIRFLOW__WEBSERVER__EXPOSE_CONFIG: "true"
ports:
- "5555:5555"
command: ["airflow", "celery", "flower"]
healthcheck:
test: ["CMD", "nc", "-z", "flower", "5555"]
timeout: 45s
interval: 10s
retries: 10
######################################################
# EMAIL SERVICE
######################################################
mailhog:
image: mailhog/mailhog
container_name: mailhog
ports:
- "1025:1025"
- "8025:8025"
######################################################
# NETWORK
######################################################
networks:
default:
name: airflow-network