Metrics and a Homepage
I added metrics and a homepage dashboard to a small VPS already running a Git forge, an RSS reader, and a password vault. Grafana gives me historical data, while the homepage shows service status at a glance. Together they use about 250 MB of resident memory on a machine with 3.7 GB of RAM.
VictoriaMetrics instead of Prometheus
I chose VictoriaMetrics because it accepts Prometheus queries and scrape
configurations, and Grafana can use it as a Prometheus data source. On this
workload it uses about 157 MB of resident memory. Retention is set with one
flag: -retentionPeriod=6 keeps six months, which amounts to tens of megabytes
for one node scraped every 30 seconds.
The scrape and dashboard configuration should look familiar if you have used Prometheus.
Binding the metrics stack to loopback
All three components use network_mode: host and bind their own loopback
addresses:
victoriametrics:
image: victoriametrics/victoria-metrics:v1.112.0
network_mode: host
command:
- '-httpListenAddr=127.0.0.1:8428'
- '-promscrape.config=/etc/prometheus.yml'
- '-retentionPeriod=6'
node-exporter:
image: prom/node-exporter:v1.9.1
network_mode: host
pid: host
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--web.listen-address=127.0.0.1:9100'
- '--path.procfs=/host/proc'
- '--path.sysfs=/host/sys'
- '--path.rootfs=/rootfs'
grafana:
image: grafana/grafana:11.6.1
network_mode: host
environment:
- GF_SERVER_HTTP_ADDR=127.0.0.1
- GF_SERVER_HTTP_PORT=3001
- GF_SERVER_ROOT_URL=https://metrics.example.com
- GF_USERS_ALLOW_SIGN_UP=false
With bridge networking, each container has its own loopback address. The
127.0.0.1 endpoints below would therefore not reach the other services. I used
host networking with explicit loopback binds to keep the setup simple. nginx
provides public access where needed.
Each service needs an explicit listen address. Their defaults bind to 0.0.0.0,
which would expose them on the host’s network interfaces.
The Grafana data directory also needs to be owned by UID 472, the user used by
the official image. Otherwise Grafana cannot create its SQLite database. For
node_exporter queries, the root filesystem label remains mountpoint="/" even
with --path.rootfs=/rootfs. My first panel queried /rootfs and returned no
data.
Provisioning dashboards from files
Datasource and dashboards as files, so the whole thing is reproducible:
# provisioning/datasources/vm.yml
apiVersion: 1
datasources:
- name: VictoriaMetrics
type: prometheus
access: proxy
uid: victoriametrics
url: http://127.0.0.1:8428
isDefault: true
Every panel in the dashboard JSON references {"type": "prometheus", "uid": "victoriametrics"}. That UID must match the provisioned data source. When it
does not, panels can appear empty without a useful error.
Setting credentials before public access
Grafana initially uses admin/admin. I change that before exposing it.
Certificate issuance makes the hostname discoverable through public Certificate
Transparency logs; on this host, automated probes arrived within minutes.
A publicly reachable setup page can be found before I share its URL. I set credentials before enabling public access, especially for services where the first registered user becomes the administrator.
Keep password changes consistent with GF_SECURITY_ADMIN_PASSWORD if it is set
in the Compose configuration. An old value left there can conflict with how you
intend to manage the admin password.
The homepage layer
I also run Glance for service status, RSS feeds, repository releases, bookmarks, and host statistics. It uses about 8 MB of resident memory.
Two setup details caused problems:
Set server.host to 0.0.0.0 inside the container. The default of
localhost binds the container's own loopback, which makes a published port
unreachable. Docker does the loopback restriction from the outside; the app should
not.
Validate the config before restarting. Glance refuses to start with an invalid configuration. I run the validator against the config directory before replacing the running container:
docker run --rm -v /path/to/config:/app/config:ro glanceapp/glance config:validate
The validator produces no output for a valid configuration. It reports one error at a time with a line number. It caught an indentation error and two widget types that were documented but absent from my installed release. I checked the binary to see which names it supported:
docker run --rm --entrypoint sh glanceapp/glance -c \
'strings "$(command -v glance)" | grep -oE "\b(rss|monitor|todo|calendar-legacy)\b" | sort -u'
Also set slug: explicitly on every page. Auto-derived slugs from titles
containing punctuation do not produce the URL you would guess, and the page 404s
while the root still works.
Almost every widget needs outbound network
Most Glance widgets fetch data over HTTP from inside the container. An unrelated firewall problem on this host blocked container egress, leaving clocks and bookmarks visible while feeds, release lists, weather, and monitors stayed empty.
If widgets are uniformly empty, test the container's network before reading any config:
docker exec glance sh -c 'wget -q -T 8 -O /dev/null https://api.github.com && echo OK || echo FAIL'