-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
261 lines (240 loc) · 6.45 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
###### MODELS CONTAINERS #############
models0: # PORT 8020
image: tp33/django
external_links:
- mysql:db
volumes:
- ./models/:/app
ports:
- "8020:8000"
command: bash -c "pip install -r requirements.txt && python manage.py makemigrations && python manage.py migrate && python manage.py loaddata db.json && mod_wsgi-express start-server --reload-on-changes ./models/wsgi.py"
container_name: models0
models1: # PORT 8021
image: tp33/django
external_links:
- mysql:db
volumes:
- ./models/:/app
ports:
- "8021:8000"
command: bash -c "sleep 35 && pip install -r requirements.txt && python manage.py loaddata db.json && mod_wsgi-express start-server --reload-on-changes ./models/wsgi.py"
container_name: models1
# sleep to wait for models0 to spin up and migrate to db
# could use `wait-for-it` instead...
models2: # PORT 8022
image: tp33/django
external_links:
- mysql:db
volumes:
- ./models/:/app
ports:
- "8022:8000"
command: bash -c "sleep 35 && pip install -r requirements.txt && python manage.py loaddata db.json && mod_wsgi-express start-server --reload-on-changes ./models/wsgi.py"
container_name: models2
# sleep to wait for models0 to spin up and migrate to db
# could use `wait-for-it` instead...
###### EXP CONTAINERS #############
exp0: # PORT 8010
image: tp33/django
links:
- modelsbal:models-api
- kafka:kafka
- es:es
volumes:
- ./exp/:/app
ports:
- "8010:8000"
command: bash -c "pip install -r requirements.txt && mod_wsgi-express start-server --reload-on-changes ./exp/wsgi.py"
container_name: exp0
exp1: # PORT 8011
image: tp33/django
links:
- modelsbal:models-api
- kafka:kafka
- es:es
volumes:
- ./exp/:/app
ports:
- "8011:8000"
command: bash -c "pip install -r requirements.txt && mod_wsgi-express start-server --reload-on-changes ./exp/wsgi.py"
container_name: exp1
exp2: # PORT 8012
image: tp33/django
links:
- modelsbal:models-api
- kafka:kafka
- es:es
volumes:
- ./exp/:/app
ports:
- "8012:8000"
command: bash -c "pip install -r requirements.txt && mod_wsgi-express start-server --reload-on-changes ./exp/wsgi.py"
container_name: exp2
###### WEB CONTAINERS #############
web0: # PORT 8030
image: tp33/django
links:
- expbal:exp-api
- selenium
volumes:
- ./web/:/app
ports:
- "8030:8000"
command: bash -c "pip install -r requirements.txt && python manage.py collectstatic --noinput && mod_wsgi-express start-server --reload-on-changes ./web/wsgi.py"
container_name: web0
environment:
- SELENIUM_HOST=http://selenium:4444/wd/hub
- TEST_SELENIUM='yest'
web1: # PORT 8031
image: tp33/django
links:
- expbal:exp-api
- selenium
volumes:
- ./web/:/app
ports:
- "8031:8000"
command: bash -c "pip install -r requirements.txt && python manage.py collectstatic --noinput && mod_wsgi-express start-server --reload-on-changes ./web/wsgi.py"
container_name: web1
environment:
- SELENIUM_HOST=http://selenium:4444/wd/hub
- TEST_SELENIUM='yest'
web2: # PORT 8032
image: tp33/django
links:
- expbal:exp-api
- selenium
volumes:
- ./web/:/app
ports:
- "8032:8000"
command: bash -c "pip install -r requirements.txt && python manage.py collectstatic --noinput && mod_wsgi-express start-server --reload-on-changes ./web/wsgi.py"
container_name: web2
environment:
- SELENIUM_HOST=http://selenium:4444/wd/hub
- TEST_SELENIUM='yest'
############## LOAD BALANCERS ###############
# yes, docker swarm would probably make more sense here,
# in conjunction with compose's scale features.
# configuring HAProxy is a great learning experience, though :-)
loadwatcher: # logs all load balancing activity to stdout!
# ...and really anything else. not a great privacy-preserving solution.
image: tp33/django
container_name: loadwatcher
command: bash -c "tail -f /var/log/syslog"
volumes:
- /dev/log:/dev/log
- /var/log:/var/log
webbal:
build: ./load/web
links:
- web0:web0
- web1:web1
- web2:web2
ports:
- "8000:8000"
- "1936:1936" # watch stats
container_name: webbal
volumes:
- /dev/log:/dev/log
expbal:
build: ./load/exp
links:
- exp0:exp0
- exp1:exp1
- exp2:exp2
ports:
- "8001:8000"
- "1937:1937" # watch stats
container_name: expbal
volumes:
- /dev/log:/dev/log
modelsbal:
build: ./load/models
links:
- models0:models0
- models1:models1
- models2:models2
ports:
- "8002:8000"
- "1938:1938" # watch stats
container_name: modelsbal
volumes:
- /dev/log:/dev/log
###### SEARCH CONTAINERS ########
kafka:
image: spotify/kafka
container_name: kafka
environment:
ADVERTISED_HOST: kafka
ADVERTISED_PORT: 9092
hostname: kafka
es:
image: elasticsearch:2.0
container_name: es
ports:
- "9200:9200"
batch:
image: tp33/django
container_name: batch
links:
- kafka:kafka
- es:es
command: bash -c "sleep 75 && echo 'kafka queueing' && python es_index.py"
volumes:
- ./batch/:/app
# Integration/end-to-end testing
selenium:
image: selenium/standalone-chrome:2.48.2
container_name: selenium
ports:
- "5900:5900"
###### SPARK CONTAINERS ######
spark-master:
image: gettyimages/spark
command: bin/spark-class org.apache.spark.deploy.master.Master -h spark-master
container_name: spark-master
hostname: spark-master
environment:
MASTER: spark://spark-master:7077
SPARK_CONF_DIR: /conf
expose:
- 7001
- 7002
- 7003
- 7004
- 7005
- 7006
- 7077
- 6066
ports:
- 4040:4040
- 6066:6066
- 7077:7077
- 8080:8080
volumes:
- ./recs:/tmp/data
spark-worker:
image: gettyimages/spark
command: bin/spark-class org.apache.spark.deploy.worker.Worker spark://spark-master:7077
container_name: spark-worker
hostname: spark-worker
environment:
SPARK_CONF_DIR: /conf
SPARK_WORKER_CORES: 2
SPARK_WORKER_MEMORY: 512m
SPARK_WORKER_PORT: 8881
SPARK_WORKER_WEBUI_PORT: 8081
links:
- spark-master
expose:
- 7012
- 7013
- 7014
- 7015
- 7016
- 8881
ports:
- 8081:8081
volumes:
- ./recs:/tmp/data