forked from open-telemetry/opentelemetry-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
432 lines (410 loc) · 11.9 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
version: '3.9'
x-default-logging: &logging
driver: "json-file"
options:
max-size: "5m"
max-file: "2"
networks:
default:
name: opentelemetry-demo
driver: bridge
services:
# Jaeger
jaeger:
image: jaegertracing/all-in-one
container_name: jaeger
ports:
- "16686:16686" # Jaeger UI
- "14250" # Jaeger model.proto endpoint
logging: *logging
# Collector
otelcol:
image: otel/opentelemetry-collector-contrib:0.56.0
container_name: otel-col
command: [ "--config=/etc/otelcol-config.yml", "--config=/etc/otelcol-config-extras.yml" ]
volumes:
- ./src/otelcollector/otelcol-config.yml:/etc/otelcol-config.yml
- ./src/otelcollector/otelcol-config-extras.yml:/etc/otelcol-config-extras.yml
ports:
- "4317" # OTLP over gRPC receiver
- "4318:4318" # OTLP over HTTP receiver
- "9464" # Prometheus exporter
- "8888" # metrics endpoint
depends_on:
- jaeger
logging: *logging
# Redis
redis-cart:
image: redis:alpine
container_name: redis-cart
ports:
- "${REDIS_PORT}"
logging: *logging
# AdService
adservice:
image: ${IMAGE_NAME}:${IMAGE_VERSION}-adservice
container_name: ad-service
build:
context: ./
dockerfile: ./src/adservice/Dockerfile
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-adservice
ports:
- "${AD_SERVICE_PORT}"
environment:
- AD_SERVICE_PORT
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
- OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
- OTEL_SERVICE_NAME=adservice
depends_on:
- otelcol
logging: *logging
# CartService
cartservice:
image: ${IMAGE_NAME}:${IMAGE_VERSION}-cartservice
container_name: cart-service
build:
context: ./
dockerfile: ./src/cartservice/src/Dockerfile
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-cartservice
ports:
- "${CART_SERVICE_PORT}"
environment:
- CART_SERVICE_PORT
- REDIS_ADDR
- OTEL_EXPORTER_OTLP_ENDPOINT
- OTEL_SERVICE_NAME=cartservice
- ASPNETCORE_URLS=http://*:${CART_SERVICE_PORT}
depends_on:
- redis-cart
- otelcol
logging: *logging
# CheckoutService
checkoutservice:
image: ${IMAGE_NAME}:${IMAGE_VERSION}-checkoutservice
container_name: checkout-service
build:
context: ./
dockerfile: ./src/checkoutservice/Dockerfile
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-checkoutservice
ports:
- "${CHECKOUT_SERVICE_PORT}"
environment:
- CHECKOUT_SERVICE_PORT
- CART_SERVICE_ADDR
- CURRENCY_SERVICE_ADDR
- EMAIL_SERVICE_ADDR
- PAYMENT_SERVICE_ADDR
- PRODUCT_CATALOG_SERVICE_ADDR
- SHIPPING_SERVICE_ADDR
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
- OTEL_SERVICE_NAME=checkoutservice
depends_on:
- cartservice
- currencyservice
- emailservice
- paymentservice
- productcatalogservice
- shippingservice
- otelcol
logging: *logging
# CurrencyService
currencyservice:
image: ${IMAGE_NAME}:${IMAGE_VERSION}-currencyservice
container_name: currency-service
build:
context: ./src/currencyservice
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-currencyservice
args:
- GRPC_VERSION=1.46.0
- OPENTELEMETRY_VERSION=1.5.0
ports:
- "${CURRENCY_SERVICE_PORT}"
environment:
- CURRENCY_SERVICE_PORT
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
- OTEL_RESOURCE_ATTRIBUTES=service.name=currencyservice # The C++ SDK does not support OTEL_SERVICE_NAME
depends_on:
- otelcol
logging: *logging
# EmailService
emailservice:
image: ${IMAGE_NAME}:${IMAGE_VERSION}-emailservice
container_name: email-service
build:
context: ./src/emailservice
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-emailservice
ports:
- "${EMAIL_SERVICE_PORT}"
environment:
- APP_ENV=production
- EMAIL_SERVICE_PORT
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://otelcol:4318/v1/traces
- OTEL_SERVICE_NAME=emailservice
depends_on:
- otelcol
logging: *logging
# Frontend
frontend:
image: ${IMAGE_NAME}:${IMAGE_VERSION}-frontend
container_name: frontend
build:
context: ./
dockerfile: ./src/frontend/Dockerfile
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-frontend
ports:
- "${FRONTEND_PORT}:${FRONTEND_PORT}"
environment:
- PORT=${FRONTEND_PORT}
- FRONTEND_ADDR
- AD_SERVICE_ADDR
- CART_SERVICE_ADDR
- CHECKOUT_SERVICE_ADDR
- CURRENCY_SERVICE_ADDR
- PRODUCT_CATALOG_SERVICE_ADDR
- RECOMMENDATION_SERVICE_ADDR
- SHIPPING_SERVICE_ADDR
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
- OTEL_RESOURCE_ATTRIBUTES=service.name=frontend
- OTEL_EXPORTER_OTLP_ENDPOINT
- ENV_PLATFORM
- OTEL_SERVICE_NAME=frontend
depends_on:
- adservice
- cartservice
- checkoutservice
- currencyservice
- otelcol
- productcatalogservice
- recommendationservice
- shippingservice
logging: *logging
# Frontend Tests
frontendTests:
image: cypress/included:10.3.1-typescript
depends_on:
- frontend
profiles:
- tests
environment:
- CYPRESS_baseUrl=http://${FRONTEND_ADDR}
- NODE_ENV=production
working_dir: /cypress
volumes:
- ./src/frontend:/cypress
# Integration Tests
integrationTests:
image: ${IMAGE_NAME}:${IMAGE_VERSION}-integrationTests
container_name: integrationTests
profiles:
- tests
build:
context: ./
dockerfile: ./test/Dockerfile
environment:
- AD_SERVICE_ADDR
- CART_SERVICE_ADDR
- CHECKOUT_SERVICE_ADDR
- CURRENCY_SERVICE_ADDR
- EMAIL_SERVICE_ADDR
- PAYMENT_SERVICE_ADDR
- PRODUCT_CATALOG_SERVICE_ADDR
- RECOMMENDATION_SERVICE_ADDR
- SHIPPING_SERVICE_ADDR
depends_on:
- adservice
- cartservice
- checkoutservice
- currencyservice
- emailservice
- paymentservice
- productcatalogservice
- recommendationservice
- shippingservice
# PaymentService
paymentservice:
image: ${IMAGE_NAME}:${IMAGE_VERSION}-paymentservice
container_name: payment-service
build:
context: ./
dockerfile: ./src/paymentservice/Dockerfile
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-paymentservice
ports:
- "${PAYMENT_SERVICE_PORT}"
environment:
- PAYMENT_SERVICE_PORT
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
- OTEL_SERVICE_NAME=paymentservice
depends_on:
- otelcol
logging: *logging
# ProductCatalogService
productcatalogservice:
image: ${IMAGE_NAME}:${IMAGE_VERSION}-productcatalogservice
container_name: product-catalog-service
build:
context: ./
dockerfile: ./src/productcatalogservice/Dockerfile
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-productcatalogservice
ports:
- "${PRODUCT_CATALOG_SERVICE_PORT}"
environment:
- PRODUCT_CATALOG_SERVICE_PORT
- FEATURE_FLAG_GRPC_SERVICE_ADDR
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
- OTEL_SERVICE_NAME=productcatalogservice
depends_on:
- otelcol
logging: *logging
quoteservice:
image: ${IMAGE_NAME}:${IMAGE_VERSION}-quoteservice
container_name: quoteservice
build:
context: ./
dockerfile: ./src/quoteservice/Dockerfile
ports:
- "${QUOTE_SERVICE_PORT}"
environment:
# OTEL_EXPORTER_OTLP_TRACES_ENDPOINT # Not working for PHP
- QUOTE_SERVICE_PORT
- OTEL_SERVICE_NAME=quoteservice
- OTEL_EXPORTER_OTLP_ENDPOINT=otelcol:4317
- OTEL_TRACES_SAMPLER=parentbased_always_on
- OTEL_TRACES_EXPORTER=otlp
- OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=grpc
- OTEL_PHP_TRACES_PROCESSOR=simple
depends_on:
- otelcol
logging: *logging
# RecommendationService
recommendationservice:
image: ${IMAGE_NAME}:${IMAGE_VERSION}-recommendationservice
container_name: recommendation-service
build:
context: ./
dockerfile: ./src/recommendationservice/Dockerfile
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-recommendationservice
ports:
- "${RECOMMENDATION_SERVICE_PORT}"
depends_on:
- productcatalogservice
- otelcol
environment:
- RECOMMENDATION_SERVICE_PORT
- PRODUCT_CATALOG_SERVICE_ADDR
- OTEL_PYTHON_LOG_CORRELATION=true
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
- OTEL_SERVICE_NAME=recommendationservice
logging: *logging
# ShippingService
shippingservice:
image: ${IMAGE_NAME}:${IMAGE_VERSION}-shippingservice
container_name: shipping-service
build:
context: ./
dockerfile: ./src/shippingservice/Dockerfile
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-shippingservice
ports:
- "${SHIPPING_SERVICE_PORT}"
environment:
- SHIPPING_SERVICE_PORT
- QUOTE_SERVICE_ADDR
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
- OTEL_SERVICE_NAME=shippingservice
depends_on:
- otelcol
logging: *logging
# FeatureFlagService
featureflagservice:
image: ${IMAGE_NAME}:${IMAGE_VERSION}-featureflagservice
container_name: feature-flag-service
build:
context: ./src/featureflagservice
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-featureflagservice
ports:
- "${FEATURE_FLAG_SERVICE_PORT}:${FEATURE_FLAG_SERVICE_PORT}" # Feature Flag Service UI
- "${FEATURE_FLAG_GRPC_SERVICE_PORT}" # Feature Flag Service gRPC API
environment:
- FEATURE_FLAG_SERVICE_PORT
- FEATURE_FLAG_GRPC_SERVICE_PORT
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
- OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=grpc
- OTEL_SERVICE_NAME=featureflagservice
- DATABASE_URL=ecto://ffs:ffs@ffs_postgres:5432/ffs
depends_on:
ffs_postgres:
condition: service_healthy
logging: *logging
ffs_postgres:
image: cimg/postgres:14.2
container_name: postgres
environment:
- POSTGRES_USER=ffs
- POSTGRES_DB=ffs
- POSTGRES_PASSWORD=ffs
logging: *logging
healthcheck:
test: ["CMD-SHELL", "pg_isready"]
interval: 10s
timeout: 5s
retries: 5
# LoadGenerator
loadgenerator:
image: ${IMAGE_NAME}:${IMAGE_VERSION}-loadgenerator
container_name: load-generator
build:
context: ./
dockerfile: ./src/loadgenerator/Dockerfile
cache_from:
- ${IMAGE_NAME}:${IMAGE_VERSION}-loadgenerator
ports:
- "${LOCUST_WEB_PORT}:${LOCUST_WEB_PORT}"
environment:
- LOCUST_WEB_PORT
- LOCUST_USERS
- LOCUST_HOST
- LOCUST_HEADLESS
- LOCUST_AUTOSTART
- OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
- OTEL_SERVICE_NAME=loadgenerator
- PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
depends_on:
- frontend
logging: *logging
# Prometheus
prometheus:
image: quay.io/prometheus/prometheus:v2.34.0
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=/
volumes:
- ./src/prometheus/prometheus-config.yaml:/etc/prometheus/prometheus-config.yaml
ports:
- "${PROMETHEUS_SERVICE_PORT}:${PROMETHEUS_SERVICE_PORT}"
logging: *logging
# Grafana
grafana:
image: grafana/grafana:9.1.0
container_name: grafana
volumes:
- ./src/grafana/grafana.ini:/etc/grafana/grafana.ini
- ./src/grafana/provisioning/:/etc/grafana/provisioning/
ports:
- "${GRAFANA_SERVICE_PORT}:${GRAFANA_SERVICE_PORT}"
logging: *logging