-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathcompose.yaml
192 lines (191 loc) · 6.6 KB
/
compose.yaml
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
services:
frontend:
build:
context: .
dockerfile: ./frontend/Dockerfile
container_name: frontend
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
otel-collector:
# todo rely on service_healthy instead of service_started. It doesn't work for the moment
condition: service_started
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/ecommerce
- SPRING_DATASOURCE_USERNAME=ecommerce
- SPRING_DATASOURCE_PASSWORD=ecommerce
- SPRING_JPA_HIBERNATE_DDL_AUTO=update
- FRAUDDETECTIONSERVICE.BASEURL=http://fraud-detection:8081
- CHECKOUTSERVICE.GRPCENDPOINT=checkout:50051
- SPRING_DATA_REDIS_HOST=redis
- SPRING_RABBITMQ_HOST=rabbitmq
- OTEL_SERVICE_NAME=frontend
- OTEL_RESOURCE_ATTRIBUTES=service.namespace=${OTEL_SERVICE_NAMESPACE-shop},service.version=1.1,deployment.environment.name=${OTEL_DEPLOYMENT_ENVIRONMENT_NAME-production}
- OTEL_SEMCONV_STABILITY_OPT_IN=http,database
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
ports:
- "8080:8080"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/actuator/health"]
fraud-detection:
build:
context: .
dockerfile: ./fraud-detection/Dockerfile
container_name: fraud-detection
depends_on:
postgres:
condition: service_healthy
otel-collector:
condition: service_started
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/ecommerce
- SPRING_DATASOURCE_USERNAME=ecommerce
- SPRING_DATASOURCE_PASSWORD=ecommerce
- SERVER_PORT=8081
- OTEL_SERVICE_NAME=fraud-detection
- OTEL_RESOURCE_ATTRIBUTES=service.namespace=${OTEL_SERVICE_NAMESPACE-shop},service.version=1.1,deployment.environment.name=${OTEL_DEPLOYMENT_ENVIRONMENT_NAME-production}
- OTEL_SEMCONV_STABILITY_OPT_IN=http,database
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
ports:
- "8081:8081"
checkout:
build:
context: .
dockerfile: ./checkout/Dockerfile
container_name: checkout
depends_on:
postgres:
condition: service_healthy
otel-collector:
condition: service_started
environment:
- SHIPPING_SERVICE_URL=http://shipping:8088
- OTEL_SERVICE_NAME=checkout
- OTEL_RESOURCE_ATTRIBUTES=service.namespace=${OTEL_SERVICE_NAMESPACE-shop},service.version=1.1,deployment.environment.name=${OTEL_DEPLOYMENT_ENVIRONMENT_NAME-production}
- OTEL_SEMCONV_STABILITY_OPT_IN=http,database
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
ports:
- "50051:50051"
shipping:
build:
context: .
dockerfile: ./shipping/Dockerfile
container_name: shipping
depends_on:
postgres:
condition: service_healthy
otel-collector:
condition: service_started
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/ecommerce
- SPRING_DATASOURCE_USERNAME=ecommerce
- SPRING_DATASOURCE_PASSWORD=ecommerce
- SERVER_PORT=8088
- OTEL_SERVICE_NAME=shipping
- OTEL_RESOURCE_ATTRIBUTES=service.namespace=${OTEL_SERVICE_NAMESPACE-shop},service.version=1.1,deployment.environment.name=${OTEL_DEPLOYMENT_ENVIRONMENT_NAME-production}
- OTEL_SEMCONV_STABILITY_OPT_IN=http,database
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
ports:
- "8088:8088"
warehouse:
build:
context: .
dockerfile: ./warehouse/Dockerfile
container_name: warehouse
depends_on:
postgres:
condition: service_healthy
rabbitmq:
condition: service_healthy
otel-collector:
condition: service_started
environment:
- SPRING_RABBITMQ_HOST=rabbitmq
- SERVER_PORT=8089
- OTEL_SERVICE_NAME=warehouse
- OTEL_RESOURCE_ATTRIBUTES=service.namespace=${OTEL_SERVICE_NAMESPACE-shop},service.version=1.1,deployment.environment.name=${OTEL_DEPLOYMENT_ENVIRONMENT_NAME-production}
- OTEL_SEMCONV_STABILITY_OPT_IN=http,database
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
ports:
- "8089:8089"
postgres:
image: 'postgres:16-alpine'
container_name: postgres
environment:
- POSTGRES_USER=ecommerce
- POSTGRES_PASSWORD=ecommerce
ports:
- "5432:5432"
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U $${POSTGRES_USER}" ]
interval: 5s
timeout: 2s
retries: 3
redis:
image: 'redis:6-alpine'
container_name: redis
ports:
- "6379:6379"
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 5s
timeout: 2s
retries: 3
rabbitmq:
image: 'rabbitmq:4-management-alpine'
container_name: rabbitmq
ports:
- "5672:5672"
- "15672:15672"
healthcheck:
test: "rabbitmq-diagnostics -q status"
#test: ["CMD", "curl", "-f", "http://guest:guest@localhost:15672/api/queues"]
# health check : http://guest:guest@localhost:15672/api/healthchecks/node /
interval: 5s
timeout: 2s
retries: 3
otel-collector:
# https://opentelemetry.io/docs/collector/installation/#docker-compose
image: 'otel/opentelemetry-collector-contrib:0.121.0'
container_name: otel-collector
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
rabbitmq:
condition: service_healthy
environment:
- GRAFANA_CLOUD_INSTANCE_ID=${GRAFANA_CLOUD_INSTANCE_ID:?error}
- GRAFANA_CLOUD_API_KEY=${GRAFANA_CLOUD_API_KEY:?error}
- GRAFANA_CLOUD_OTLP_ENDPOINT=${GRAFANA_CLOUD_OTLP_ENDPOINT:?error}
volumes:
- ./docker-compose/otel-collector/otel-collector-config.yml:/etc/otelcol-contrib/config.yaml
ports:
- "1888:1888" # pprof extension
- "8888:8888" # Prometheus metrics exposed by the Collector
- "8889:8889" # Prometheus exporter metrics
- "13133:13133" # health_check extension
- "4317:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP http receiver
- "55679:55679" # zpages extension
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8888/metrics"]
interval: 10s
timeout: 5s
retries: 3
k6-load-generator:
image: 'grafana/k6:latest'
container_name: k6-load-generator
volumes:
- ./load-generator/src/main/k6/k6.js:/k6-load-generator.js
command: run -e FRONTEND_URLS="http://frontend:8080" /k6-load-generator.js
depends_on:
- frontend
- fraud-detection
- checkout
- shipping