Skip to content

Commit 0de3523

Browse files
[feat] add airflow
1 parent b7775f9 commit 0de3523

File tree

3 files changed

+77
-1
lines changed

3 files changed

+77
-1
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,5 @@ redis-data/
138138
redis.conf/
139139
pgadmin-data/
140140
data/
141-
letsencrypt/
141+
letsencrypt/
142+
airflow-data/

airflow/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
docker-compose --env-file ../.env up -d --build

airflow/docker-compose.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
version: '3.4'
2+
3+
x-common:
4+
&common
5+
image: apache/airflow:2.3.0
6+
user: "${AIRFLOW_UID:-0}:0"
7+
env_file:
8+
- ../.env
9+
volumes:
10+
- ./airflow-data/dags:/opt/airflow/dags
11+
- ./airflow-data/logs:/opt/airflow/logs
12+
- ./airflow-data/plugins:/opt/airflow/plugins
13+
- /var/run/docker.sock:/var/run/docker.sock
14+
networks:
15+
- airflow
16+
- epd
17+
18+
x-depends-on:
19+
&depends-on
20+
depends_on:
21+
airflow-init:
22+
condition: service_completed_successfully
23+
24+
services:
25+
26+
# Airflow Scheduler
27+
airflow-scheduler:
28+
<<: *common
29+
<<: *depends-on
30+
container_name: airflow-scheduler
31+
command: scheduler
32+
restart: on-failure
33+
34+
ports:
35+
- "${AIRFLOW_SCHEDULER_PORT}:8793"
36+
37+
# Airflow Webserver
38+
airflow-webserver:
39+
<<: *common
40+
<<: *depends-on
41+
container_name: airflow-webserver
42+
restart: always
43+
command: webserver
44+
45+
ports:
46+
- "${AIRFLOW_WEBSERVER_PORT:-8085}:8080"
47+
48+
healthcheck:
49+
test: ["CMD", "curl", "--fail", "http://0.0.0.0:${AIRFLOW_WEBSERVER_PORT}/health"]
50+
interval: 30s
51+
timeout: 30s
52+
retries: 3
53+
54+
# Airflow Initializer
55+
airflow-init:
56+
<<: *common
57+
container_name: airflow-init
58+
entrypoint: /bin/bash
59+
command:
60+
- -c
61+
- |
62+
mkdir -p /sources/logs /sources/dags /sources/plugins
63+
chown -R "${AIRFLOW_UID}:0" /sources/{logs,dags,plugins}
64+
exec /entrypoint airflow version
65+
66+
67+
networks:
68+
epd:
69+
name: epd
70+
external: true
71+
airflow:
72+
name: airflow
73+
internal: true

0 commit comments

Comments
 (0)