-
Notifications
You must be signed in to change notification settings - Fork 24
/
docker-compose.yml
156 lines (146 loc) · 4.58 KB
/
docker-compose.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
154
155
156
version: '3'
x-airflow-common:
&airflow-common
image: apache/airflow:2.1.0
environment:
- LOAD_EX=n
- POSTGRES_USER=airflow
- POSTGRES_PASSWORD=airflow
- POSTGRES_DB=airflow
- REDIS_HOST=redis
- REDIS_PASSWORD=redis
- AIRFLOW__SCHEDULER__STATSD_ON=True
- AIRFLOW__SCHEDULER__STATSD_HOST=statsd-exporter
- AIRFLOW__SCHEDULER__STATSD_PORT=8125
- AIRFLOW__SCHEDULER__STATSD_PREFIX=airflow
- AIRFLOW__CORE__SQL_ALCHEMY_CONN=postgresql://airflow:airflow@postgres/airflow
- AIRFLOW__CELERY__BROKER_URL=redis://:redis@redis:6379/1
- AIRFLOW__CELERY__RESULT_BACKEND=db+postgresql://airflow:airflow@postgres/airflow
- AIRFLOW__CORE__FERNET_KEY=pMrhjIcqUNHMYRk_ZOBmMptWR6o1DahCXCKn5lEMpzM=
- AIRFLOW__CORE__EXECUTOR=CeleryExecutor
- AIRFLOW_HOME=/opt/airflow
- AIRFLOW_CONFIG=/opt/airflow/airflow.cfg
- AIRFLOW__CORE__LOAD_EXAMPLES=False
- AIRFLOW__CORE__LOAD_DEFAULT_CONNECTIONS=False
- AIRFLOW__WEBSERVER__WORKERS=2
- AIRFLOW__WEBSERVER__WORKER_REFRESH_INTERVAL=1800
volumes:
- ./dags:/opt/airflow/dags/
- ./airflow.cfg:/opt/airflow/airflow.cfg
- ./airflow-data/logs:/opt/airflow/logs
- ./airflow-data/plugins:/opt/airflow/plugins
services:
airflow-init:
<< : *airflow-common
container_name: airflow-init
entrypoint: /bin/bash
command:
- -c
- airflow users list || ( airflow db init &&
airflow users create
--role Admin
--username admin
--password password
--email airflow@airflow.com
--firstname first
--lastname last )
restart: on-failure
redis:
container_name: airflow-redis
image: 'redis:5.0.5'
depends_on:
- statsd-exporter
command: redis-server --requirepass redis
ports:
- 6380:6379
postgres:
container_name: airflow-postgres
image: postgres:9.6
depends_on:
- statsd-exporter
environment:
- POSTGRES_USER=airflow
- POSTGRES_PASSWORD=airflow
- POSTGRES_DB=airflow
webserver:
<< : *airflow-common
container_name: airflow-webserver
restart: always
depends_on:
- postgres
- redis
- statsd-exporter
- airflow-init
ports:
- "8080:8080"
command: airflow webserver
healthcheck:
test: ["CMD-SHELL", "[ -f /opt/airflow/airflow-webserver.pid ]"]
interval: 30s
timeout: 30s
retries: 3
flower:
<< : *airflow-common
container_name: airflow-flower
restart: always
depends_on:
- redis
- statsd-exporter
- airflow-init
ports:
- "5555:5555"
command: airflow celery flower
scheduler:
<< : *airflow-common
container_name: airflow-scheduler
restart: always
depends_on:
- postgres
- webserver
- airflow-init
command: airflow scheduler
worker:
<< : *airflow-common
container_name: airflow-worker
restart: always
sysctls:
- net.ipv4.tcp_keepalive_time=200
- net.ipv4.tcp_keepalive_intvl=200
- net.ipv4.tcp_keepalive_probes=5
depends_on:
- redis
- scheduler
- airflow-init
ports:
- "8793"
command: airflow celery worker
statsd-exporter:
image: prom/statsd-exporter
container_name: airflow-statsd-exporter
command: "--statsd.listen-udp=:8125 --web.listen-address=:9102"
ports:
- 9123:9102
- 8125:8125/udp
prometheus:
image: prom/prometheus
container_name: airflow-prometheus
user: "0"
ports:
- 9090:9090
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- ./prometheus/volume:/prometheus
grafana:
image: grafana/grafana:7.1.5
container_name: airflow-grafana
environment:
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: password
GF_PATHS_PROVISIONING: /grafana/provisioning
ports:
- 3000:3000
volumes:
- ./grafana/volume/data:/grafana
- ./grafana/volume/datasources:/grafana/datasources
- ./grafana/volume/dashboards:/grafana/dashboards
- ./grafana/volume/provisioning:/grafana/provisioning