-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
483 lines (458 loc) · 13.3 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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
version: "3.9"
# Configure modules
x-airflow-common:
&airflow-common
image: apache/airflow:2.7.0-python3.10
environment:
&airflow-common-env
AIRFLOW__CORE__EXECUTOR: CeleryExecutor
AIRFLOW__DATABASE__SQL_ALCHEMY_CONN: mysql://airflow:airflow@mysql/airflow_db
AIRFLOW__CORE__SQL_ALCHEMY_CONN: mysql://airflow:airflow@mysql/airflow_db
AIRFLOW__CELERY__RESULT_BACKEND: db+mysql://airflow:airflow@mysql/airflow_db
AIRFLOW__CELERY__BROKER_URL: redis://:@redis:6379/0
AIRFLOW__CORE__FERNET_KEY: ''
AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: 'true'
AIRFLOW__CORE__LOAD_EXAMPLES: 'false'
AIRFLOW__API__AUTH_BACKENDS: 'airflow.api.auth.backend.basic_auth,airflow.api.auth.backend.session'
AIRFLOW__SCHEDULER__ENABLE_HEALTH_CHECK: 'true'
AIRFLOW__WEBSERVER__DEFAULT_UI_TIMEZONE: Asia/Seoul
AIRFLOW__CORE__DEFAULT_TIMEZONE: Asia/Seoul
AIRFLOW_UID: '50000'
_AIRFLOW_WWW_USER_USERNAME: airflow
_AIRFLOW_WWW_USER_PASSWORD: airflow
_PIP_ADDITIONAL_REQUIREMENTS: apache-airflow==2.7.0 dbt-core dbt-trino trino airflow-dbt
volumes:
- ./dags:/opt/airflow/dags
- ./dbt-trino:/opt/airflow/dbts
- ./docker/airflow/config:/opt/airflow/config
- ./docker/airflow/plugins:/opt/airflow/plugins
- ./mnt/airflow/logs:/opt/airflow/logs
user: "50000"
depends_on:
&airflow-common-depends-on
redis:
condition: service_healthy
mysql:
condition: service_healthy
services:
#####################################################
# CAdvisor
#####################################################
cadvisor:
profiles: ["cadvisor"]
image: gcr.io/cadvisor/cadvisor:latest
container_name: cadvisor
ports:
- 18080:18080
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
depends_on:
- redis
#####################################################
# Apache Hadoop
#####################################################
custom-base-hadoop:
profiles: [ "hive" ]
build:
context: .
dockerfile: ./base-images/hadoop/Dockerfile
image: keyhong/custom-base-hadoop:v1.0.0
container_name: hadoop-image-build
entrypoint: /bin/bash
command: ["-c", "exec", "/entrypoint", "hadoop", "version"]
namenode:
profiles: [ "hive" ]
depends_on:
custom-base-hadoop:
condition: service_completed_successfully
build:
context: .
dockerfile: ./docker/hadoop/namenode/Dockerfile
image: keyhong/namenode:v1.0.0
container_name: namenode
expose:
- "9864" # HDFS Namenode default PRC
ports:
- "9870:9870" # HDFS Namenode Web Http
volumes:
- ./mnt/hadoop/namenode:/data/hadoop/dfs/name
environment:
CLUSTER_NAME: hadoop_cluster
healthcheck:
test: [ "CMD", "nc", "-z", "namenode", "9870" ]
timeout: 45s
interval: 10s
retries: 10
restart: unless-stopped
datanode:
profiles: [ "hive" ]
depends_on:
namenode:
condition: service_healthy
build:
context: .
dockerfile: ./docker/hadoop/datanode/Dockerfile
image: keyhong/datanode:v1.0.0
container_name: datanode
expose:
- "9867" # HDFS Datanode IPC
ports:
- "9864:9864" # HDFS Datanode Web Http
volumes:
- ./mnt/hadoop/datanode:/data/hadoop/dfs/data
environment:
SERVICE_PRECONDITION: "namenode:9870"
healthcheck:
test: [ "CMD", "nc", "-z", "datanode", "9864" ]
timeout: 45s
interval: 10s
retries: 10
restart: unless-stopped
#####################################################
# MySQL
#####################################################
mysql:
image: mysql:8.0.36-bullseye
platform: linux/amd64
container_name: mysql
env_file:
- ./.envs/.local/.mysql
environment:
TZ: Asia/Seoul
ports:
- 3306:3306
volumes:
- ./mnt/mysql:/var/lib/mysql
- ./init-sql/mysql:/docker-entrypoint-initdb.d
healthcheck:
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost", "-proot" ]
timeout: 45s
interval: 10s
retries: 10
command:
- --character-set-server=utf8
- --collation-server=utf8_unicode_ci
restart: unless-stopped
#####################################################
# Apache Hive
#####################################################
custom-base-hive:
profiles: [ "hive" ]
build:
context: .
dockerfile: ./base-images/hive/Dockerfile
image: keyhong/custom-base-hive:v1.0.0
container_name: hive-image-build
depends_on:
custom-base-hadoop:
condition: service_completed_successfully
entrypoint: /bin/bash
command: ["-c", "exec", "/entrypoint", "hive", "version"]
hive-metastore:
profiles: [ "hive" ]
build:
context: .
dockerfile: ./docker/hive/metastore/Dockerfile
image: keyhong/hive-metastore:v1.0.0
container_name: hive-metastore
depends_on:
&hive-common-depends-on
custom-base-hive:
condition: service_completed_successfully
namenode:
condition: service_healthy
datanode:
condition: service_healthy
mysql:
condition: service_healthy
environment:
SERVICE_PRECONDITION: "namenode:9870 datanode:9864 mysql:3306"
volumes:
- ./mnt/schematool-check:/schematool-check
ports:
- "9083:9083" # Hive Metastore Server
healthcheck:
test: [ "CMD", "nc", "-z", "hive-metastore", "9083" ]
timeout: 45s
interval: 10s
restart: unless-stopped
hiveserver2:
profiles: [ "hive" ]
build:
context: .
dockerfile: ./docker/hive/hiveserver2/Dockerfile
image: keyhong/hiveserver2:v1.0.0
container_name: hiveserver2
depends_on:
<<: *hive-common-depends-on
hive-metastore:
condition: service_healthy
environment:
SERVICE_PRECONDITION: "hive-metastore:9083"
ports:
- "10000:10000" # HiveServer2 Client
- "10002:10002" # HiveServer2 Web UI
healthcheck:
test: [ "CMD", "nc", "-z", "hiveserver2", "10002" ]
timeout: 45s
interval: 10s
retries: 10
restart: unless-stopped
hive-webhcat:
profiles: [ "hive-webhcat" ]
build:
context: .
dockerfile: ./docker/hive/webhcat/Dockerfile
image: keyhong/hive-webhcat:v1.0.0
container_name: hive-webhcat
expose:
- "50111"
depends_on:
<<: *hive-common-depends-on
hiveserver2:
condition: service_healthy
environment:
- SERVICE_PRECONDITION=hiveserver2:10000
healthcheck:
test: [ "CMD", "nc", "-z", "hive-webhcat", "50111" ]
timeout: 45s
interval: 10s
retries: 10
restart: unless-stopped
#####################################################
# Hue
#####################################################
hue:
profiles: [ "hue" ]
build: ./docker/hue
container_name: hue
depends_on:
- hiveserver2
- mysql
ports:
- "8888:8888"
volumes:
- ./mnt/hue/hue.ini:/usr/share/hue/desktop/conf/z-hue.ini
environment:
- SERVICE_PRECONDITION=hiveserver2:10000 mysql:3306
healthcheck:
test: [ "CMD", "nc", "-z", "hue", "8888" ]
timeout: 45s
interval: 10s
retries: 10
restart: unless-stopped
#####################################################
# Apache Kudu
#####################################################
kudu-master:
profiles: ["kudu"]
image: apache/kudu:${KUDU_QUICKSTART_VERSION:-latest}
container_name: kudu-master
ports:
- "7051:7051"
- "8051:8051"
command: [ "master" ]
volumes:
- kudu-master-v:/var/lib/kudu
environment:
- KUDU_MASTERS=kudu-master:7051
- >
MASTER_ARGS=--fs_wal_dir=/var/lib/kudu/master
--rpc_bind_addresses=0.0.0.0:7051
--rpc_advertised_addresses=host.docker.internal:7051
--webserver_advertised_addresses=host.docker.internal:8051
--webserver_doc_root=/opt/kudu/www
--stderrthreshold=0
--use_hybrid_clock=false
--unlock_unsafe_flags=true
--default_num_replicas=1
kudu-tserver:
profiles: [ "kudu" ]
image: apache/kudu:${KUDU_QUICKSTART_VERSION:-latest}
container_name: kudu-tserver
depends_on:
- kudu-master
ports:
- "7050:7050"
- "8050:8050"
command: [ "tserver" ]
volumes:
- kudu-tserver-v:/var/lib/kudu
environment:
- KUDU_MASTERS=kudu-master:7051
- >
TSERVER_ARGS=--fs_wal_dir=/var/lib/kudu/tserver
--rpc_bind_addresses=0.0.0.0:7050
--rpc_advertised_addresses=host.docker.internal:7050
--webserver_advertised_addresses=localhost:8050
--webserver_doc_root=/opt/kudu/www
--stderrthreshold=0
--use_hybrid_clock=false
--unlock_unsafe_flags=true
--default_num_replicas=1
#####################################################
# Trino
#####################################################
trino:
profiles: ["trino"]
build:
context: .
dockerfile: ./docker/trino/Dockerfile
image: keyhong/trino:v1.0.0
container_name: trino
depends_on:
- hive-metastore
- kudu-tserver
environment:
SERVICE_PRECONDITION: "hive-metastore:9083 kudu-tserver:8050"
ports:
- "8080:8080"
healthcheck:
test: [ "CMD", "nc", "-z", "trino", "8080" ]
timeout: 45s
interval: 10s
retries: 10
restart: unless-stopped
#####################################################
# DBT
#####################################################
dbt-workspace:
profiles: ["dbt"]
image: python:3.10.13-slim-bullseye
container_name: dbt
command: [ "sleep", "6000000" ]
volumes:
- ./dbt-trino:/dbt
#####################################################
# Airflow
#####################################################
airflow-webserver:
<<: *airflow-common
profiles: [ "airflow" ]
container_name: airflow-webserver
command: webserver
ports:
- "8888:8080"
healthcheck:
test: [ "CMD", "curl", "--fail", "http://localhost:8080/health" ]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
restart: always
depends_on:
<<: *airflow-common-depends-on
airflow-init:
condition: service_completed_successfully
airflow-scheduler:
<<: *airflow-common
profiles: [ "airflow" ]
container_name: airflow-scheduler
command: scheduler
healthcheck:
test: [ "CMD", "curl", "--fail", "http://localhost:8974/health" ]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
restart: always
depends_on:
<<: *airflow-common-depends-on
airflow-init:
condition: service_completed_successfully
airflow-worker:
<<: *airflow-common
profiles: [ "airflow" ]
container_name: airflow-worker
command: celery worker
healthcheck:
test:
- "CMD-SHELL"
- 'celery --app airflow.providers.celery.executors.celery_executor.app inspect ping -d "celery@$${HOSTNAME}" || celery --app airflow.executors.celery_executor.app inspect ping -d "celery@$${HOSTNAME}"'
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
environment:
<<: *airflow-common-env
DUMB_INIT_SETSID: "0"
restart: always
depends_on:
<<: *airflow-common-depends-on
airflow-init:
condition: service_completed_successfully
# airflow-triggerer:
# <<: *airflow-common
# profiles: [ "airflow" ]
# container_name: airflow-triggerer
# command: triggerer
# healthcheck:
# test: [ "CMD-SHELL", 'airflow jobs check --job-type TriggererJob --hostname "$${HOSTNAME}"' ]
# interval: 30s
# timeout: 10s
# retries: 5
# start_period: 30s
# restart: always
# depends_on:
# <<: *airflow-common-depends-on
# airflow-init:
# condition: service_completed_successfully
airflow-cli:
<<: *airflow-common
container_name: airflow-cli
profiles: [ "airflow-debug" ]
environment:
<<: *airflow-common-env
CONNECTION_CHECK_MAX_COUNT: "0"
# Workaround for entrypoint issue. See: https://github.com/apache/airflow/issues/16252
command:
- bash
- -c
- airflow
airflow-init:
<<: *airflow-common
profiles: [ "airflow" ]
container_name: airflow-init
entrypoint: /bin/bash
# yamllint disable rule:line-length
command:
- -c
- |
mkdir -p /sources/{logs,dags,plugins}
chown -R "50000:0" /sources/{logs,dags,plugins}
exec /entrypoint airflow version
# yamllint enable rule:line-lengthㅡ
environment:
<<: *airflow-common-env
_AIRFLOW_DB_MIGRATE: 'true'
_AIRFLOW_WWW_USER_CREATE: 'true'
_PIP_ADDITIONAL_REQUIREMENTS: ''
user: "0:0"
volumes:
- ${AIRFLOW_PROJ_DIR:-.}:/sources/dags
redis:
profiles: [ "airflow" ]
container_name: redis
hostname: redis
image: redis:latest
expose:
- 6379
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 10s
timeout: 30s
retries: 50
start_period: 30s
restart: always
######################################################
# NETWORK
######################################################
networks:
default:
name: hadoop-cluster
volumes:
kudu-master-v:
kudu-tserver-v: