-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathdocker-compose.observability.yml
More file actions
119 lines (112 loc) · 4.25 KB
/
docker-compose.observability.yml
File metadata and controls
119 lines (112 loc) · 4.25 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
# Observability overlay — use together with the base compose file:
# docker compose -f docker-compose.yml -f docker-compose.observability.yml up --build
#
# Adds: OTel Collector, Tempo, Loki, Prometheus, Grafana
# Configures the backend and frontend to export traces and metrics via OTLP.
---
services:
# ── Backend: inject OTel environment variables ─────────────────────────
backend:
# The base Dockerfile dev entrypoint omits --env-mode=loose, so turbo
# strips unknown env vars. Override it here so OTEL_* vars reach Node.
entrypoint: ["turbo", "run", "dev", "--filter=backend", "--env-mode=loose"]
environment:
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector:4318"
OTEL_SERVICE_NAME: "backend"
OTEL_RESOURCE_ATTRIBUTES: "service.version=0.1.0,deployment.environment=local"
depends_on:
otel-collector:
condition: service_started
# ── Frontend: inject OTel environment variables ────────────────────────
frontend:
# Same turbo --env-mode=loose fix so VITE_* vars reach the Vite dev server.
entrypoint: ["turbo", "run", "dev", "--filter=frontend", "--env-mode=loose"]
environment:
VITE_OTEL_ENDPOINT: "/otlp"
# ── OpenTelemetry Collector ────────────────────────────────────────────
otel-collector:
image: otel/opentelemetry-collector-contrib:0.96.0
command: ["--config=/etc/otelcol/config.yaml"]
ports:
- "4317:4317" # OTLP gRPC receiver
- "4318:4318" # OTLP HTTP receiver
- "9464:9464" # Prometheus metrics exporter
volumes:
- ./observability/otel-collector-config.yaml:/etc/otelcol/config.yaml:ro
depends_on:
tempo:
condition: service_started
loki:
condition: service_started
mongodb:
condition: service_healthy
networks:
- bt
restart: unless-stopped
# ── Grafana Loki (log aggregation) ─────────────────────────────────────
loki:
image: grafana/loki:3.0.0
command: ["-config.file=/etc/loki/config.yaml"]
ports:
- "${DEV_PORT_PREFIX:-30}11:3100"
volumes:
- ./observability/loki.yaml:/etc/loki/config.yaml:ro
- loki-data:/loki
networks:
- bt
restart: unless-stopped
# ── Grafana Tempo (distributed tracing backend) ────────────────────────
tempo:
image: grafana/tempo:2.4.1
command: ["-config.file=/etc/tempo/tempo.yaml"]
ports:
- "${DEV_PORT_PREFIX:-30}09:3200" # Tempo HTTP API (query traces)
volumes:
- ./observability/tempo.yaml:/etc/tempo/tempo.yaml:ro
- tempo-data:/tmp/tempo
networks:
- bt
restart: unless-stopped
# ── Prometheus ─────────────────────────────────────────────────────────
prometheus:
image: prom/prometheus:v2.51.0
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.retention.time=2h"
- "--web.enable-remote-write-receiver"
ports:
- "9090:9090"
volumes:
- ./observability/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus-data:/prometheus
depends_on:
otel-collector:
condition: service_started
networks:
- bt
restart: unless-stopped
# ── Grafana (dashboards + datasource exploration) ──────────────────────
grafana:
image: grafana/grafana:10.4.0
ports:
- "${DEV_PORT_PREFIX:-30}13:3000"
environment:
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: admin
GF_AUTH_ANONYMOUS_ENABLED: "true"
GF_AUTH_ANONYMOUS_ORG_ROLE: Admin
volumes:
- ./observability/grafana/provisioning:/etc/grafana/provisioning:ro
- grafana-data:/var/lib/grafana
depends_on:
- prometheus
- tempo
- loki
networks:
- bt
restart: unless-stopped
volumes:
loki-data:
tempo-data:
prometheus-data:
grafana-data: