-
Notifications
You must be signed in to change notification settings - Fork 10
/
docker-compose.yml
450 lines (424 loc) · 14.6 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
version: "3.9"
# Configure modules
x-airflow-common:
&airflow-common
image: apache/airflow:2.7.0-python3.10
environment:
&airflow-common-env
S3_ENDPOINT: http://minio:9000
S3_ACCESS_KEY: minio
S3_SECRET_KEY: minio123
S3_PATH_STYLE_ACCESS: "true"
AIRFLOW__CORE__EXECUTOR: CeleryExecutor
AIRFLOW__DATABASE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres/airflow
AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres/airflow
AIRFLOW__CELERY__RESULT_BACKEND: db+postgresql://airflow:airflow@postgres/airflow
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__CORE__LOAD_DEFAULT_CONNECTIONS: false
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
- ./dbts:/opt/airflow/dbts
- ./docker/airflow/config:/opt/airflow/config
- ./docker/airflow/plugins:/opt/airflow/plugins
- ./docker/volume/airflow/logs:/opt/airflow/logs
user: "50000"
depends_on:
&airflow-common-depends-on
redis:
condition: service_healthy
postgres:
condition: service_healthy
# Configure services
services:
####################################################################################################
# Storages
####################################################################################################
postgres:
container_name: postgres
hostname: postgres
image: postgres:11
ports:
- "5432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
volumes:
- ./docker/volume/postgres:/var/lib/postgresql/data
- ./docker/postgres/init-database.sh:/docker-entrypoint-initdb.d/init-database.sh
healthcheck:
test: [ "CMD", "pg_isready", "-U", "postgres" ]
interval: 10s
retries: 5
start_period: 5s
minio:
container_name: minio
hostname: minio
image: 'minio/minio'
ports:
- '9000:9000'
- '9001:9001'
environment:
MINIO_ROOT_USER: minio
MINIO_ROOT_PASSWORD: minio123
MINIO_DOMAIN: minio
command: server /data --console-address ":9001"
minio-job:
image: 'minio/mc'
container_name: minio-job
hostname: minio-job
entrypoint: |
/bin/bash -c "
sleep 5;
/usr/bin/mc config --quiet host add myminio http://minio:9000 minio minio123 || true;
/usr/bin/mc mb --quiet myminio/datalake || true;
"
environment:
- AWS_ACCESS_KEY_ID=minio
- AWS_SECRET_ACCESS_KEY=minio123
- AWS_REGION=us-east-1
- AWS_DEFAULT_REGION=us-east-1
- S3_ENDPOINT=http://minio:9000
- S3_PATH_STYLE_ACCESS=true
depends_on:
- minio
hive-metastore:
container_name: hive-metastore
hostname: hive-metastore
build:
dockerfile: ./docker/hive-metastore/Dockerfile
image: 1ambda/lakehouse:hive-metastore-3.1.2
ports:
- '9083:9083' # Metastore Thrift
environment:
HIVE_METASTORE_DRIVER: org.postgresql.Driver
HIVE_METASTORE_JDBC_URL: jdbc:postgresql://postgres:5432/metastore
HIVE_METASTORE_USER: hive
HIVE_METASTORE_PASSWORD: hive
HIVE_METASTORE_WAREHOUSE_DIR: s3://datalake/
S3_ENDPOINT: http://minio:9000
S3_ACCESS_KEY: minio
S3_SECRET_KEY: minio123
S3_PATH_STYLE_ACCESS: "true"
depends_on:
postgres:
condition: service_healthy
####################################################################################################
# Trino
####################################################################################################
trino:
profiles: [ "trino" ]
container_name: trino
hostname: trino
image: "trinodb/trino:425"
restart: always
ports:
- "8889:8889"
volumes:
- ./docker/trino/etc-coordinator:/etc/trino
- ./docker/trino/catalog:/etc/trino/catalog
depends_on:
- hive-metastore
trino-worker:
profiles: [ "trino-worker" ]
container_name: trino-worker
hostname: trino-worker
image: "trinodb/trino:425"
restart: always
volumes:
- ./docker/trino/etc-worker:/etc/trino
- ./docker/trino/catalog:/etc/trino/catalog
depends_on:
- trino
####################################################################################################
# Spark
####################################################################################################
spark-iceberg:
profiles: [ "spark" ]
build:
dockerfile: ./docker/spark/Dockerfile-spark3.4
image: 1ambda/lakehouse:spark-3.4
container_name: spark-iceberg
hostname: spark-iceberg
entrypoint: |
/bin/bash -c "
jupyter lab --notebook-dir=/opt/notebook --ip='*' --NotebookApp.token='' --NotebookApp.password='' --port=8888 --no-browser --allow-root
"
ports:
- "4040:4040"
- "8900:8888"
depends_on:
- minio
- hive-metastore
environment:
- AWS_ACCESS_KEY_ID=minio
- AWS_SECRET_ACCESS_KEY=minio123
- AWS_REGION=us-east-1
- AWS_DEFAULT_REGION=us-east-1
- S3_ENDPOINT=http://minio:9000
- S3_PATH_STYLE_ACCESS=true
volumes:
- ./notebook:/opt/notebook
- ./docker/jupyter/jupyter_server_config.py:/root/.jupyter/jupyter_server_config.py
- ./docker/jupyter/themes.jupyterlab-settings:/root/.jupyter/lab/user-settings/@jupyterlab/apputils-extension/themes.jupyterlab-settings
- ./docker/spark/spark-defaults-iceberg.conf:/opt/spark/conf/spark-defaults.conf
spark-hudi:
profiles: [ "spark" ]
build:
dockerfile: ./docker/spark/Dockerfile-spark3.3
image: 1ambda/lakehouse:spark-3.3
container_name: spark-hudi
hostname: spark-hudi
entrypoint: |
/bin/bash -c "
jupyter lab --notebook-dir=/opt/notebook --ip='*' --NotebookApp.token='' --NotebookApp.password='' --port=8888 --no-browser --allow-root
"
ports:
- "4041:4040"
- "8901:8888"
depends_on:
- minio
- hive-metastore
environment:
- AWS_ACCESS_KEY_ID=minio
- AWS_SECRET_ACCESS_KEY=minio123
- AWS_REGION=us-east-1
- AWS_DEFAULT_REGION=us-east-1
- S3_ENDPOINT=http://minio:9000
- S3_PATH_STYLE_ACCESS=true
- HOODIE_ENV_fs_DOT_s3a_DOT_impl=org.apache.hadoop.fs.s3a.S3AFileSystem
- HOODIE_ENV_fs_DOT_s3a_DOT_access_DOT_key=minio;
- HOODIE_ENV_fs_DOT_s3a_DOT_awsSecretAccessKey=minio;
- HOODIE_ENV_fs_DOT_s3a_DOT_endpoint=http://minio:9000;
- HOODIE_ENV_fs_DOT_s3a_DOT_path_DOT_style_DOT_access=true;
- HOODIE_ENV_fs_DOT_s3_DOT_impl=org.apache.hadoop.fs.s3a.S3AFileSystem
- HOODIE_ENV_fs_DOT_s3_DOT_access_DOT_key=minio;
- HOODIE_ENV_fs_DOT_s3_DOT_awsSecretAccessKey=minio;
- HOODIE_ENV_fs_DOT_s3_DOT_endpoint=http://minio:9000;
- HOODIE_ENV_fs_DOT_s3_DOT_path_DOT_style_DOT_access=true;
- HUDI_CONF_DIR=/opt/hudi/conf
volumes:
- ./notebook:/opt/notebook
- ./docker/jupyter/jupyter_server_config.py:/root/.jupyter/jupyter_server_config.py
- ./docker/jupyter/themes.jupyterlab-settings:/root/.jupyter/lab/user-settings/@jupyterlab/apputils-extension/themes.jupyterlab-settings
- ./docker/spark/spark-defaults-hudi.conf:/opt/spark/conf/spark-defaults.conf
- ./docker/spark/hudi-defaults.conf:/opt/hudi/conf/hudi-defaults.conf
####################################################################################################
# Flink
####################################################################################################
flink-jobmanager:
profiles: [ "flink" ]
build:
dockerfile: ./docker/flink/Dockerfile-flink1.16
image: 1ambda/lakehouse:flink-1.16
container_name: flink-jobmanager
hostname: flink-jobmanager
entrypoint: |
/bin/bash -c "
export HADOOP_CLASSPATH=`/opt/hadoop/bin/hadoop classpath`;
/docker-entrypoint.sh jobmanager;
"
working_dir: /opt/flink
ports:
- "8082:8081"
- "6123:6123"
environment:
- AWS_ACCESS_KEY_ID=minio
- AWS_SECRET_ACCESS_KEY=minio123
- AWS_REGION=us-east-1
- AWS_DEFAULT_REGION=us-east-1
- S3_ENDPOINT=http://minio:9000
- S3_PATH_STYLE_ACCESS=true
- |
FLINK_PROPERTIES=
fs.s3a.impl: org.apache.hadoop.fs.s3a.S3AFileSystem
fs.s3a.access.key: minio
fs.s3a.secret.key: minio123
fs.s3a.endpoint: http://minio:9000
fs.s3a.path.style.access: true
jobmanager.rpc.address: flink-jobmanager
state.backend: rocksdb
state.backend.incremental: true
state.checkpoints.dir: s3a://datalake/flink/cluster-common/checkpoints/
state.savepoints.dir: s3a://datalake/flink/cluster-common/savepoints/
volumes:
- ./docker/flink/hadoop-core-site.xml:/opt/hadoop/etc/hadoop/core-site.xml
- ./docker/flink/hadoop-hive-site.xml:/opt/flink/conf/hive-site.xml
- ./docker/flink/flink-sql-hudi.sh:/opt/flink-client/flink-sql-hudi
- ./docker/flink/flink-init-hudi.sql:/opt/flink-client/flink-init-hudi.sql
- ./docker/flink/flink-sql-iceberg.sh:/opt/flink-client/flink-sql-iceberg
- ./docker/flink/flink-init-iceberg.sql:/opt/flink-client/flink-init-iceberg.sql
flink-taskmanager:
profiles: [ "flink" ]
build:
dockerfile: ./docker/flink/Dockerfile-flink1.16
image: 1ambda/lakehouse:flink-1.16
container_name: flink-taskmanager
hostname: flink-taskmanager
entrypoint: |
/bin/bash -c "
export HADOOP_CLASSPATH=`/opt/hadoop//bin/hadoop classpath`;
/docker-entrypoint.sh taskmanager;
"
working_dir: /opt/flink
environment:
- AWS_ACCESS_KEY_ID=minio
- AWS_SECRET_ACCESS_KEY=minio123
- AWS_REGION=us-east-1
- AWS_DEFAULT_REGION=us-east-1
- S3_ENDPOINT=http://minio:9000
- S3_PATH_STYLE_ACCESS=true
- |
FLINK_PROPERTIES=
fs.s3a.impl: org.apache.hadoop.fs.s3a.S3AFileSystem
fs.s3a.access.key: minio
fs.s3a.secret.key: minio123
fs.s3a.endpoint: http://minio:9000
fs.s3a.path.style.access: true
jobmanager.rpc.address: flink-jobmanager
taskmanager.numberOfTaskSlots: 8
parallelism.default: 1
state.backend: rocksdb
state.backend.incremental: true
state.checkpoints.dir: s3a://datalake/flink/cluster-common/checkpoints/
state.savepoints.dir: s3a://datalake/flink/cluster-common/savepoints/
volumes:
- ./docker/flink/hadoop-core-site.xml:/opt/hadoop/etc/hadoop/core-site.xml
- ./docker/flink/hadoop-hive-site.xml:/opt/flink/conf/hive-site.xml
depends_on:
- flink-jobmanager
####################################################################################################
# Airflow
####################################################################################################
airflow-webserver:
<<: *airflow-common
profiles: [ "airflow" ]
container_name: airflow-webserver
command: webserver
ports:
- "8080: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 /sources/dags /sources/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
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
# Configure Network
networks:
default:
name: lakehouse