-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathdocker-compose.observability.yml
More file actions
222 lines (211 loc) · 6.42 KB
/
docker-compose.observability.yml
File metadata and controls
222 lines (211 loc) · 6.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
# Observability stack for Nexus (Issue #761)
#
# Deploys Grafana, Prometheus, Loki, Tempo, and Grafana Alloy alongside
# the Nexus server. All services share the `nexus-network` from the
# main docker-compose.yml.
#
# Usage:
# docker compose -f docker-compose.yml -f docker-compose.observability.yml up -d
#
# Or standalone (Nexus must already be running on nexus-network):
# docker compose -f docker-compose.observability.yml up -d
version: "3.8"
services:
# =========================================================================
# Nexus Server (extends base compose with observability env vars)
# =========================================================================
nexus-server:
environment:
- OTEL_ENABLED=true
- OTEL_EXPORTER_OTLP_ENDPOINT=http://tempo:4317
- OTEL_SERVICE_NAME=nexus
- NEXUS_ENV=prod
- PYROSCOPE_ENABLED=true
- PYROSCOPE_SERVER_ADDRESS=http://pyroscope:4040
networks:
- nexus-network
# =========================================================================
# Prometheus — Metric collection and storage
# =========================================================================
prometheus:
image: prom/prometheus:latest
container_name: nexus-prometheus
restart: unless-stopped
ports:
- "9090:9090"
volumes:
- ./observability/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus-data:/prometheus
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.retention.time=7d"
- "--web.enable-remote-write-receiver"
deploy:
resources:
limits:
memory: 512M
networks:
- nexus-network
profiles:
- observability
# =========================================================================
# Loki — Log aggregation
# =========================================================================
loki:
image: grafana/loki:3.0.0
container_name: nexus-loki
restart: unless-stopped
ports:
- "3100:3100"
volumes:
- ./observability/loki/loki.yml:/etc/loki/config.yaml:ro
- loki-data:/loki
command:
- "-config.file=/etc/loki/config.yaml"
deploy:
resources:
limits:
memory: 512M
networks:
- nexus-network
profiles:
- observability
# =========================================================================
# Tempo — Distributed tracing
# =========================================================================
tempo:
image: grafana/tempo:latest
container_name: nexus-tempo
restart: unless-stopped
ports:
- "3200:3200" # Tempo HTTP API
- "4317:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP HTTP receiver
volumes:
- ./observability/tempo/tempo.yml:/etc/tempo/config.yaml:ro
- tempo-data:/tmp/tempo
command:
- "-config.file=/etc/tempo/config.yaml"
deploy:
resources:
limits:
memory: 512M
networks:
- nexus-network
profiles:
- observability
# =========================================================================
# Grafana — Visualization and dashboards
# =========================================================================
grafana:
image: grafana/grafana:latest
container_name: nexus-grafana
restart: unless-stopped
ports:
- "3000:3000"
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=nexus
- GF_USERS_ALLOW_SIGN_UP=false
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Viewer
volumes:
- ./observability/grafana/provisioning:/etc/grafana/provisioning:ro
- grafana-data:/var/lib/grafana
deploy:
resources:
limits:
memory: 256M
networks:
- nexus-network
depends_on:
- prometheus
- loki
- tempo
- pyroscope
profiles:
- observability
# =========================================================================
# Grafana Alloy — Log collection agent (Promtail successor)
# =========================================================================
alloy:
image: grafana/alloy:latest
container_name: nexus-alloy
restart: unless-stopped
ports:
- "12345:12345" # Alloy UI
volumes:
- ./observability/alloy/config.alloy:/etc/alloy/config.alloy:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
command:
- "run"
- "/etc/alloy/config.alloy"
- "--server.http.listen-addr=0.0.0.0:12345"
deploy:
resources:
limits:
memory: 128M
networks:
- nexus-network
depends_on:
- loki
profiles:
- observability
# =========================================================================
# postgres_exporter — PostgreSQL metrics for Prometheus (Issue #762)
# =========================================================================
postgres-exporter:
image: quay.io/prometheuscommunity/postgres-exporter:latest
container_name: nexus-postgres-exporter
restart: unless-stopped
environment:
DATA_SOURCE_NAME: "postgresql://nexus_monitor:${POSTGRES_EXPORTER_PASSWORD:-nexus_monitor}@postgres:5432/${POSTGRES_DB:-nexus}?sslmode=disable"
command:
- "--collector.stat_statements"
- "--collector.stat_activity"
- "--collector.stat_bgwriter"
- "--collector.stat_database"
- "--collector.stat_user_tables"
- "--collector.locks"
- "--collector.wal"
ports:
- "9187:9187"
deploy:
resources:
limits:
memory: 128M
networks:
- nexus-network
profiles:
- observability
# =========================================================================
# Pyroscope — Continuous profiling (Issue #763)
# =========================================================================
pyroscope:
image: grafana/pyroscope:1.16.1
container_name: nexus-pyroscope
restart: unless-stopped
ports:
- "4040:4040"
volumes:
- ./observability/pyroscope/pyroscope.yml:/etc/pyroscope/config.yaml:ro
- pyroscope-data:/data
command:
- "-config.file=/etc/pyroscope/config.yaml"
deploy:
resources:
limits:
memory: 512M
networks:
- nexus-network
profiles:
- observability
volumes:
prometheus-data:
loki-data:
tempo-data:
pyroscope-data:
grafana-data:
networks:
nexus-network:
external: true