-
Notifications
You must be signed in to change notification settings - Fork 12
/
docker-compose.yaml
321 lines (308 loc) · 8.55 KB
/
docker-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
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
version: "3"
services:
mongodb:
build:
context: mongo
image: ${REPOSITORY}-mongodb:${PROJECT_VERSION}
networks:
app-network:
logging: &logging
driver: "json-file"
options:
max-size: "25m"
max-file: "2"
redis:
image: redis:6.2-alpine
networks:
app-network:
logging:
<<: *logging
rabbitmq:
image: rabbitmq:3.8-management-alpine
networks:
app-network:
logging:
<<: *logging
mysql:
build:
context: mysql
image: ${REPOSITORY}-mysql-db:${PROJECT_VERSION}
cap_add:
- NET_ADMIN
networks:
app-network:
healthcheck:
test: ["CMD", "mysqladmin", "-uratings", "-piloveit", "-h", "localhost", "ping"]
interval: 10s
timeout: 10s
retries: 3
logging:
<<: *logging
dispatch:
build:
context: dispatch
image: ${REPOSITORY}-dispatch:${PROJECT_VERSION}
depends_on:
- rabbitmq
networks:
app-network:
environment:
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:?No OpenTelemetry collector specified via OTEL_EXPORTER_OTLP_ENDPOINT}
OTEL_EXPORTER_OTLP_HEADERS: ${OTEL_EXPORTER_OTLP_HEADERS:?No OpenTelemetry headers specified via OTEL_EXPORTER_OTLP_HEADERS}
OTEL_SERVICE_NAME: otel-shop-dispatch
logging:
<<: *logging
front:
image: ${REPOSITORY}-front:${PROJECT_VERSION}
build:
context: front
depends_on:
- catalogue
- ratings
- user
- web
environment:
WEB_HOST: web
CATALOGUE_HOST: catalogue
CART_HOST: cart
PAYMENT_HOST: payment
SHIPPING_HOST: shipping
RATINGS_HOST: ratings
USER_HOST: user
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:?No OpenTelemetry collector specified via OTEL_EXPORTER_OTLP_ENDPOINT}
OTEL_EXPORTER_OTLP_HEADERS: ${OTEL_EXPORTER_OTLP_HEADERS:?No OpenTelemetry headers specified via OTEL_EXPORTER_OTLP_HEADERS}
OTEL_SERVICE_NAME: otel-shop-front
volumes:
- ./front/conf/otel-nginx.toml:/conf/otel-nginx.toml
networks:
app-network:
ports:
- "8000:80"
command:
- /usr/sbin/nginx
- -g
- daemon off;
healthcheck:
test:
[
"CMD",
"curl",
"-H",
"X-INSTANA-SYNTHETIC: 1",
"-f",
"http://localhost/health-check",
]
interval: 10s
timeout: 10s
retries: 3
web:
image: ${REPOSITORY}-web:${PROJECT_VERSION}
build:
context: web
environment:
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:?No OpenTelemetry collector specified via OTEL_EXPORTER_OTLP_ENDPOINT}
OTEL_EXPORTER_OTLP_HEADERS: ${OTEL_EXPORTER_OTLP_HEADERS:?No OpenTelemetry headers specified via OTEL_EXPORTER_OTLP_HEADERS}
OTEL_SERVICE_NAME: otel-shop-web
volumes:
- ./web/conf/opentelemetry.conf:/etc/apache2/mods-available/opentelemetry.conf
- ./web/html:/var/www/html
healthcheck:
test:
[
"CMD",
"curl",
"-H",
"X-INSTANA-SYNTHETIC: 1",
"-f",
"http://localhost/server-status",
]
interval: 10s
timeout: 10s
retries: 3
networks:
app-network:
logging:
<<: *logging
cart:
build:
context: cart
image: ${REPOSITORY}-cart:${PROJECT_VERSION}
depends_on:
- redis
networks:
app-network:
environment:
OTEL_EXPORTER_OTLP_ENDPOINT: ${CART_OTEL_EXPORTER_OTLP_ENDPOINT:?No OpenTelemetry collector specified via CART_OTEL_EXPORTER_OTLP_ENDPOINT}
OTEL_EXPORTER_OTLP_HEADERS: ${OTEL_EXPORTER_OTLP_HEADERS:?No OpenTelemetry headers specified via OTEL_EXPORTER_OTLP_HEADERS}
OTEL_SERVICE_NAME: otel-shop-cart
healthcheck:
test:
[
"CMD",
"curl",
"-H",
"X-INSTANA-SYNTHETIC: 1",
"-f",
"http://localhost:8080/health-check",
]
interval: 10s
timeout: 10s
retries: 3
logging:
<<: *logging
catalogue:
build:
context: catalogue
image: ${REPOSITORY}-catalogue:${PROJECT_VERSION}
depends_on:
- mongodb
networks:
app-network:
environment:
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:?No OpenTelemetry collector specified via OTEL_EXPORTER_OTLP_ENDPOINT}
OTEL_EXPORTER_OTLP_HEADERS: ${OTEL_EXPORTER_OTLP_HEADERS:?No OpenTelemetry headers specified via OTEL_EXPORTER_OTLP_HEADERS}
OTEL_SERVICE_NAME: otel-shop-catalogue
healthcheck:
test:
[
"CMD",
"curl",
"-H",
"X-INSTANA-SYNTHETIC: 1",
"-f",
"http://localhost:8080/health-check",
]
interval: 10s
timeout: 10s
retries: 3
logging:
<<: *logging
user:
build:
context: user
image: ${REPOSITORY}-user:${PROJECT_VERSION}
depends_on:
- mongodb
- redis
networks:
app-network:
environment:
REDIS_URL: redis://redis:6379
MONGO_URL: mongodb://mongodb:27017/users
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:?No OpenTelemetry collector specified via OTEL_EXPORTER_OTLP_ENDPOINT}
OTEL_EXPORTER_OTLP_HEADERS: ${OTEL_EXPORTER_OTLP_HEADERS:?No OpenTelemetry headers specified via OTEL_EXPORTER_OTLP_HEADERS}
OTEL_SERVICE_NAME: otel-shop-user
healthcheck:
test:
[
"CMD",
"curl",
"-H",
"X-INSTANA-SYNTHETIC: 1",
"-f",
"http://localhost:8080/health-check",
]
interval: 10s
timeout: 10s
retries: 3
logging:
<<: *logging
ratings:
build:
context: ratings
image: ${REPOSITORY}-ratings:${PROJECT_VERSION}
environment:
APP_ENV: prod
CATALOGUE_URL: http://catalogue:8080
PDO_URL: mysql:host=mysql;dbname=ratings;charset=utf8mb4
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:?No OpenTelemetry collector specified via OTEL_EXPORTER_OTLP_ENDPOINT}
OTEL_EXPORTER_OTLP_HEADERS: ${OTEL_EXPORTER_OTLP_HEADERS:?No OpenTelemetry headers specified via OTEL_EXPORTER_OTLP_HEADERS}
OTEL_PROPAGATORS: w3c
OTEL_EXPORTER_OTLP_PROTOCOL: grpc
OTEL_SERVICE_NAME: otel-shop-ratings
networks:
app-network:
depends_on:
mysql:
condition: service_healthy
healthcheck:
test:
[
"CMD",
"curl",
"-H",
"X-INSTANA-SYNTHETIC: 1",
"-f",
"http://localhost/health-check",
]
interval: 10s
timeout: 10s
retries: 3
logging:
<<: *logging
payment:
build:
context: payment
image: ${REPOSITORY}-payment:${PROJECT_VERSION}
depends_on:
- rabbitmq
networks:
app-network:
environment:
OTEL_EXPORTER_OTLP_ENDPOINT: http://${OTEL_EXPORTER_OTLP_ENDPOINT:?No OpenTelemetry collector specified via OTEL_EXPORTER_OTLP_ENDPOINT}
OTEL_EXPORTER_OTLP_HEADERS: ${OTEL_EXPORTER_OTLP_HEADERS:?No OpenTelemetry headers specified via OTEL_EXPORTER_OTLP_HEADERS}
OTEL_SERVICE_NAME: otel-shop-payment
OTEL_TRACES_EXPORTER: otlp_proto_grpc
OTEL_RESOURCE_ATTRIBUTES: service.name=otel-shop-payment
healthcheck:
test:
[
"CMD",
"curl",
"-H",
"X-INSTANA-SYNTHETIC: 1",
"-f",
"http://localhost:8080/health-check",
]
interval: 10s
timeout: 10s
retries: 3
# Uncomment to change payment gateway
#environment:
#PAYMENT_GATEWAY: "https://www.worldpay.com"
logging:
<<: *logging
shipping:
build:
context: shipping
image: ${REPOSITORY}-shipping:${PROJECT_VERSION}
depends_on:
mysql:
condition: service_healthy
networks:
app-network:
environment:
CART_ENDPOINT: cart:8080
DB_HOST: mysql
REDIS_URL: redis://redis:6379
OTEL_EXPORTER_OTLP_ENDPOINT: ${SHIPPING_OTEL_EXPORTER_OTLP_ENDPOINT:?No OpenTelemetry collector specified via SHIPPING_OTEL_EXPORTER_OTLP_ENDPOINT}
OTEL_EXPORTER_OTLP_HEADERS: ${OTEL_EXPORTER_OTLP_HEADERS:?No OpenTelemetry headers specified via OTEL_EXPORTER_OTLP_HEADERS}
OTEL_SERVICE_NAME: otel-shop-shipping
OTEL_TRACES_SAMPLER: always_on
healthcheck:
test:
[
"CMD",
"curl",
"-H",
"X-INSTANA-SYNTHETIC: 1",
"-f",
"http://localhost:8080/health-check",
]
interval: 10s
timeout: 10s
retries: 3
logging:
<<: *logging
networks:
app-network: {}