-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprevious-docker-compose.yml
471 lines (443 loc) · 11 KB
/
previous-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
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
version: "3.7"
volumes:
auth_data: {}
catalog_data: {}
inventory_data: {}
user_data: {}
mail_data: {}
mailhog_data: {}
redis-data: {}
cart_data: {}
order_data: {}
networks:
practical-ms:
name: practical-ms
driver: bridge
services:
# Auth Service and postgress database ------------------------------
# auth-db:
# image: postgres:9.6
# container_name: auth-db
# restart: on-failure
# networks:
# - practical-ms
# volumes:
# - auth_data:/var/lib/postgresql/data
# environment:
# POSTGRES_USER: auth
# POSTGRES_PASSWORD: auth
# POSTGRES_DB: auth
# ports:
# - "5433:5432"
# healthcheck:
# test: ["CMD", "pg_isready", "-U", "auth"]
# interval: 30s
# timeout: 30s
# retries: 3
# auth-prepare:
# build:
# context: ./auth
# dockerfile: Dockerfile
# command: npx prisma migrate dev --name init
# environment:
# DATABASE_URL: postgresql://auth:[email protected]:5433/auth?schema=public
# networks:
# - practical-ms
# restart: on-failure
# depends_on:
# - auth-db
db:
image: postgres:9.6
container_name: db
restart: on-failure
networks:
- practical-ms
volumes:
- db_data:/var/lib/postgresql/data
environment:
POSTGRES_USER: db
POSTGRES_PASSWORD: db
POSTGRES_DB: db
ports:
- "5433:5432"
healthcheck:
test: ["CMD", "pg_isready", "-U", "db"]
interval: 30s
timeout: 30s
retries: 3
auth:
build:
context: ./auth
dockerfile: Dockerfile
command: npx prisma migrate dev --name init
image: auth
container_name: auth
restart: on-failure
ports:
- "4000:4000"
environment:
DATABASE_URL: postgresql://db:[email protected]:5433/auth?schema=public
MODE: development
JWT_ACCESS_SECRET: access_secret
USER_SERVICE_URL: http://host.docker.internal:4003/api/v1
MAIL_SERVICE_URL: http://host.docker.internal:4004/api/v1
AUTH_SERVICE_URL: http://host.docker.internal:4000/api/v1
EMAIL_FROM: [email protected]
depends_on:
- db
volumes:
- ./auth:/app
- /app/node_modules
networks:
- practical-ms
# # User Service and postgress database ------------------------------
# user-db:
# image: postgres:9.6
# container_name: user-db
# restart: on-failure
# networks:
# - practical-ms
# volumes:
# - user_data:/var/lib/postgresql/data
# environment:
# POSTGRES_USER: user
# POSTGRES_PASSWORD: user
# POSTGRES_DB: user
# ports:
# - "5439:5432"
# healthcheck:
# test: ["CMD", "pg_isready", "-U", "user"]
# interval: 30s
# timeout: 30s
# retries: 3
# user-prepare:
# build:
# context: ./user
# dockerfile: Dockerfile
# command: npx prisma migrate dev --name init
# environment:
# DATABASE_URL: postgresql://user:[email protected]:5439/user?schema=public
# networks:
# - practical-ms
# restart: on-failure
# depends_on:
# - user-db
user:
build:
context: ./user
dockerfile: Dockerfile
image: user
container_name: user
restart: on-failure
ports:
- "4003:4000"
environment:
DATABASE_URL: postgresql://user:[email protected]:5439/user?schema=public
MODE: development
depends_on:
- user-db
- user-prepare
volumes:
- ./user:/app
- /app/node_modules
networks:
- practical-ms
# catalog Service and postgress database ------------------------------
catalog-db:
image: postgres:9.6
container_name: catalog-db
restart: on-failure
networks:
- practical-ms
volumes:
- catalog_data:/var/lib/postgresql/data
environment:
POSTGRES_USER: catalog
POSTGRES_PASSWORD: catalog
POSTGRES_DB: catalog
ports:
- "5434:5432"
healthcheck:
test: ["CMD", "pg_isready", "-U", "catalog"]
interval: 30s
timeout: 30s
retries: 3
catalog-prepare:
build:
context: ./catalog
dockerfile: Dockerfile
command: npx prisma migrate dev --name init
environment:
DATABASE_URL: postgresql://catalog:[email protected]:5434/catalog?schema=public
networks:
- practical-ms
restart: on-failure
depends_on:
- catalog-db
catalog:
build:
context: ./catalog
dockerfile: Dockerfile
image: catalog
container_name: catalog
restart: on-failure
ports:
- "4001:4000"
environment:
DATABASE_URL: postgresql://catalog:[email protected]:5434/catalog?schema=public
MODE: development
INVENTORY_SERVICE_URL: http://host.docker.internal:4002/api/v1
AUTH_SERVICE_URL: http://host.docker.internal:4000/api/v1
depends_on:
- catalog-db
- catalog-prepare
volumes:
- ./catalog:/app
- /app/node_modules
networks:
- practical-ms
# Inventory Service and postgress database ------------------------------
inventory-db:
image: postgres:9.6
container_name: inventory-db
restart: on-failure
networks:
- practical-ms
volumes:
- inventory_data:/var/lib/postgresql/data
environment:
POSTGRES_USER: inventory
POSTGRES_PASSWORD: inventory
POSTGRES_DB: inventory
ports:
- "5435:5432"
healthcheck:
test: ["CMD", "pg_isready", "-U", "auth"]
interval: 30s
timeout: 30s
retries: 3
inventory-prepare:
build:
context: ./inventory
dockerfile: Dockerfile
command: npx prisma migrate dev --name init
environment:
DATABASE_URL: postgresql://inventory:[email protected]:5435/inventory?schema=public
MODE: development
networks:
- practical-ms
restart: on-failure
depends_on:
- inventory-db
inventory:
build:
context: ./inventory
dockerfile: Dockerfile
image: inventory
container_name: inventory
restart: on-failure
ports:
- "4002:4000"
environment:
DATABASE_URL: postgresql://inventory:[email protected]:5435/inventory?schema=public
depends_on:
- inventory-db
- inventory-prepare
volumes:
- ./inventory:/app
- /app/node_modules
networks:
- practical-ms
# Mail Service and postgress database ------------------------------
mailhog:
image: mailhog/mailhog
ports:
- 1025:1025 # SMTP port
- 8025:8025
networks:
- practical-ms
volumes:
- mailhog_data:/var/lib/mailhog
mail-db:
image: postgres:9.6
container_name: mail-db
restart: on-failure
networks:
- practical-ms
volumes:
- mail_data:/var/lib/postgresql/data
environment:
POSTGRES_USER: mail
POSTGRES_PASSWORD: mail
POSTGRES_DB: mail
ports:
- "5436:5432"
healthcheck:
test: ["CMD", "pg_isready", "-U", "mail"]
interval: 30s
timeout: 30s
retries: 3
mail-prepare:
build:
context: ./mail
dockerfile: Dockerfile
command: npx prisma migrate dev --name init
environment:
DATABASE_URL: postgresql://mail:[email protected]:5436/mail?schema=public
MODE: development
SMTP_HOST: mailhog
SMTP_PORT: 1025
networks:
- practical-ms
restart: on-failure
depends_on:
- mail-db
- mailhog
mail:
build:
context: ./mail
dockerfile: Dockerfile
image: mail
container_name: mail
restart: on-failure
ports:
- "4004:4000"
environment:
DATABASE_URL: postgresql://mail:[email protected]:5436/mail?schema=public
SMTP_HOST: mailhog
SMTP_PORT: 1025
depends_on:
- mail-db
- mail-prepare
- mailhog
volumes:
- ./mail:/app
- /app/node_modules
networks:
- practical-ms
# Redis Service
redis-stack:
image: redis/redis-stack:latest
ports:
- "6379:6379"
- "8001:8001"
volumes:
- redis-data:/data
environment:
- REDIS_ARGS=--save 900 1
networks:
- practical-ms
# Cart Service
cart-db:
image: postgres:9.6
container_name: cart-db
restart: on-failure
networks:
- practical-ms
volumes:
- cart_data:/var/lib/postgresql/data
environment:
POSTGRES_USER: cart
POSTGRES_PASSWORD: cart
POSTGRES_DB: cart
ports:
- "5437:5432"
healthcheck:
test: ["CMD", "pg_isready", "-U", "cart"]
interval: 30s
timeout: 30s
retries: 3
cart-prepare:
build:
context: ./cart
dockerfile: Dockerfile
command: npx prisma migrate dev --name init
environment:
DATABASE_URL: postgresql://cart:[email protected]:5437/cart?schema=public
networks:
- practical-ms
restart: on-failure
depends_on:
- cart-db
- redis-stack
cart:
build:
context: ./cart
dockerfile: Dockerfile
image: cart
container_name: cart
restart: on-failure
ports:
- "4005:4000"
environment:
DATABASE_URL: postgresql://cart:[email protected]:5437/cart?schema=public
MODE: development
REDIS_URL: redis://host.docker.internal:6379
INVENTORY_SERVICE_URL: http://host.docker.internal:4002/api/v1
ORDER_SERVICE_URL: http://host.docker.internal:4006/api/v1
AUTH_SERVICE_URL: http://host.docker.internal:4000/api/v1
REDIS_EXPIRATION_TIME: 900 # 15 minutes
depends_on:
- cart-db
- cart-prepare
- redis-stack
volumes:
- ./cart:/app
- /app/node_modules
networks:
- practical-ms
# Order Service
order-db:
image: postgres:9.6
container_name: order-db
restart: on-failure
networks:
- practical-ms
volumes:
- order_data:/var/lib/postgresql/data
environment:
POSTGRES_USER: order
POSTGRES_PASSWORD: order
POSTGRES_DB: order
ports:
- "5438:5432"
healthcheck:
test: ["CMD", "pg_isready", "-U", "order"]
interval: 30s
timeout: 30s
retries: 3
order-prepare:
build:
context: ./order
dockerfile: Dockerfile
command: npx prisma migrate dev --name init
environment:
DATABASE_URL: postgresql://order:[email protected]:5438/order?schema=public
MODE: development
MAIL_SERVICE_URL: http://host.docker.internal:4004/api/v1
networks:
- practical-ms
restart: on-failure
depends_on:
- order-db
- redis-stack
order:
build:
context: ./order
dockerfile: Dockerfile
image: order
container_name: order
restart: on-failure
ports:
- "4006:4000"
environment:
DATABASE_URL: postgresql://order:[email protected]:5438/order?schema=public
MAIL_SERVICE_URL: http://host.docker.internal:4004/api/v1
depends_on:
- order-db
- order-prepare
volumes:
- ./order:/app
- /app/node_modules
networks:
- practical-ms