-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yaml
226 lines (213 loc) · 6.42 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
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
services:
webapp:
image: wenyixu101/webapp:latest
container_name: webapp
ports:
- "5001:80"
env_file:
- ./webapp/.env.dev
pull_policy: always
deploy:
resources:
limits:
cpus: "1"
memory: 1g
server:
image: wenyixu101/server:latest
container_name: server
ports:
- "5002:5002"
environment:
- ENV=testing
pull_policy: always
deploy:
resources:
limits:
cpus: "1"
memory: 1g
notebook:
image: wenyixu101/notebook:latest
container_name: notebook
ports:
- "8888:8888"
- "4040:4040"
environment:
- JUPYTER_ENABLE_LAB=no
- ENVIRONMENT=development
- PYSPARK_SUBMIT_ARGS=--packages io.delta:delta-spark_2.12:3.0.0 --conf spark.sql.extensions=io.delta.sql.DeltaSparkSessionExtension --conf spark.sql.catalog.spark_catalog=org.apache.spark.sql.delta.catalog.DeltaCatalog pyspark-shell
# command: ["jupyter", "notebook", "--ip='0.0.0.0'", "--port=8888", "--no-browser", "--allow-root", "--NotebookApp.token=''", "--NotebookApp.password=''"]
volumes:
- ./data/spark-events:/opt/data/spark-events
- ./data/spark-warehouse:/opt/data/spark-warehouse
- ./datasets:/opt/data/datasets
- ./examples:/home/jovyan/work
pull_policy: always
deploy:
resources:
limits:
cpus: "1"
memory: 1g
spark-master:
image: wenyixu101/spark:latest
container_name: spark-master
ports:
- "8080:8080"
- "7077:7077"
environment:
- SPARK_MASTER_HOST=spark-master
- SPARK_MODE=master
- SPARK_MASTER_PORT=7077
- SPARK_MASTER_WEBUI_PORT=8080
- SPARK_HISTORY_OPTS=-Dspark.history.fs.logDirectory=/opt/data/spark-events
command: "/opt/spark/bin/spark-class org.apache.spark.deploy.master.Master"
volumes:
- ./data/spark-events:/opt/data/spark-events
- ./data/spark-warehouse:/opt/data/spark-warehouse
- ./datasets:/opt/data/datasets
pull_policy: always
deploy:
resources:
limits:
cpus: "1"
memory: 1g
spark-worker-1:
image: wenyixu101/spark:latest
container_name: spark-worker
ports:
- "8081:8081"
environment:
- SPARK_MASTER_HOST=spark-master
- SPARK_MODE=worker
- SPARK_WORKER_PORT=8081
- SPARK_WORKER_WEBUI_PORT=8081
- SPARK_HISTORY_OPTS=-Dspark.history.fs.logDirectory=/opt/data/spark-events
command: "/opt/spark/bin/spark-class org.apache.spark.deploy.worker.Worker spark://spark-master:7077"
volumes:
- ./data/spark-events:/opt/data/spark-events
- ./data/spark-warehouse:/opt/data/spark-warehouse
- ./datasets:/opt/data/datasets
pull_policy: always
deploy:
resources:
limits:
cpus: "1"
memory: 1g
# spark-worker-2:
# image: wenyixu101/spark:latest
# container_name: spark-worker-2
# ports:
# - "8082:8082"
# environment:
# - SPARK_MASTER_HOST=spark-master
# - SPARK_MODE=worker
# - SPARK_WORKER_PORT=8082
# - SPARK_WORKER_WEBUI_PORT=8082
# - SPARK_HISTORY_OPTS=-Dspark.history.fs.logDirectory=/opt/data/spark-events
# command: "/opt/spark/bin/spark-class org.apache.spark.deploy.worker.Worker spark://spark-master:7077"
# volumes:
# - ./data/spark-events:/opt/data/spark-events
# - ./data/spark-warehouse:/opt/data/spark-warehouse
# - ./datasets:/opt/data/datasets
# pull_policy: always
# deploy:
# resources:
# limits:
# cpus: "1"
# memory: 1g
history-server:
image: wenyixu101/history-server:latest
container_name: history-server
ports:
- "18080:18080"
environment:
- SPARK_HISTORY_OPTS="-Dspark.history.fs.logDirectory=file:/opt/data/spark-events"
- SPARK_MODE=history-server
command: "/opt/spark/bin/spark-class org.apache.spark.deploy.history.HistoryServer "
volumes:
- ./data/spark-events:/opt/data/spark-events
pull_policy: always
deploy:
resources:
limits:
cpus: "1"
memory: 1g
airflow-webserver:
image: wenyixu101/airflow:latest
container_name: airflow-webserver
environment:
- AIRFLOW__CORE__EXECUTOR=LocalExecutor
- AIRFLOW__CORE__SQL_ALCHEMY_CONN=postgresql+psycopg2://airflow:airflow@postgres/airflow
- AIRFLOW__CORE__FERNET_KEY=<your_fernet_key>
ports:
- "8090:8080"
command: >
bash -c "airflow db upgrade &&
airflow users create --username admin --firstname YourFirstName --lastname YourLastName --role Admin --email [email protected] --password yourpassword &&
airflow webserver"
volumes:
- ./dags:/opt/airflow/dags
- ./examples:/opt/airflow/examples
- ./data/spark-events:/opt/data/spark-events
- ./datasets:/opt/data/datasets
- ./data/spark-warehouse:/opt/data/spark-warehouse
pull_policy: always
depends_on:
- airflow-scheduler
deploy:
resources:
limits:
cpus: "1"
memory: 1g
airflow-scheduler:
image: wenyixu101/airflow:latest
container_name: airflow-scheduler
environment:
- AIRFLOW__CORE__EXECUTOR=LocalExecutor
- AIRFLOW__CORE__SQL_ALCHEMY_CONN=postgresql+psycopg2://airflow:airflow@postgres/airflow
- AIRFLOW__CORE__FERNET_KEY=<your_fernet_key>
command: scheduler
volumes:
- ./dags:/opt/airflow/dags
- ./examples:/opt/airflow/examples
- ./data/spark-events:/opt/data/spark-events
- ./datasets:/opt/data/datasets
- ./data/spark-warehouse:/opt/data/spark-warehouse
pull_policy: always
depends_on:
- postgres
deploy:
resources:
limits:
cpus: "1"
memory: 1g
postgres:
image: postgres:13
container_name: postgres
environment:
- POSTGRES_USER=airflow
- POSTGRES_PASSWORD=airflow
- POSTGRES_DB=airflow
ports:
- "5432:5432"
volumes:
# - ./data/postgres:/var/lib/postgresql/data
- ./docker/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql
pull_policy: always
deploy:
resources:
limits:
cpus: "1"
memory: 1g
# For reverse proxy
nginx:
build:
context: ./docker/nginx
dockerfile: Dockerfile
container_name: nginx
ports:
- "18081:80"
deploy:
resources:
limits:
cpus: "1"
memory: 1g