-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yaml
102 lines (95 loc) · 2.87 KB
/
docker-compose.yaml
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
---
version: '3'
x-airflow-common:
&airflow-common
build:
context: ./
dockerfile: ./docker/Dockerfile
environment:
&airflow-common-env
# uncomment to allow using user IAM for access
#AIRFLOW_CONN_GOOGLE_CLOUD_DEFAULT: 'google-cloud-platform://user:password@host/schema?extra__google_cloud_platform__scope=${GCP_AUTH_SCOPE}&extra__google_cloud_platform__project=${GCP_PROJECT_ID}'
AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql+psycopg2://airflow:airflow@postgres/airflow
AIRFLOW__CORE__DAGBAG_IMPORT_TIMEOUT: 90.0
env_file:
- ./variables/docker-env-vars
- ./variables/docker-env-secrets # added to gitignore
volumes:
- ./dags:/opt/airflow/dags
- ./logs:/opt/airflow/logs
- ./plugins:/opt/airflow/plugins
- ./variables:/opt/airflow/variables
- ./data:/opt/airflow/data
- ./helpers/keys:/private_keys
- ./tests:/opt/airflow/tests
- ./gcp_airflow_foundations:/opt/airflow/gcp_airflow_foundations # to make it easier to run unit tests from inside the container
- ~/.config/gcloud:/home/airflow/.config/gcloud # GCP auth keys
- ~/.config/gcloud:/root/.config/gcloud # GCP auth keys
user: "${AIRFLOW_UID:-50000}:${AIRFLOW_GID:-0}"
depends_on:
postgres:
condition: service_healthy
services:
postgres:
image: postgres:13
environment:
POSTGRES_USER: airflow
POSTGRES_PASSWORD: airflow
POSTGRES_DB: airflow
volumes:
- postgres-db-volume:/var/lib/postgresql/data
healthcheck:
test: ["CMD", "pg_isready", "-U", "airflow"]
interval: 5s
retries: 5
restart: always
airflow-webserver:
<<: *airflow-common
command: webserver
ports:
- 8080:8080
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost:8080/health"]
interval: 10s
timeout: 10s
retries: 5
restart: always
airflow-scheduler:
<<: *airflow-common
command: scheduler
healthcheck:
test: ["CMD-SHELL", 'airflow jobs check --job-type SchedulerJob --hostname "$${HOSTNAME}"']
interval: 10s
timeout: 10s
retries: 5
restart: always
deploy:
resources:
limits:
memory: 4000m
reservations:
memory: 1000m
airflow-ops:
<<: *airflow-common
command: version
user: "0:${AIRFLOW_GID:-0}"
deploy:
resources:
reservations:
cpus: '2'
memory: 512M
airflow-helper:
<<: *airflow-common
entrypoint: ["sh", "/opt/airflow/helpers/scripts/entrypoint.sh"]
airflow-init:
<<: *airflow-common
command: version
environment:
<<: *airflow-common-env
_AIRFLOW_DB_UPGRADE: 'true'
_AIRFLOW_WWW_USER_CREATE: 'true'
_AIRFLOW_WWW_USER_USERNAME: ${_AIRFLOW_WWW_USER_USERNAME:-airflow}
_AIRFLOW_WWW_USER_PASSWORD: ${_AIRFLOW_WWW_USER_PASSWORD:-airflow1!}
user: "0:${AIRFLOW_GID:-0}"
volumes:
postgres-db-volume: