-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
350 lines (333 loc) · 9.42 KB
/
Copy pathdocker-compose.yml
File metadata and controls
350 lines (333 loc) · 9.42 KB
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
# TODO: consolidate env vars in .env file instead of hard coding here.
volumes:
postgres-data:
mongo-data:
redis-data:
rabbitmq-data:
prometheus-data:
grafana-data:
loki-data:
tempo-data:
alertmanager-data:
services:
api-gateway:
build:
context: ./services
dockerfile: api-gateway/api-gateway.dockerfile
image: api-gateway
restart: unless-stopped
ports:
- "8080:80"
depends_on:
authentication-service:
condition: service_started
logger-service:
condition: service_started
location-service:
condition: service_started
trip-service:
condition: service_started
alloy:
condition: service_started
user-service:
condition: service_started
tempo:
condition: service_started
environment:
OTEL_EXPORTER: "otlp"
OTEL_COLLECTOR_ENDPOINT: "alloy:4317"
OTEL_INSECURE: "true"
logger-service:
build:
context: ./services
dockerfile: logger-service/logger-service.dockerfile
image: logger-service
restart: unless-stopped
expose:
- "80"
- "50052"
depends_on:
mongo:
condition: service_started
rabbitmq:
condition: service_healthy
alloy:
condition: service_started
environment:
MONGO_CONNECTION_STRING: "mongodb://admin:password@mongo:27017"
RABBITMQ_CONNECTION_STRING: "amqp://guest:guest@rabbitmq:5672/"
OTEL_EXPORTER: "otlp"
OTEL_COLLECTOR_ENDPOINT: "alloy:4317"
OTEL_INSECURE: "true"
authentication-service:
build:
context: ./services
dockerfile: authentication-service/authentication-service.dockerfile
image: authentication-service
restart: unless-stopped
expose:
- "80"
- "50051"
depends_on:
rabbitmq:
condition: service_healthy
postgres:
condition: service_started
alloy:
condition: service_started
user-service:
condition: service_started
tempo:
condition: service_started
environment:
DSN: "host=postgres port=5432 user=postgres password=password dbname=users sslmode=disable timezone=UTC connect_timeout=5"
JWT_SECRET: "your-secret-key-change-in-production"
JWT_EXPIRY: "24h"
REFRESH_TOKEN_EXPIRY: "168h"
RABBITMQ_CONNECTION_STRING: "amqp://guest:guest@rabbitmq:5672/"
OTEL_EXPORTER: "otlp"
OTEL_COLLECTOR_ENDPOINT: "alloy:4317"
OTEL_INSECURE: "true"
location-service:
build:
context: ./services
dockerfile: location-service/location-service.dockerfile
image: location-service
restart: unless-stopped
expose:
- "80"
- "50053"
depends_on:
redis:
condition: service_started
alloy:
condition: service_started
environment:
REDIS_HOST: "redis"
REDIS_PORT: "6379"
REDIS_PASSWORD: "redispassword"
REDIS_DB: "0"
REDIS_TIME_TO_LIVE: "3600"
OTEL_EXPORTER: "otlp"
OTEL_COLLECTOR_ENDPOINT: "alloy:4317"
OTEL_INSECURE: "true"
postgres:
image: "postgres:17-alpine"
ports:
- "5432:5432"
expose:
- 5432
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
volumes:
- postgres-data:/var/lib/postgresql/data
- ./utils/init_db.sql:/docker-entrypoint-initdb.d/init_db.sql:Z
- ./utils/init_db_trip.sql:/docker-entrypoint-initdb.d/init_db_trip.sql:Z
mongo:
image: "mongo:7-jammy"
ports:
- "27017:27017"
restart: unless-stopped
environment:
MONGO_INITDB_DATABASE: logs
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: password
volumes:
- mongo-data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
redis:
image: "redis:7.2.5-alpine"
ports:
- "6381:6379"
restart: unless-stopped
command: redis-server --requirepass redispassword
volumes:
- redis-data:/data
rabbitmq:
image: "rabbitmq:4.2-management-alpine"
ports:
- "5672:5672"
- "15672:15672"
restart: unless-stopped
environment:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
volumes:
- rabbitmq-data:/var/lib/rabbitmq
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "ping"]
interval: 10s
timeout: 5s
retries: 5
tempo:
image: "grafana/tempo:latest"
restart: unless-stopped
ports:
- "3200:3200" # Tempo query/metrics
expose:
- "4317" # OTLP gRPC
- "4318" # OTLP HTTP
command:
- "-config.file=/etc/tempo/config.yml"
volumes:
- ./observability/tempo-config.yml:/etc/tempo/config.yml:Z
- tempo-data:/var/tempo
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3200/ready"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
prometheus:
image: "prom/prometheus:v3.2.0"
ports:
- "9090:9090"
restart: unless-stopped
depends_on:
alertmanager:
condition: service_healthy
volumes:
- ./observability/prometheus.yml:/etc/prometheus/prometheus.yml:Z
- ./observability/prometheus-alerts.yml:/etc/prometheus/alerts/prometheus-alerts.yml:Z
- prometheus-data:/prometheus
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus"
- "--storage.tsdb.retention.time=15d"
- "--web.enable-lifecycle"
- "--web.enable-remote-write-receiver" # Enable remote write for OTLP metrics
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:9090/-/healthy"]
interval: 30s
timeout: 10s
retries: 3
grafana:
image: grafana/grafana:12.3.0
ports:
- "3000:3000"
restart: unless-stopped
depends_on:
prometheus:
condition: service_healthy
loki:
condition: service_healthy
tempo:
condition: service_started
environment:
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: admin
GF_USERS_ALLOW_SIGN_UP: "false"
GF_FEATURE_TOGGLES_ENABLE: "traceToLogs,correlations,traceQLStreaming,lokiStructuredMetadata"
GF_PATHS_PROVISIONING: /etc/grafana/provisioning
# Anonymous access for demo
GF_AUTH_ANONYMOUS_ENABLED: "true"
GF_AUTH_ANONYMOUS_ORG_ROLE: Viewer
volumes:
- grafana-data:/var/lib/grafana
- ./observability/grafana/provisioning:/etc/grafana/provisioning:Z
healthcheck:
test:
["CMD", "wget", "-q", "--spider", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
retries: 3
alertmanager:
image: prom/alertmanager:v0.28.1
ports:
- "9093:9093"
restart: unless-stopped
volumes:
- alertmanager-data:/alertmanager
- ./observability/alertmanager.yml:/etc/alertmanager/alertmanager.yml:Z
command:
- "--config.file=/etc/alertmanager/alertmanager.yml"
- "--storage.path=/alertmanager"
- "--web.external-url=http://localhost:9093"
- "--cluster.advertise-address=0.0.0.0:9093"
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:9093/-/healthy"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
loki:
image: grafana/loki:3.2.1
restart: unless-stopped
ports:
- "3100:3100"
volumes:
- ./observability/loki-config.yml:/etc/loki/local-config.yaml:Z
- loki-data:/loki
command: -config.file=/etc/loki/local-config.yaml
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3100/ready"]
interval: 30s
timeout: 10s
retries: 3
start_period: 150s
alloy:
image: grafana/alloy:latest
restart: unless-stopped
ports:
- "12345:12345" # Alloy UI
expose:
- "4317" # OTLP gRPC
- "4318" # OTLP HTTP
volumes:
- ./observability/alloy-config.alloy:/etc/alloy/config.alloy:Z
command: ["run", "/etc/alloy/config.alloy", "--server.http.listen-addr=0.0.0.0:12345"]
depends_on:
loki:
condition: service_healthy
tempo:
condition: service_started
trip-service:
build:
context: ./services
dockerfile: trip-service/trip-service.dockerfile
image: trip-service
restart: unless-stopped
expose:
- "80"
- "50054"
depends_on:
postgres:
condition: service_started
rabbitmq:
condition: service_healthy
alloy:
condition: service_started
environment:
DSN: "host=postgres port=5432 user=postgres password=password dbname=trips sslmode=disable timezone=UTC connect_timeout=5"
HERE_ID: ${HERE_ID}
HERE_SECRET: ${HERE_SECRET}
RABBITMQ_CONNECTION_STRING: "amqp://guest:guest@rabbitmq:5672/"
OTEL_EXPORTER: "otlp"
OTEL_COLLECTOR_ENDPOINT: "alloy:4317"
OTEL_INSECURE: "true"
user-service:
build:
context: ./services
dockerfile: user-service/user-service.dockerfile
image: user-service
restart: unless-stopped
expose:
- "80"
- "50055"
depends_on:
mongo:
condition: service_started
alloy:
condition: service_started
environment:
MONGO_CONNECTION_STRING: "mongodb://admin:password@mongo:27017"
OTEL_EXPORTER: "otlp"
OTEL_COLLECTOR_ENDPOINT: "alloy:4317"
OTEL_INSECURE: "true"