forked from thinktecture-labs/cloud-native-sample
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
490 lines (486 loc) · 14 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
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
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
version: "3.9"
services:
#####################
## Troubleshooting ##
#####################
# ubuntu:
# image: ubuntu:latest
# container_name: debug
# command: ["sleep","infinity"]
# networks:
# - cloud-native
######################
## App Dependencies ##
######################
rabbit:
image: rabbitmq:management-alpine
container_name: rabbitmq
ports:
- "15672:15672"
networks:
- cloud-native
##################
## App Services ##
##################
gateway:
build: ./src/Gateway
container_name: gateway
logging:
driver: loki
options:
loki-url: http://10.5.0.99:3100/loki/api/v1/push
loki-retries: 5
environment:
ASPNETCORE_ENVIRONMENT: DockerCompose
Gateway__ExposePrometheusMetrics: true
Gateway__LimitRequestsPerMinute: 2000
Gateway__ZipkinEndpoint: http://zipkin:9411/api/v2/spans
DAPR_HTTP_PORT: 9000
networks:
- cloud-native
depends_on:
- zipkin
ports:
- "5000:5000"
orders:
build: ./src/OrdersService
container_name: orders
networks:
- cloud-native
depends_on:
- zipkin
- rabbit
environment:
OrdersService__ExposePrometheusMetrics: true
OrdersService__ZipkinEndpoint: http://zipkin:9411/api/v2/spans
OrdersService__IdentityServer__Authority: http://localhost:5009
OrdersService__IdentityServer__RequireHttpsMetadata: false
OrdersService__IdentityServer__MetadataAddress: http://authn:5000/.well-known/openid-configuration
logging:
driver: loki
options:
loki-url: http://10.5.0.99:3100/loki/api/v1/push
loki-retries: 5
products:
build: ./src/ProductsService
container_name: products
environment:
ProductsService__ExposePrometheusMetrics: true
ProductsService__ZipkinEndpoint: http://zipkin:9411/api/v2/spans
ProductsService__IdentityServer__Authority: http://localhost:5009
ProductsService__IdentityServer__RequireHttpsMetadata: false
ProductsService__IdentityServer__MetadataAddress: http://authn:5000/.well-known/openid-configuration
networks:
- cloud-native
depends_on:
- zipkin
logging:
driver: loki
options:
loki-url: http://10.5.0.99:3100/loki/api/v1/push
loki-retries: 5
ordermonitorservice:
build: ./src/OrderMonitorService
container_name: order-monitor-service
environment:
DAPR_HTTP_PORT: 9000
OrderMonitorService__Environment: Development
OrderMonitorService__DisableConsoleLog: false
OrderMonitorService__ZipkinEndpoint: http://zipkin:9411/api/v2/spans
networks:
- cloud-native
depends_on:
- orders
- products
logging:
driver: loki
options:
loki-url: http://10.5.0.99:3100/loki/api/v1/push
loki-retries: 5
notification:
build: ./src/NotificationService
container_name: notification
environment:
DAPR_API_TOKEN: dGhpcyBpcyBmb3IgZGVtbyBvbmx5LCBpbiByZWFsLXdvcmxkIHVzZSBzb21ldGhpbmcgdGhhdCBpcyBzdG9yZWQgc2VjdXJlbHkK
NotificationService__ExposePrometheusMetrics: true
NotificationService__IdentityServer__Authority: http://localhost:5009
NotificationService__IdentityServer__RequireHttpsMetadata: false
NotificationService__IdentityServer__MetadataAddress: http://authn:5000/.well-known/openid-configuration
NotificationService__ZipkinEndpoint: http://zipkin:9411/api/v2/spans
networks:
- cloud-native
depends_on:
- zipkin
- rabbit
logging:
driver: loki
options:
loki-url: http://10.5.0.99:3100/loki/api/v1/push
loki-retries: 5
shipping:
build: ./src/ShippingService
container_name: shipping
environment:
DAPR_API_TOKEN: dGhpcyBpcyBmb3IgZGVtbyBvbmx5LCBpbiByZWFsLXdvcmxkIHVzZSBzb21ldGhpbmcgdGhhdCBpcyBzdG9yZWQgc2VjdXJlbHkK
ShippingService__Environment: Development
ShippingService__ZipkinEndpoint: http://zipkin:9411/api/v2/spans
networks:
- cloud-native
depends_on:
- zipkin
- rabbit
logging:
driver: loki
options:
loki-url: http://10.5.0.99:3100/loki/api/v1/push
loki-retries: 5
ordermonitor:
build:
context: ./src/OrderMonitorClient
args:
- TARGET=docker-compose
container_name: order-monitor-client
environment:
- IdentityServer__Uri=http://localhost:5009/
ports:
- "5005:8080"
networks:
- cloud-native
authentication:
build: ./src/AuthenticationService
container_name: authn
environment:
IdentityServer__AllowHttp: true
#IdentityServer__InteractiveClient__RedirectUris__0: http://localhost:5005/callback.html
#IdentityServer__InteractiveClient__FrontChannelLogoutUri: http://localhost:5005/signout-oidc
#IdentityServer__InteractiveClient__PostLogoutRedirectUris__0: http://localhost:5005/signout-callback-oidc
#IdentityServer__InteractiveClient__AllowedCorsOrigins__0: http://localhost:5005
ports:
- "5009:5000"
networks:
- cloud-native
logging:
driver: loki
options:
loki-url: http://10.5.0.99:3100/loki/api/v1/push
loki-retries: 5
pricewatcher:
build: ./src/PriceWatcherService
container_name: pricewatcher
networks:
- cloud-native
depends_on:
- rabbit
environment:
PriceWatcherService__ExposePrometheusMetrics: true
PriceWatcherService__ZipkinEndpoint: http://zipkin:9411/api/v2/spans
PriceWatcherService__IdentityServer__Authority: http://localhost:5009
PriceWatcherService__IdentityServer__RequireHttpsMetadata: false
PriceWatcherService__IdentityServer__MetadataAddress: http://authn:5000/.well-known/openid-configuration
logging:
driver: loki
options:
loki-url: http://10.5.0.99:3100/loki/api/v1/push
loki-retries: 5
pricedropnotifier:
build: ./src/PriceDropNotifierService
container_name: pricedropnotifier
networks:
- cloud-native
depends_on:
- smtp
environment:
DAPR_API_TOKEN: dGhpcyBpcyBmb3IgZGVtbyBvbmx5LCBpbiByZWFsLXdvcmxkIHVzZSBzb21ldGhpbmcgdGhhdCBpcyBzdG9yZWQgc2VjdXJlbHkK
PriceDropNotifierService__ExposePrometheusMetrics: true
PriceDropNotifierService__ZipkinEndpoint: http://zipkin:9411/api/v2/spans
PriceDropNotifierService__IdentityServer__Authority: http://localhost:5009
PriceDropNotifierService__IdentityServer__RequireHttpsMetadata: false
PriceDropNotifierService__IdentityServer__MetadataAddress: http://authn:5000/.well-known/openid-configuration
Logging__LogLeveL__Microsoft.AspNetCore: Information
logging:
driver: loki
options:
loki-url: http://10.5.0.99:3100/loki/api/v1/push
loki-retries: 5
###################
## Dapr Sidecars ##
###################
gateway-dapr:
image: "daprio/daprd:edge"
container_name: gateway-dapr
command:
[
"./daprd",
"-app-id",
"gateway",
"-app-port",
"5000",
"-dapr-http-port",
"9000",
"-dapr-grpc-port",
"10000",
"-components-path",
"/dapr/components",
"-config",
"/dapr/config/config.yml"
]
network_mode: "service:gateway"
volumes:
- ./docker-compose-configs/dapr/config.yml:/dapr/config/config.yml:ro
- ./docker-compose-configs/dapr/components:/dapr/components:ro
depends_on:
- gateway
orders-dapr:
image: "daprio/daprd:edge"
container_name: orders-dapr
command:
[
"./daprd",
"-app-id",
"orders",
"-app-port",
"5000",
"-components-path",
"/dapr/components",
"-config",
"/dapr/config/config.yml"
]
network_mode: "service:orders"
volumes:
- ./docker-compose-configs/dapr/config.yml:/dapr/config/config.yml:ro
- ./docker-compose-configs/dapr/components:/dapr/components:ro
depends_on:
- orders
products-dapr:
image: "daprio/daprd:edge"
container_name: products-dapr
command:
[
"./daprd",
"-app-id",
"products",
"-app-port",
"5000",
"-components-path",
"/dapr/components",
"-config",
"/dapr/config/config.yml"
]
network_mode: "service:products"
volumes:
- ./docker-compose-configs/dapr/config.yml:/dapr/config/config.yml:ro
- ./docker-compose-configs/dapr/components:/dapr/components:ro
depends_on:
- products
ordermonitorservice-dapr:
image: "daprio/daprd:edge"
container_name: ordermonitorservice-dapr
command:
[
"./daprd",
"-app-id",
"ordermonitorservice",
"-app-port",
"5000",
"-dapr-http-port",
"9000",
"-dapr-grpc-port",
"10000",
"-components-path",
"/dapr/components",
"-config",
"/dapr/config/config.yml"
]
network_mode: "service:ordermonitorservice"
volumes:
- ./docker-compose-configs/dapr/config.yml:/dapr/config/config.yml:ro
- ./docker-compose-configs/dapr/components:/dapr/components:ro
depends_on:
- ordermonitorservice
notification-dapr:
image: "daprio/daprd:edge"
container_name: notification-dapr
command:
[
"./daprd",
"-app-id",
"notification",
"-app-port",
"5000",
"-components-path",
"/dapr/components",
"-config",
"/dapr/config/config.yml"
]
network_mode: "service:notification"
environment:
APP_API_TOKEN: dGhpcyBpcyBmb3IgZGVtbyBvbmx5LCBpbiByZWFsLXdvcmxkIHVzZSBzb21ldGhpbmcgdGhhdCBpcyBzdG9yZWQgc2VjdXJlbHkK
volumes:
- ./docker-compose-configs/dapr/config.yml:/dapr/config/config.yml:ro
- ./docker-compose-configs/dapr/components:/dapr/components:ro
depends_on:
- notification
shipping-dapr:
image: "daprio/daprd:edge"
container_name: shipping-dapr
command:
[
"./daprd",
"-app-id",
"shipping",
"-app-port",
"5000",
"-components-path",
"/dapr/components",
"-config",
"/dapr/config/config.yml"
]
network_mode: "service:shipping"
environment:
APP_API_TOKEN: dGhpcyBpcyBmb3IgZGVtbyBvbmx5LCBpbiByZWFsLXdvcmxkIHVzZSBzb21ldGhpbmcgdGhhdCBpcyBzdG9yZWQgc2VjdXJlbHkK
volumes:
- ./docker-compose-configs/dapr/config.yml:/dapr/config/config.yml:ro
- ./docker-compose-configs/dapr/components:/dapr/components:ro
depends_on:
- shipping
pricewatcher-dapr:
image: "daprio/daprd:edge"
container_name: pricewatcher-dapr
command:
[
"./daprd",
"-app-id",
"pricewatcher",
"-app-port",
"5000",
"-components-path",
"/dapr/components",
"-config",
"/dapr/config/config.yml"
]
network_mode: "service:pricewatcher"
volumes:
- ./docker-compose-configs/dapr/config.yml:/dapr/config/config.yml:ro
- ./docker-compose-configs/dapr/components:/dapr/components:ro
depends_on:
- pricewatcher
pricedropnotifier-dapr:
image: "daprio/daprd:edge"
container_name: pricedropnotifier-dapr
command:
[
"./daprd",
"-app-id",
"pricedropnotifier",
"-app-port",
"5000",
"-components-path",
"/dapr/components",
"-config",
"/dapr/config/config.yml"
]
network_mode: "service:pricedropnotifier"
environment:
APP_API_TOKEN: dGhpcyBpcyBmb3IgZGVtbyBvbmx5LCBpbiByZWFsLXdvcmxkIHVzZSBzb21ldGhpbmcgdGhhdCBpcyBzdG9yZWQgc2VjdXJlbHkK
volumes:
- ./docker-compose-configs/dapr/config.yml:/dapr/config/config.yml:ro
- ./docker-compose-configs/dapr/components:/dapr/components:ro
depends_on:
- pricedropnotifier
###################
## Observability ##
###################
loki:
image: grafana/loki:2.5.0
container_name: loki
ports:
- "3100:3100"
command: -config.file=/etc/loki/local-config.yaml
networks:
cloud-native:
ipv4_address: 10.5.0.99
grafana:
image: grafana/grafana-oss:latest
container_name: grafana
ports:
- "3000:3000"
volumes:
- ./docker-compose-configs/grafana/datasources:/etc/grafana/provisioning/datasources
- ./docker-compose-configs/grafana/dashboards:/etc/grafana/provisioning/dashboards
networks:
- cloud-native
prometheus:
image: prom/prometheus:latest
container_name: prometheus
ports:
- "9090:9090"
command:
- --config.file=/etc/prometheus/prometheus.yml
volumes:
- ./docker-compose-configs/prometheus:/etc/prometheus:ro
depends_on:
- alertmanager
networks:
- cloud-native
alertmanager:
image: prom/alertmanager:latest
container_name: alertmanager
ports:
- "9093:9093"
volumes:
- "./docker-compose-configs/alertmanager:/config"
command: --config.file=/config/alertmanager.yml --log.level=debug
depends_on:
- smtp
networks:
- cloud-native
smtp:
image: gessnerfl/fake-smtp-server
container_name: smtp
environment:
- SPRING_MAIL_USERNAME=cnadmin
- SPRING_MAIL_PASSWORD=somepassword
ports:
- "5080:5080"
networks:
- cloud-native
cadvisor:
image: gcr.io/cadvisor/cadvisor:v0.47.1
container_name: cadvisor
privileged: true
ports:
- "8080:8080"
volumes:
- /:/rootfs:ro
- /var/run/docker.sock:/var/run/docker.sock:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
depends_on:
- redis
networks:
- cloud-native
redis:
image: redis:latest
container_name: redis
ports:
- "6379:6379"
networks:
- cloud-native
zipkin:
image: "openzipkin/zipkin"
container_name: zipkin
ports:
- "9411:9411"
networks:
- cloud-native
###################
## Network Setup ##
###################
networks:
cloud-native:
driver: bridge
name: cloud-native
ipam:
config:
- subnet: 10.5.0.0/16
gateway: 10.5.0.1