-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
397 lines (350 loc) · 10.8 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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
version: "3.8"
volumes:
rabbitmq_data:
pgdata:
kongadata:
# networks:
# kong-net:
# driver: bridge
services:
# 6 simple microservices (HTTP)
#port 5000
delivery:
build:
context: ./delivery
dockerfile: delivery.Dockerfile
image: ${docker_id}/delivery:1.0
restart: always
ports:
- "5000:5000"
environment:
dbURL: ${DBURL}/delivery
#dbURL: mysql+mysqlconnector://[email protected]:3306/delivery
#dbURL: mysql+mysqlconnector://admin:Password123@esd-database.cg2v6ek4an29.us-east-1.rds.amazonaws.com/delivery
PYTHONUNBUFFERED: 1
#port 5001
driver:
build:
context: ./driver
dockerfile: driver.Dockerfile
image: ${docker_id}/driver:1.0
restart: always
ports:
- "5001:5001"
environment:
dbURL: ${DBURL}/driver
#dbURL: mysql+mysqlconnector://[email protected]:3306/driver
#dbURL: mysql+mysqlconnector://admin:Password123@esd-database.cg2v6ek4an29.us-east-1.rds.amazonaws.com/driver
PYTHONUNBUFFERED: 1
#port 5002
customer:
build:
context: ./customer
dockerfile: customer.Dockerfile
image: ${docker_id}/customer:1.0
restart: always
ports:
- "5002:5002"
environment:
dbURL: ${DBURL}/customer
#dbURL: mysql+mysqlconnector://[email protected]:3306/customer
#dbURL: mysql+mysqlconnector://admin:Password123@esd-database.cg2v6ek4an29.us-east-1.rds.amazonaws.com/customer
PYTHONUNBUFFERED: 1
#port 4242
payment:
build:
context: ./payment
dockerfile: payment.Dockerfile
image: ${docker_id}/payment:1.0
restart: always
ports:
- "4242:4242"
environment:
PYTHONUNBUFFERED: 1
#port 5004
schedule:
build:
context: ./schedule
dockerfile: schedule.Dockerfile
image: ${docker_id}/schedule:1.0
restart: always
ports:
- "5004:5004"
environment:
dbURL: ${DBURL}/schedule
#dbURL: mysql+mysqlconnector://[email protected]:3306/schedule
#dbURL: mysql+mysqlconnector://admin:Password123@esd-database.cg2v6ek4an29.us-east-1.rds.amazonaws.com/schedule
PYTHONUNBUFFERED: 1
#port 5005
login:
build:
context: ./login
dockerfile: login.Dockerfile
image: ${docker_id}/login:1.0
restart: always
ports:
- "5005:5005"
environment:
dbURL: ${DBURL}/login
#dbURL: mysql+mysqlconnector://[email protected]:3306/login
#dbURL: mysql+mysqlconnector://admin:Password123@esd-database.cg2v6ek4an29.us-east-1.rds.amazonaws.com/login
PYTHONUNBUFFERED: 1
############ AMQP SERVICES #############
rabbitmq: #no build, context etc
image: rabbitmq:3-management
hostname: esd-rabbit
restart: always
ports:
- "5672:5672"
- "15672:15672"
volumes:
- rabbitmq_data:/var/lib/rabbitmq
#includes driver/customer notification and error microservice
customer_notification:
build:
context: ./notification
dockerfile: customer_noti.Dockerfile
image: ${docker_id}/customer_noti:1.0
restart: always
depends_on:
- rabbitmq
environment:
hostname: rabbitmq
rabbit_port: 5672
PYTHONUNBUFFERED: 1
driver_notification:
build:
context: ./notification
dockerfile: driver_noti.Dockerfile
image: ${docker_id}/driver_noti:1.0
restart: always
depends_on:
- rabbitmq
environment:
hostname: rabbitmq
rabbit_port: 5672
PYTHONUNBUFFERED: 1
error:
build:
context: ./notification
dockerfile: error.Dockerfile
image: ${docker_id}/error:1.0
restart: always
depends_on:
- rabbitmq
environment:
hostname: rabbitmq
rabbit_port: 5672
PYTHONUNBUFFERED: 1
# 5 Complex microservices
#port 5104, but done first since it is needed by 5100
schedule_driver:
build:
context: ./complex_microservices/schedule_driver
dockerfile: schedule_driver.Dockerfile
image: ${docker_id}/schedule_driver:1.0
restart: always
depends_on:
- schedule
- rabbitmq
- error
environment:
hostname: rabbitmq
rabbit_port: 5672
scheduleURL: http://schedule:5004/schedule
ports:
- "5104:5104"
#port 5100
process_order:
build:
context: ./complex_microservices/process_order
dockerfile: process_order.Dockerfile
image: ${docker_id}/process_order:1.0
restart: always
depends_on:
- delivery
- payment
- driver
- customer
- schedule
- schedule_driver
- rabbitmq
- error
- customer_notification
- driver_notification
environment:
hostname: rabbitmq
rabbit_port: 5672
paymentURL: http://payment:4242/checkout_session
deliveryURL: http://delivery:5000/delivery
driverURL: http://driver:5001/driver
customerURL: http://customer:5002/customer
scheduleURL: http://schedule:5004/schedule
ScheduleDriverURL: http://schedule_driver:5104/schedule_driver
PYTHONUNBUFFERED: 1
ports:
- "5100:5100"
#port 5101
driver_view_details:
build:
context: ./complex_microservices/driver_view_details
dockerfile: driver_view_details.Dockerfile
image: ${docker_id}/driver_view_details:1.0
restart: always
depends_on:
- delivery
- rabbitmq
- error
environment:
hostname: rabbitmq
rabbit_port: 5672
deliveryURL: http://delivery:5000/delivery
ports:
- "5101:5101"
# port 5102
customer_view_details:
build:
context: ./complex_microservices/customer_view_details
dockerfile: customer_view_details.Dockerfile
image: ${docker_id}/customer_view_details:1.0
restart: always
depends_on:
- delivery
- driver
- rabbitmq
- error
environment:
hostname: rabbitmq
rabbit_port: 5672
deliveryURL: http://delivery:5000/delivery
driverURL: http://driver:5001/driver
ports:
- "5102:5102"
#port 5103
complete_delivery:
build:
context: ./complex_microservices/complete_delivery
dockerfile: complete_delivery.Dockerfile
image: ${docker_id}/complete_delivery:1.0
restart: always
depends_on:
- delivery
- driver
- customer
- rabbitmq
- customer_notification
- driver_notification
- error
environment:
hostname: rabbitmq
rabbit_port: 5672
deliveryURL: http://delivery:5000/delivery
driverURL: http://driver:5001/driver
customerURL: http://customer:5002/customer
ports:
- "5103:5103"
#port 5105
register_user:
build:
context: ./complex_microservices/register_user
dockerfile: register_user.Dockerfile
image: ${docker_id}/register_user:1.0
restart: always
depends_on:
- login
- customer
- driver #register a driver
- schedule
- rabbitmq
- error
environment:
hostname: rabbitmq
rabbit_port: 5672
loginURL: http://login:5005 #cannot add login at the back
customerURL: http://customer:5002/customer
driverURL: http://driver:5001/driver
scheduleURL: http://schedule:5004/schedule
ports:
- "5105:5105"
#register_tele_notif (TelegramBot)
register_tele_notif:
build:
context: ./complex_microservices/register_tele_notif
dockerfile: register_tele_notif.Dockerfile
image: ${docker_id}/register_tele_notif:1.0
restart: always
depends_on:
- customer
- driver #register a driver
environment:
customerURL: http://customer:5002/customer
driverURL: http://driver:5001/driver
# API GATEWAY
#Postgres: The database used by Kong
kong-database:
image: postgres:9.6
restart: always
# networks:
# - kong-net
environment:
POSTGRES_DB: kong
POSTGRES_USER: kong
POSTGRES_PASSWORD: password
ports:
- "5432:5432"
healthcheck:
test: ["CMD", "pg_isready", "-U", "kong"]
interval: 10s
timeout: 5s
retries: 5
volumes:
- pgdata:/var/lib/postgresql/data
# Kong database migration
kong-migration:
image: kong:2.0.4
command: "kong migrations bootstrap"
restart: on-failure
# networks:
# - kong-net
environment:
KONG_DATABASE: postgres
KONG_PG_HOST: kong-database
KONG_PG_USER: kong
KONG_PG_PASSWORD: password
depends_on:
- kong-database
# Kong: The API Gateway
kong:
image: kong:2.0.4
restart: always
# networks:
# - kong-net
environment:
KONG_DATABASE: postgres
KONG_PG_HOST: kong-database
KONG_PG_USER: kong
KONG_PG_PASSWORD: password
KONG_PROXY_LISTEN: 0.0.0.0:8000
KONG_ADMIN_LISTEN: 0.0.0.0:8001
depends_on:
- kong-migration
ports:
- "8000:8000"
# Konga: Kong GUI
konga:
image: pantsel/konga
restart: always
# networks:
# - kong-net
environment:
DB_ADAPTER: postgres
DB_HOST: kong-database
DB_USER: kong
DB_PASSWORD: password
DB_DATABASE: konga_db
depends_on:
- kong
ports:
- "1337:1337"
volumes:
- kongadata:/app/kongadata