/
composeyml.go
86 lines (79 loc) · 2.48 KB
/
composeyml.go
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
package include
import "strings"
// Composeyml is the docker-compose template
var Composeyml = strings.TrimSpace(`
version: '2'
networks:
airflow:
driver: bridge
volumes:
postgres_data:
driver: local
airflow_logs:
driver: local
services:
postgres:
image: postgres:10.1-alpine
restart: unless-stopped
networks:
- airflow
labels:
io.astronomer.docker: "true"
io.astronomer.docker.cli: "true"
ports:
- {{ .PostgresPort }}:5432
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
POSTGRES_USER: {{ .PostgresUser }}
POSTGRES_PASSWORD: {{ .PostgresPassword }}
scheduler:
image: {{ .AirflowImage }}
command: ["airflow", "scheduler"]
restart: unless-stopped
networks:
- airflow
user: {{ .AirflowUser }}
labels:
io.astronomer.docker: "true"
io.astronomer.docker.cli: "true"
io.astronomer.docker.component: "airflow-scheduler"
depends_on:
- postgres
environment:
AIRFLOW__CORE__EXECUTOR: LocalExecutor
AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql://{{ .PostgresUser }}:{{ .PostgresPassword }}@{{ .PostgresHost }}:5432
AIRFLOW__CORE__LOAD_EXAMPLES: "False"
AIRFLOW__CORE__FERNET_KEY: "d6Vefz3G9U_ynXB3cr7y_Ak35tAHkEGAVxuz_B-jzWw="
volumes:
- {{ .AirflowHome }}/dags:/usr/local/airflow/dags:ro
- {{ .AirflowHome }}/plugins:/usr/local/airflow/plugins:ro
- {{ .AirflowHome }}/include:/usr/local/airflow/include:ro
- airflow_logs:/usr/local/airflow/logs
webserver:
image: {{ .AirflowImage }}
command: ["airflow", "webserver"]
restart: unless-stopped
networks:
- airflow
user: {{ .AirflowUser }}
labels:
io.astronomer.docker: "true"
io.astronomer.docker.cli: "true"
io.astronomer.docker.component: "airflow-webserver"
depends_on:
- scheduler
- postgres
environment:
AIRFLOW__CORE__EXECUTOR: LocalExecutor
AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql://{{ .PostgresUser }}:{{ .PostgresPassword }}@{{ .PostgresHost }}:5432
AIRFLOW__CORE__LOAD_EXAMPLES: "False"
AIRFLOW__CORE__FERNET_KEY: "d6Vefz3G9U_ynXB3cr7y_Ak35tAHkEGAVxuz_B-jzWw="
ports:
- {{ .AirflowWebserverPort }}:8080
volumes:
- {{ .AirflowHome }}/dags:/usr/local/airflow/dags:ro
- {{ .AirflowHome }}/plugins:/usr/local/airflow/plugins:ro
- {{ .AirflowHome }}/include:/usr/local/airflow/include:ro
- airflow_logs:/usr/local/airflow/logs
`)