feat(observability): persist standalone stack data and expose ports via env

- Switch docker-compose.observability.yml from named volumes to host
  bind mounts under OBSERVABILITY_DATA_ROOT, defaulting to
  ./observability-data.
- Make all service ports configurable via environment variables
  (PROMETHEUS_PORT, LOKI_PORT, ALLOY_PORT, GRAFANA_PORT,
  ALERTMANAGER_PORT, NODE_EXPORTER_PORT).
- Add VITE_GRAFANA_URL handling to ObservabilityPage so Grafana links
  point to the configured standalone instance.
- Update docs/observability-runbooks.md with the env variable table,
  reachable-web-UI table, and backup/restore instructions for the new
  host-directory layout.
This commit is contained in:
Developer
2026-06-16 15:37:41 +00:00
parent e783d2c07b
commit 53dcd16735
3 changed files with 140 additions and 67 deletions
+14 -15
View File
@@ -4,6 +4,8 @@
# Alloy and Node Exporter without the rest of Manage. It exposes the usual
# ports directly; no Traefik or OIDC integration is required.
#
# cp .env.example .env
# # optionally edit OBSERVABILITY_* paths and ports
# docker compose -f docker-compose.observability.yml up -d
#
# Then open Grafana at http://localhost:3000 (admin / admin by default).
@@ -27,9 +29,9 @@ services:
- ./monitoring/prometheus/prometheus.standalone.yml:/etc/prometheus/prometheus.yml:ro
- ./monitoring/prometheus/rules:/etc/prometheus/rules:ro
- ./monitoring/prometheus/file-sd:/etc/prometheus/file-sd:ro
- prometheus_data:/prometheus
- ${OBSERVABILITY_DATA_ROOT:-./observability-data}/prometheus:/prometheus
ports:
- "9090:9090"
- "${PROMETHEUS_PORT:-9090}:9090"
networks:
- monitoring
restart: unless-stopped
@@ -54,9 +56,9 @@ services:
command: -config.file=/etc/loki/loki.yml
volumes:
- ./monitoring/loki/loki.yml:/etc/loki/loki.yml:ro
- loki_data:/loki
- ${OBSERVABILITY_DATA_ROOT:-./observability-data}/loki:/loki
ports:
- "3100:3100"
- "${LOKI_PORT:-3100}:3100"
networks:
- monitoring
restart: unless-stopped
@@ -86,6 +88,9 @@ services:
- ./monitoring/alloy/config.alloy:/etc/alloy/config.alloy:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- ${OBSERVABILITY_DATA_ROOT:-./observability-data}/alloy:/var/lib/alloy
ports:
- "${ALLOY_PORT:-12345}:12345"
networks:
- monitoring
depends_on:
@@ -123,9 +128,9 @@ services:
volumes:
- ./monitoring/grafana/grafana.ini:/etc/grafana/grafana.ini:ro
- ./monitoring/grafana/provisioning:/etc/grafana/provisioning:ro
- grafana_data:/var/lib/grafana
- ${OBSERVABILITY_DATA_ROOT:-./observability-data}/grafana:/var/lib/grafana
ports:
- "3000:3000"
- "${GRAFANA_PORT:-3000}:3000"
networks:
- monitoring
depends_on:
@@ -164,9 +169,9 @@ services:
ALERT_EMAIL_TO: ${ALERT_EMAIL_TO:-admin@example.com}
volumes:
- ./monitoring/alertmanager/alertmanager.yml:/etc/alertmanager/alertmanager.yml:ro
- alertmanager_data:/alertmanager
- ${OBSERVABILITY_DATA_ROOT:-./observability-data}/alertmanager:/alertmanager
ports:
- "9093:9093"
- "${ALERTMANAGER_PORT:-9093}:9093"
networks:
- monitoring
restart: unless-stopped
@@ -193,7 +198,7 @@ services:
volumes:
- /:/host:ro,rslave
ports:
- "9100:9100"
- "${NODE_EXPORTER_PORT:-9100}:9100"
networks:
- monitoring
restart: unless-stopped
@@ -214,9 +219,3 @@ services:
networks:
monitoring:
volumes:
prometheus_data:
loki_data:
grafana_data:
alertmanager_data: