-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
docker-compose.minimal.yml
672 lines (647 loc) · 17.3 KB
/
docker-compose.minimal.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
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0
x-default-logging: &logging
driver: "json-file"
options:
max-size: "5m"
max-file: "2"
tag: "{{.Name}}"
networks:
default:
name: opentelemetry-demo
driver: bridge
services:
# ******************
# Core Demo Services
# ******************
# AdService
ad:
image: ${IMAGE_NAME}:${DEMO_VERSION}-ad
container_name: ad
build:
context: ./
dockerfile: ${AD_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-ad
args:
OTEL_JAVA_AGENT_VERSION: ${OTEL_JAVA_AGENT_VERSION}
deploy:
resources:
limits:
memory: 300M
restart: unless-stopped
ports:
- "${AD_PORT}"
environment:
- AD_PORT
- FLAGD_HOST
- OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_LOGS_EXPORTER=otlp
- OTEL_SERVICE_NAME=ad
depends_on:
otel-collector:
condition: service_started
logging: *logging
# Cart service
cart:
image: ${IMAGE_NAME}:${DEMO_VERSION}-cart
container_name: cart-service
build:
context: ./
dockerfile: ${CART_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-cart
deploy:
resources:
limits:
memory: 160M
restart: unless-stopped
ports:
- "${CART_PORT}"
environment:
- CART_PORT
- FLAGD_HOST
- VALKEY_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=cart
- ASPNETCORE_URLS=http://*:${CART_PORT}
depends_on:
valkey-cart:
condition: service_started
otel-collector:
condition: service_started
logging: *logging
# Checkout service
checkoutservice:
image: ${IMAGE_NAME}:${DEMO_VERSION}-checkoutservice
container_name: checkout-service
build:
context: ./
dockerfile: ${CHECKOUT_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-checkoutservice
deploy:
resources:
limits:
memory: 20M
restart: unless-stopped
ports:
- "${CHECKOUT_SERVICE_PORT}"
environment:
- CHECKOUT_SERVICE_PORT
- CART_ADDR
- CURRENCY_ADDR
- EMAIL_SERVICE_ADDR
- FLAGD_HOST
- PAYMENT_SERVICE_ADDR
- PRODUCT_CATALOG_SERVICE_ADDR
- SHIPPING_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=checkoutservice
depends_on:
cart:
condition: service_started
currency:
condition: service_started
emailservice:
condition: service_started
paymentservice:
condition: service_started
productcatalogservice:
condition: service_started
shipping:
condition: service_started
otel-collector:
condition: service_started
logging: *logging
# Currency service
currency:
image: ${IMAGE_NAME}:${DEMO_VERSION}-currency
container_name: currency-service
build:
context: ./
dockerfile: ${CURRENCY_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-currency
args:
OPENTELEMETRY_CPP_VERSION: ${OPENTELEMETRY_CPP_VERSION}
deploy:
resources:
limits:
memory: 20M
restart: unless-stopped
ports:
- "${CURRENCY_PORT}"
environment:
- CURRENCY_PORT
- VERSION=${IMAGE_VERSION}
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_RESOURCE_ATTRIBUTES=${OTEL_RESOURCE_ATTRIBUTES},service.name=currency # The C++ SDK does not support OTEL_SERVICE_NAME
depends_on:
otel-collector:
condition: service_started
logging: *logging
# Email service
emailservice:
image: ${IMAGE_NAME}:${DEMO_VERSION}-emailservice
container_name: email-service
build:
context: ./src/emailservice
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-emailservice
deploy:
resources:
limits:
memory: 100M
restart: unless-stopped
ports:
- "${EMAIL_SERVICE_PORT}"
environment:
- APP_ENV=production
- EMAIL_SERVICE_PORT
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}/v1/traces
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=emailservice
depends_on:
otel-collector:
condition: service_started
logging: *logging
# Frontend
frontend:
image: ${IMAGE_NAME}:${DEMO_VERSION}-frontend
container_name: frontend
build:
context: ./
dockerfile: ${FRONTEND_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-frontend
deploy:
resources:
limits:
memory: 250M
restart: unless-stopped
ports:
- "${FRONTEND_PORT}"
environment:
- PORT=${FRONTEND_PORT}
- FRONTEND_ADDR
- AD_ADDR
- CART_ADDR
- CHECKOUT_SERVICE_ADDR
- CURRENCY_ADDR
- PRODUCT_CATALOG_SERVICE_ADDR
- RECOMMENDATION_SERVICE_ADDR
- SHIPPING_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_RESOURCE_ATTRIBUTES=${OTEL_RESOURCE_ATTRIBUTES}
- ENV_PLATFORM
- OTEL_SERVICE_NAME=frontend
- PUBLIC_OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
- WEB_OTEL_SERVICE_NAME=frontend-web
- OTEL_COLLECTOR_HOST
- FLAGD_HOST
- FLAGD_PORT
depends_on:
ad:
condition: service_started
cart:
condition: service_started
checkoutservice:
condition: service_started
currency:
condition: service_started
productcatalogservice:
condition: service_started
quote:
condition: service_started
recommendationservice:
condition: service_started
shipping:
condition: service_started
otel-collector:
condition: service_started
image-provider:
condition: service_started
logging: *logging
# Frontend Proxy (Envoy)
frontendproxy:
image: ${IMAGE_NAME}:${DEMO_VERSION}-frontendproxy
container_name: frontend-proxy
build:
context: ./
dockerfile: ${FRONTEND_PROXY_DOCKERFILE}
deploy:
resources:
limits:
memory: 50M
restart: unless-stopped
ports:
- "${ENVOY_PORT}:${ENVOY_PORT}"
- 10000:10000
environment:
- FRONTEND_PORT
- FRONTEND_HOST
- LOCUST_WEB_HOST
- LOCUST_WEB_PORT
- GRAFANA_SERVICE_PORT
- GRAFANA_SERVICE_HOST
- JAEGER_SERVICE_PORT
- JAEGER_SERVICE_HOST
- OTEL_COLLECTOR_HOST
- IMAGE_PROVIDER_HOST
- IMAGE_PROVIDER_PORT
- OTEL_COLLECTOR_PORT_GRPC
- OTEL_COLLECTOR_PORT_HTTP
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=frontend-proxy
- ENVOY_PORT
- FLAGD_HOST
- FLAGD_PORT
- FLAGD_UI_HOST
- FLAGD_UI_PORT
depends_on:
frontend:
condition: service_started
load-generator:
condition: service_started
jaeger:
condition: service_started
grafana:
condition: service_started
# image-provider
image-provider:
image: ${IMAGE_NAME}:${DEMO_VERSION}-image-provider
container_name: image-provider
build:
context: ./
dockerfile: ${IMAGE_PROVIDER_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-image-provider
deploy:
resources:
limits:
memory: 120M
restart: unless-stopped
ports:
- "${IMAGE_PROVIDER_PORT}"
environment:
- IMAGE_PROVIDER_PORT
- OTEL_COLLECTOR_HOST
- OTEL_COLLECTOR_PORT_GRPC
- OTEL_SERVICE_NAME=image-provider
- OTEL_RESOURCE_ATTRIBUTES
depends_on:
otel-collector:
condition: service_started
logging: *logging
# Load Generator
load-generator:
image: ${IMAGE_NAME}:${DEMO_VERSION}-load-generator
container_name: load-generator
build:
context: ./
dockerfile: ${LOAD_GENERATOR_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-load-generator
deploy:
resources:
limits:
memory: 120M
restart: unless-stopped
ports:
- "${LOCUST_WEB_PORT}"
environment:
- LOCUST_WEB_PORT
- LOCUST_USERS
- LOCUST_HOST
- LOCUST_HEADLESS
- LOCUST_AUTOSTART
- LOCUST_BROWSER_TRAFFIC_ENABLED=false
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=load-generator
- PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
- LOCUST_WEB_HOST=0.0.0.0
- FLAGD_HOST
- FLAGD_PORT
depends_on:
frontend:
condition: service_started
flagd:
condition: service_started
logging: *logging
# Payment service
paymentservice:
image: ${IMAGE_NAME}:${DEMO_VERSION}-paymentservice
container_name: payment-service
build:
context: ./
dockerfile: ${PAYMENT_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-paymentservice
deploy:
resources:
limits:
memory: 120M
restart: unless-stopped
ports:
- "${PAYMENT_SERVICE_PORT}"
environment:
- FLAGD_HOST
- PAYMENT_SERVICE_PORT
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=paymentservice
depends_on:
otel-collector:
condition: service_started
logging: *logging
# Product Catalog service
productcatalogservice:
image: ${IMAGE_NAME}:${DEMO_VERSION}-productcatalogservice
container_name: product-catalog-service
build:
context: ./
dockerfile: ${PRODUCT_CATALOG_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-productcatalogservice
deploy:
resources:
limits:
memory: 20M
restart: unless-stopped
ports:
- "${PRODUCT_CATALOG_SERVICE_PORT}"
environment:
- FLAGD_HOST
- PRODUCT_CATALOG_SERVICE_PORT
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=productcatalogservice
depends_on:
otel-collector:
condition: service_started
logging: *logging
# Quote service
quote:
image: ${IMAGE_NAME}:${DEMO_VERSION}-quote
container_name: quote-service
build:
context: ./
dockerfile: ${QUOTE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-quote
deploy:
resources:
limits:
memory: 40M
restart: unless-stopped
ports:
- "${QUOTE_PORT}"
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_HTTP}
- OTEL_PHP_AUTOLOAD_ENABLED=true
- QUOTE_PORT
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=quote
- OTEL_PHP_INTERNAL_METRICS_ENABLED=true
depends_on:
otel-collector:
condition: service_started
logging: *logging
# Recommendation service
recommendationservice:
image: ${IMAGE_NAME}:${DEMO_VERSION}-recommendationservice
container_name: recommendation-service
build:
context: ./
dockerfile: ${RECOMMENDATION_SERVICE_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-recommendationservice
deploy:
resources:
limits:
memory: 50M
restart: unless-stopped
ports:
- "${RECOMMENDATION_SERVICE_PORT}"
environment:
- FLAGD_HOST
- RECOMMENDATION_SERVICE_PORT
- PRODUCT_CATALOG_SERVICE_ADDR
- OTEL_PYTHON_LOG_CORRELATION=true
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=recommendationservice
- PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
depends_on:
productcatalogservice:
condition: service_started
otel-collector:
condition: service_started
logging: *logging
# Shipping service
shipping:
image: ${IMAGE_NAME}:${DEMO_VERSION}-shipping
container_name: shipping
build:
context: ./
dockerfile: ${SHIPPING_DOCKERFILE}
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-shipping
deploy:
resources:
limits:
memory: 20M
restart: unless-stopped
ports:
- "${SHIPPING_PORT}"
environment:
- SHIPPING_PORT
- QUOTE_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT=http://${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_GRPC}
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=shipping
depends_on:
otel-collector:
condition: service_started
logging: *logging
# ******************
# Dependent Services
# ******************
# Flagd, feature flagging service
flagd:
image: ${FLAGD_IMAGE}
container_name: flagd
deploy:
resources:
limits:
memory: 75M
environment:
- FLAGD_OTEL_COLLECTOR_URI=${OTEL_COLLECTOR_HOST}:${OTEL_COLLECTOR_PORT_GRPC}
- FLAGD_METRICS_EXPORTER=otel
- OTEL_RESOURCE_ATTRIBUTES
- OTEL_SERVICE_NAME=flagd
command: [
"start",
"--uri",
"file:./etc/flagd/demo.flagd.json"
]
ports:
- 8013
volumes:
- ./src/flagd:/etc/flagd
logging:
*logging
# Valkey used by Cart service
valkey-cart:
image: ${VALKEY_IMAGE}
container_name: valkey-cart
user: valkey
deploy:
resources:
limits:
memory: 20M
restart: unless-stopped
ports:
- "${VALKEY_PORT}"
logging: *logging
# ********************
# Telemetry Components
# ********************
# Jaeger
jaeger:
image: ${JAEGERTRACING_IMAGE}
container_name: jaeger
command:
- "--memory.max-traces=5000"
- "--query.base-path=/jaeger/ui"
- "--prometheus.server-url=http://${PROMETHEUS_ADDR}"
- "--prometheus.query.normalize-calls=true"
- "--prometheus.query.normalize-duration=true"
deploy:
resources:
limits:
memory: 400M
restart: unless-stopped
ports:
- "${JAEGER_SERVICE_PORT}" # Jaeger UI
- "${OTEL_COLLECTOR_PORT_GRPC}"
environment:
- METRICS_STORAGE_TYPE=prometheus
logging: *logging
# Grafana
grafana:
image: ${GRAFANA_IMAGE}
container_name: grafana
deploy:
resources:
limits:
memory: 100M
restart: unless-stopped
environment:
- "GF_INSTALL_PLUGINS=grafana-opensearch-datasource"
volumes:
- ./src/grafana/grafana.ini:/etc/grafana/grafana.ini
- ./src/grafana/provisioning/:/etc/grafana/provisioning/
ports:
- "${GRAFANA_SERVICE_PORT}"
logging: *logging
# OpenTelemetry Collector
otel-collector:
image: ${COLLECTOR_CONTRIB_IMAGE}
container_name: otel-collector
deploy:
resources:
limits:
memory: 200M
restart: unless-stopped
command: [ "--config=/etc/otelcol-config.yml", "--config=/etc/otelcol-config-extras.yml" ]
user: 0:0
volumes:
- ${HOST_FILESYSTEM}:/hostfs:ro
- ${DOCKER_SOCK}:/var/run/docker.sock:ro
- ${OTEL_COLLECTOR_CONFIG}:/etc/otelcol-config.yml
- ${OTEL_COLLECTOR_CONFIG_EXTRAS}:/etc/otelcol-config-extras.yml
ports:
- "${OTEL_COLLECTOR_PORT_GRPC}"
- "${OTEL_COLLECTOR_PORT_HTTP}"
depends_on:
jaeger:
condition: service_started
opensearch:
condition: service_healthy
logging: *logging
environment:
- ENVOY_PORT
- HOST_FILESYSTEM
- OTEL_COLLECTOR_HOST
- OTEL_COLLECTOR_PORT_GRPC
- OTEL_COLLECTOR_PORT_HTTP
# Prometheus
prometheus:
image: ${PROMETHEUS_IMAGE}
container_name: prometheus
command:
- --web.console.templates=/etc/prometheus/consoles
- --web.console.libraries=/etc/prometheus/console_libraries
- --storage.tsdb.retention.time=1h
- --config.file=/etc/prometheus/prometheus-config.yaml
- --storage.tsdb.path=/prometheus
- --web.enable-lifecycle
- --web.route-prefix=/
- --web.enable-otlp-receiver
- --enable-feature=exemplar-storage
volumes:
- ./src/prometheus/prometheus-config.yaml:/etc/prometheus/prometheus-config.yaml
deploy:
resources:
limits:
memory: 300M
restart: unless-stopped
ports:
- "${PROMETHEUS_SERVICE_PORT}:${PROMETHEUS_SERVICE_PORT}"
logging: *logging
# OpenSearch
opensearch:
image: ${OPENSEARCH_IMAGE}
container_name: opensearch
deploy:
resources:
limits:
memory: 1G
restart: unless-stopped
environment:
- cluster.name=demo-cluster
- node.name=demo-node
- bootstrap.memory_lock=true
- discovery.type=single-node
- OPENSEARCH_JAVA_OPTS=-Xms300m -Xmx300m
- DISABLE_INSTALL_DEMO_CONFIG=true
- DISABLE_SECURITY_PLUGIN=true
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
ports:
- "9200"
healthcheck:
test: curl -s http://localhost:9200/_cluster/health | grep -E '"status":"(green|yellow)"'
start_period: 10s
interval: 5s
timeout: 10s
retries: 10
logging: *logging