-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
107 lines (102 loc) · 3.6 KB
/
Copy pathdocker-compose.yml
File metadata and controls
107 lines (102 loc) · 3.6 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
# Full-stack: exporter + Prometheus + Grafana with the GPON dashboard
# auto-provisioned. For users who don't already run their own observability
# infra. Bring up with:
#
# cp .env.example .env # then fill in ONU_SSH_PASSWORD
# docker compose up -d
#
# Then open http://localhost:3000 (admin / admin by default, change via
# GRAFANA_ADMIN_PASSWORD in .env). The GPON dashboard is in the
# dashboards list on first login.
#
# If you ALREADY run Prometheus + Grafana, use docker-compose.exporter-only.yml
# instead and wire the exporter into your existing scrape config.
services:
gpon-exporter:
# Pulls the published image. Until v1.1 ships to ghcr.io, this will
# fail to pull -- run `docker compose build gpon-exporter` first to
# build from local source.
image: ghcr.io/strykar/gpon-exporter:latest
build: .
container_name: gpon-exporter
restart: unless-stopped
# No host port mapping: Prometheus reaches the exporter over the
# internal docker network (gpon-exporter:8114). Add `ports:` if you
# want to scrape from outside this stack.
expose:
- "8114"
environment:
- ONU_SSH_PASSWORD
- ONU_USER
- ONU_HOST
- ONU_PORT
command: >
--device ${ONU_USER:-admin}@${ONU_HOST}:${ONU_PORT:-22}
--webserver-port 8114
--bind-address 0.0.0.0
--known-hosts ''
mem_limit: 128m
cpus: 0.5
prometheus:
image: prom/prometheus:v3.0.1
container_name: gpon-prometheus
restart: unless-stopped
# 127.0.0.1 by default so the Prometheus UI isn't exposed on the
# network. Switch to "9090:9090" if you want to hit it from another
# machine on the LAN.
ports:
- "127.0.0.1:9090:9090"
volumes:
- ./compose/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--storage.tsdb.retention.time=30d'
- '--web.enable-lifecycle'
depends_on:
- gpon-exporter
# Init container: substitutes the dashboard's ${DS_PROMETHEUS} datasource
# placeholder with the literal UID of the provisioned datasource
# ("prometheus" -- see compose/grafana/provisioning/datasources/).
# Without this, panels render "Datasource ${DS_PROMETHEUS} was not
# found" because Grafana doesn't process the dashboard's __inputs
# block when provisioning from disk -- only when importing through
# the UI.
#
# Runs once and exits; grafana waits for service_completed_successfully.
dashboard-provision:
image: alpine:3.21
container_name: gpon-dashboard-provision
command: >
sh -c "sed 's/\$${DS_PROMETHEUS}/prometheus/g'
/input/dashboard.json > /output/gpon.json"
volumes:
- ./dashboard.json:/input/dashboard.json:ro
- grafana_dashboards:/output
restart: "no"
grafana:
image: grafana/grafana:11.4.0
container_name: gpon-grafana
restart: unless-stopped
ports:
- "127.0.0.1:3000:3000"
environment:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD:-admin}
- GF_USERS_ALLOW_SIGN_UP=false
- GF_AUTH_ANONYMOUS_ENABLED=false
- GF_ANALYTICS_REPORTING_ENABLED=false
- GF_ANALYTICS_CHECK_FOR_UPDATES=false
volumes:
- ./compose/grafana/provisioning:/etc/grafana/provisioning:ro
- grafana_dashboards:/var/lib/grafana/dashboards:ro
- grafana_data:/var/lib/grafana
depends_on:
dashboard-provision:
condition: service_completed_successfully
prometheus:
condition: service_started
volumes:
prometheus_data:
grafana_dashboards:
grafana_data: