-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.prod.yml
184 lines (166 loc) · 5.01 KB
/
docker-compose.prod.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
# not entirely sure if this builds successfully in production...? exposing ports is tricky with HAProxy
###### MODELS CONTAINERS #############
models0: # PORT 8020
image: tp33/django
external_links:
- mysql:db
volumes:
- ./models/:/app
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
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: models1
models2: # PORT 8022
image: tp33/django
external_links:
- mysql:db
volumes:
- ./models/:/app
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: models2
###### EXP CONTAINERS #############
exp0: # PORT 8010
image: tp33/django
links:
- modelsbal:models-api
- kafka:kafka
- es:es
volumes:
- ./exp/:/app
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
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
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 && python manage.py test"
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 && python manage.py test"
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 && python manage.py test"
container_name: web2
environment:
- SELENIUM_HOST=http://selenium:4444/wd/hub
- TEST_SELENIUM='yest'
############## LOAD BALANCERS ###############
loadwatcher: # logs all load balancing activity to stdout!
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:
- "1937:1937" # watch stats
container_name: expbal
volumes:
- /dev/log:/dev/log
modelsbal:
build: ./load/models
links:
- models0:models0
- models1:models1
- models2:models2
ports:
- "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
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