-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
372 lines (352 loc) · 9.91 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
version: '0'
services:
##RabbitMQ Docker Compose Config
rabbitmq:
image: rabbitmq:3.12.10-management-alpine
container_name: 'rabbitmq'
restart: unless-stopped
hostname: rabbitmq
environment:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
RABBITMQ_DEFAULT_VHOST: /
healthcheck:
test: rabbitmq-diagnostics -q status
interval: 30s
timeout: 30s
retries: 3
ports:
- 5672:5672
- 15672:15672
volumes:
- ~/.docker-conf/rabbitmq/data/:/var/lib/rabbitmq/
- ~/.docker-conf/rabbitmq/log/:/var/log/rabbitmq
networks:
- bistro-microservices-network
## User Service Mongo Docker Compose Config
user-service-mongo:
container_name: user-service-mongo
image: mongo:latest
restart: unless-stopped
hostname: user-service-mongo
ports:
- 27017:27017
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
volumes:
- user-service-mongo-data:/data/db
networks:
- bistro-microservices-network
##Auth Service MySQL Docker Compose Config
auth-service-mysql:
image: mysql:8.2.0
container_name: auth-service-mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: 12345678
MYSQL_DATABASE: bistro-auth-service
MYSQL_USER: authservice
MYSQL_PASSWORD: 12345678
hostname: auth-service-mysql
volumes:
- auth-service-mysql-data:/var/lib/mysql
- ./auth-service/src/main/resources/script:/docker-entrypoint-initdb.d/
healthcheck:
test: ["CMD", "curl" ,"-f", "http://auth-service-mysql:3306"]
interval: 1s
retries: 3
start_period: 25s
networks:
- bistro-microservices-network
##Food Service MySQL Docker Compose Config
food-service-mysql:
image: mysql:8.2.0
container_name: food-service-mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: 12345678
MYSQL_DATABASE: bistro-food-service
MYSQL_USER: foodservice
MYSQL_PASSWORD: 12345678
hostname: food-service-mysql
volumes:
- food-service-mysql-data:/var/lib/mysql
- ./food-service/src/main/resources/script:/docker-entrypoint-initdb.d/
healthcheck:
test: [ "CMD", "curl" ,"-f", "http://food-service-mysql:3306" ]
interval: 1s
retries: 3
start_period: 25s
networks:
- bistro-microservices-network
##Order Service MySQL Docker Compose Config
order-service-mysql:
image: mysql:8.2.0
container_name: order-service-mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: 12345678
MYSQL_DATABASE: bistro-order-service
MYSQL_USER: orderservice
MYSQL_PASSWORD: 12345678
hostname: order-service-mysql
volumes:
- order-service-mysql-data:/var/lib/mysql
- ./order-service/src/main/resources/script:/docker-entrypoint-initdb.d/
healthcheck:
test: [ "CMD", "curl" ,"-f", "http://order-service-mysql:3306" ]
interval: 1s
retries: 3
start_period: 25s
networks:
- bistro-microservices-network
payment-service-mysql:
image: mysql:8.2.0
container_name: payment-service-mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: 12345678
MYSQL_DATABASE: bistro-payment-service
MYSQL_USER: paymentservice
MYSQL_PASSWORD: 12345678
hostname: payment-service-mysql
volumes:
- payment-service-mysql-data:/var/lib/mysql
- ./payment-service/src/main/resources/script:/docker-entrypoint-initdb.d/
healthcheck:
test: [ "CMD", "curl" ,"-f", "http://payment-service-mysql:3306" ]
interval: 1s
retries: 3
start_period: 25s
networks:
- bistro-microservices-network
##Config Server Docker Compose Config
config-server:
container_name: config-server
restart: unless-stopped
build:
context: ./config-server
dockerfile: Dockerfile
hostname: config-server
ports:
- "8888:8888"
networks:
- bistro-microservices-network
##Eureka Server Docker Compose Config
eureka-server:
container_name: eureka-server
restart: unless-stopped
build:
context: ./eureka-server
dockerfile: Dockerfile
hostname: eureka-server
environment:
- SPRING_PROFILES_ACTIVE=docker
networks:
- bistro-microservices-network
healthcheck:
test: [ "CMD", "curl", "-f", "http://eureka-server:8761" ]
interval: 30s
timeout: 10s
retries: 5
##API Gateway Docker Compose Config
api-gateway:
container_name: api-gateway
restart: unless-stopped
build:
context: ./api-gateway
dockerfile: Dockerfile
hostname: api-gateway
ports:
- "8222:8222"
depends_on:
config-server:
condition: service_healthy
eureka-server:
condition: service_healthy
environment:
- SPRING_PROFILES_ACTIVE=docker
- SPRING_APPLICATION_NAME=apigateway
- SPRING_CLOUD_CONFIG_URI=http://config-server:8888
networks:
- bistro-microservices-network
##Auth Service Docker Compose Config
auth-service:
container_name: auth-service
restart: unless-stopped
build:
context: ./auth-service
dockerfile: Dockerfile
hostname: auth-service
depends_on:
config-server:
condition: service_healthy
eureka-server:
condition: service_healthy
auth-service-mysql:
condition: service_healthy
api-gateway:
condition: service_started
user-service:
condition: service_started
environment:
- SPRING_PROFILES_ACTIVE=docker
- SPRING_APPLICATION_NAME=authservice
- SPRING_CLOUD_CONFIG_URI=http://config-server:8888
networks:
- bistro-microservices-network
##User Service Docker Compose Config
user-service:
container_name: user-service
restart: unless-stopped
build:
context: ./user-service
dockerfile: Dockerfile
hostname: user-service
depends_on:
config-server:
condition: service_healthy
eureka-server:
condition: service_healthy
user-service-mongo:
condition: service_healthy
api-gateway:
condition: service_started
environment:
- SPRING_PROFILES_ACTIVE=docker
- SPRING_APPLICATION_NAME=userservice
- SPRING_CLOUD_CONFIG_URI=http://config-server:8888
links:
- user-service-mongo:user-service-mongo
networks:
- bistro-microservices-network
##Food Service Docker Compose Config
food-service:
container_name: food-service
restart: unless-stopped
build:
context: ./food-service
dockerfile: Dockerfile
hostname: food-service
depends_on:
config-server:
condition: service_healthy
eureka-server:
condition: service_healthy
food-service-mysql:
condition: service_healthy
api-gateway:
condition: service_started
environment:
- SPRING_PROFILES_ACTIVE=docker
- SPRING_APPLICATION_NAME=foodservice
- SPRING_CLOUD_CONFIG_URI=http://config-server:8888
networks:
- bistro-microservices-network
##Order Service Docker Compose Config
order-service:
container_name: order-service
restart: unless-stopped
build:
context: ./order-service
dockerfile: Dockerfile
hostname: order-service
depends_on:
config-server:
condition: service_healthy
eureka-server:
condition: service_healthy
order-service-mysql:
condition: service_healthy
rabbitmq:
condition: service_healthy
api-gateway:
condition: service_started
environment:
- SPRING_PROFILES_ACTIVE=docker
- SPRING_APPLICATION_NAME=orderservice
- SPRING_CLOUD_CONFIG_URI=http://config-server:8888
links:
- rabbitmq:rabbitmq
- order-service-mysql:order-service-mysql
- food-service:food-service
- user-service:user-service
networks:
- bistro-microservices-network
payment-service:
container_name: payment-service
restart: unless-stopped
build:
context: ./payment-service
dockerfile: Dockerfile
hostname: payment-service
depends_on:
config-server:
condition: service_healthy
eureka-server:
condition: service_healthy
order-service-mysql:
condition: service_healthy
rabbitmq:
condition: service_healthy
api-gateway:
condition: service_started
environment:
- SPRING_PROFILES_ACTIVE=docker
- SPRING_APPLICATION_NAME=paymentservice
- SPRING_CLOUD_CONFIG_URI=http://config-server:8888
links:
- rabbitmq:rabbitmq
- payment-service-mysql:payment-service-mysql
- order-service:order-service
networks:
- bistro-microservices-network
# Tracing service
bistro-zipkin:
image: openzipkin/zipkin
container_name: bistro-zipkin
hostname: bistro-zipkin
ports:
- "9411:9411"
networks:
- bistro-microservices-network
# Monitoring Services
bistro-prometheus:
build:
context: ./bistro-prometheus
dockerfile: Dockerfile
restart: always
container_name: bistro-prometheus
hostname: bistro-prometheus
volumes:
- prometheus-data:/prometheus
ports:
- "9090:9090"
command:
- --config.file=/etc/prometheus/prometheus.yml
networks:
- bistro-microservices-network
bistro-grafana:
build:
context: ./bistro-grafana
dockerfile: Dockerfile
image: bistro-grafana
container_name: bistro-grafana
hostname: bistro-grafana
ports:
- "3030:3000"
volumes:
- bistro-grafana-volume:/var/lib/grafana
networks:
- bistro-microservices-network
volumes:
auth-service-mysql-data:
user-service-mongo-data:
food-service-mysql-data:
order-service-mysql-data:
payment-service-mysql-data:
bistro-grafana-volume:
prometheus-data:
networks:
bistro-microservices-network:
name: bistro-microservices-network