-
-
Notifications
You must be signed in to change notification settings - Fork 123
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
143 lines (132 loc) · 3.94 KB
/
docker-compose.yaml
File metadata and controls
143 lines (132 loc) · 3.94 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
x-logging: &default-logging
driver: loki
options:
loki-url: 'http://localhost:3100/api/prom/push'
loki-pipeline-stages: |
- multiline:
firstline: '^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}'
max_wait_time: 3s
- regex:
expression: '^(?P<date>\d{4}-\d{2}-\d{2})T(?P<time>\d{2}:\d{2}:\d{2}.\d{3}) (?P<message>(?s:.*))$$'
x-app-dependencies: &app-dependencies
loki:
condition: service_started
postgres:
condition: service_healthy
redis:
condition: service_healthy
services:
# Infrastructure
loki:
image: grafana/loki:3.5.0
command: -config.file=/etc/loki/local-config.yaml
ports:
- "3100:3100"
prometheus:
image: prom/prometheus:v3.3.1
ports:
- "9090:9090"
volumes:
- ./etc/prometheus:/workspace
command:
- --config.file=/workspace/prometheus.yml
- --enable-feature=exemplar-storage
depends_on:
- loki
logging: *default-logging
tempo:
image: grafana/tempo:2.7.2
command: [ "-config.file=/etc/tempo.yml", "--target=all", "--storage.trace.backend=local", "--storage.trace.local.path=/var/tempo", "--auth.enabled=false" ]
ports:
- "4317:4317"
- "4318:4318"
volumes:
- ./etc/tempo.yml:/etc/tempo.yml
depends_on:
- loki
logging: *default-logging
grafana:
image: grafana/grafana:12.0.1
ports:
- "3000:3000"
volumes:
- ./etc/grafana/:/etc/grafana/provisioning/datasources
- ./etc/dashboards.yaml:/etc/grafana/provisioning/dashboards/dashboards.yaml
- ./etc/dashboards:/etc/grafana/dashboards
depends_on:
- loki
- prometheus
logging: *default-logging
# Applications
app-a:
# build: ./app/
image: ghcr.io/blueswen/spring-boot-observability/app:latest
environment:
- TARGET_ONE_HOST=app-b
- TARGET_TWO_HOST=app-c
- OTEL_EXPORTER_OTLP_ENDPOINT=http://tempo:4317 # send traces to Tempo
- OTEL_EXPORTER_OTLP_PROTOCOL=grpc # use gRPC for OTLP
- OTEL_SERVICE_NAME=app-a # service name for Span
- OTEL_METRICS_EXPORTER=none # disable metrics exporter
- OTEL_LOGS_EXPORTER=none # disable logs exporter
- MANAGEMENT_METRICS_TAGS_APPLICATION=app-a # override default value of management.metrics.tags.application in app/src/main/resources/application.properties
ports:
- "8080:8080"
logging: *default-logging
depends_on: *app-dependencies
app-b:
# build: ./app/
image: ghcr.io/blueswen/spring-boot-observability/app:latest
environment:
- TARGET_ONE_HOST=app-b
- TARGET_TWO_HOST=app-c
- OTEL_EXPORTER_OTLP_ENDPOINT=http://tempo:4317
- OTEL_EXPORTER_OTLP_PROTOCOL=grpc
- OTEL_SERVICE_NAME=app-b
- OTEL_METRICS_EXPORTER=none
- OTEL_LOGS_EXPORTER=none
- MANAGEMENT_METRICS_TAGS_APPLICATION=app-b
ports:
- "8081:8080"
logging: *default-logging
depends_on: *app-dependencies
app-c:
# build: ./app/
image: ghcr.io/blueswen/spring-boot-observability/app:latest
environment:
- TARGET_ONE_HOST=app-b
- TARGET_TWO_HOST=app-c
- OTEL_EXPORTER_OTLP_ENDPOINT=http://tempo:4317
- OTEL_EXPORTER_OTLP_PROTOCOL=grpc
- OTEL_SERVICE_NAME=app-c
- OTEL_METRICS_EXPORTER=none
- OTEL_LOGS_EXPORTER=none
- MANAGEMENT_METRICS_TAGS_APPLICATION=app-c
ports:
- "8082:8080"
logging: *default-logging
depends_on: *app-dependencies
postgres:
image: postgres:17.4-alpine3.21
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=postgres
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
logging: *default-logging
redis:
image: redis:7.2.4
ports:
- "6379:6379"
logging: *default-logging
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5