-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocker-compose.yml
176 lines (164 loc) · 4.77 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
version: '3.9'
name: spring-observabilidade
x-logging: &default-logging
driver: loki
options:
loki-url: http://localhost:3100/loki/api/v1/push
loki-pipeline-stages: |
- multiline:
firstline: '^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3}'
max_wait_time: 3s
- regex:
expression: '^(?P<date>\d{4}-\d{2}-\d{2}) (?P<time>\d{2}:\d{2}:\d{2}.\d{3}) (?P<message>(?s:.*))$$'
# Infraestrutura
services:
loki:
container_name: loki
image: grafana/loki:2.9.4
user: root
command: -config.file=/etc/loki/config.yml
volumes:
- ./configs/loki/config.yml:/etc/loki/config.yml
- ./configs/loki/data:/loki/wal/
ports:
- 3100:3100
prometheus:
container_name: prometheus
user: root
image: prom/prometheus:v2.49.1
ports:
- 9090:9090
volumes:
- ./configs/prometheus/config.yml:/prometheus/config.yml
- ./configs/prometheus/data/:/prometheus/data/
command:
- --config.file=/prometheus/config.yml
- --enable-feature=exemplar-storage
depends_on:
- loki
logging: *default-logging
tempo:
container_name: tempo
image: grafana/tempo:2.3.1
command:
- --target=all
- --storage.trace.backend=local
- --storage.trace.local.path=/var/tempo/cluster
- --auth.enabled=false
volumes:
- ./configs/tempo/data/:/var/tempo/wal/
- ./configs/tempo/data/cluster/:/var/tempo/cluster/
ports:
- 14250:14250
- 4317:4317
depends_on:
- loki
logging: *default-logging
grafana:
container_name: grafana
image: grafana/grafana:10.3.3
ports:
- 3000:3000
volumes:
- ./configs/grafana/datasource.yml:/etc/grafana/provisioning/datasources/datasources.yml
- ./configs/grafana/dashboards.yml:/etc/grafana/provisioning/dashboards/dashboards.yml
- ./configs/grafana/dashboards:/etc/share/grafana/dashboards
depends_on:
- loki
- tempo
- prometheus
- app-a
- app-b
- app-c
logging: *default-logging
blackbox-exporter:
container_name: blackbox-exporter
image: prom/blackbox-exporter:v0.24.0
ports:
- 9115:9115
volumes:
- ./configs/blackbox/config.yml:/blackbox/config.yml
command: --config.file=/blackbox/config.yml
depends_on:
- prometheus
# Aplicações
app-a:
container_name: app-a
build: ./app/
environment:
OTEL_SERVICE_NAME: app-a # Nome do serviço para o Span
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: http://tempo:4317 # Envia rastreamentos ao Grafana Tempo
OTEL_RESOURCE_ATTRIBUTES: compose_service=app-a # Nome customizado para o Grafana Tempo e Loki
OTEL_METRICS_EXPORTER: none # Desabilitado exportador de métricas
OTEL_LOGS_EXPORTER: none # Desabilitado exportador de logs da aplicação
MANAGEMENT_METRICS_TAGS_APPLICATION: app-a # Sobrescrever o valor padrão de "management.metrics.tags.application" localizado em "app/src/main/resources/application.properties"
TARGET_ONE_HOST: app-b
TARGET_TWO_HOST: app-c
OTEL_JAVAAGENT_LOGGING: application
depends_on:
- postgres
ports:
- 8080:8080
logging: *default-logging
app-b:
container_name: app-b
build: ./app/
environment:
OTEL_SERVICE_NAME: app-b
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: http://tempo:4317
OTEL_RESOURCE_ATTRIBUTES: compose_service=app-b
OTEL_METRICS_EXPORTER: none
OTEL_LOGS_EXPORTER: none
MANAGEMENT_METRICS_TAGS_APPLICATION: app-b
TARGET_ONE_HOST: app-b
TARGET_TWO_HOST: app-c
OTEL_JAVAAGENT_LOGGING: application
depends_on:
- postgres
ports:
- 8081:8080
logging: *default-logging
app-c:
container_name: app-c
build: ./app/
environment:
OTEL_SERVICE_NAME: app-c
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: http://tempo:4317
OTEL_RESOURCE_ATTRIBUTES: compose_service=app-c
OTEL_METRICS_EXPORTER: none
OTEL_LOGS_EXPORTER: none
MANAGEMENT_METRICS_TAGS_APPLICATION: app-c
TARGET_ONE_HOST: app-b
TARGET_TWO_HOST: app-c
OTEL_JAVAAGENT_LOGGING: application
depends_on:
- postgres
ports:
- 8082:8080
logging: *default-logging
postgres:
container_name: postgresql
image: postgres:16
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=postgres
ports:
- 5432:5432
logging: *default-logging
redis:
container_name: redis
image: redis:7.2.4
ports:
- 6379:6379
logging: *default-logging
# k6:
# container_name: k6
# image: grafana/k6:0.49.0
# volumes:
# - ./scripts/grafana-k6.js:/scripts/grafana-k6.js:ro
# command: run /scripts/grafana-k6.js
# depends_on:
# - app-a
# - app-b
# - app-c