A homelab that runs well produces data: CPU, memory, disk, temperature, container restarts, network throughput. Staring at htop on six machines tells you nothing about trends. Grafana is the tool that turns that data into dashboards, alerts, and graphs you can actually reason about — and running it yourself takes one Compose file and about twenty minutes.
This guide covers a production-sane Grafana deployment with Docker Compose: persistent storage, environment-based configuration, HTTPS through a reverse proxy, a Prometheus data source, and a first dashboard. Everything follows the official Grafana Docker documentation.
Grafana OSS vs Enterprise: which image?
The official docs describe two editions:
grafana/grafana— the open-source edition (the classic choice).grafana/grafana-enterprise— the Enterprise edition, which the docs note is the recommended default and is free; it includes all OSS features plus optional enterprise plugins, with paid support available as an upgrade.
Functionally, for a homelab, both are free to run and nearly identical. Choose grafana-enterprise if you want the option of enterprise plugins or support later without changing images; choose grafana/grafana if you prefer the pure OSS path. Everything in this guide works with either — swap the image name and nothing else changes.
What you need
A host with Docker and Docker Compose, 1 GB of RAM beyond your other workloads (Grafana itself is modest), a DNS record such as grafana.example.com, and ideally a reverse proxy already terminating HTTPS. Grafana stores its own SQLite database in its data directory, so persistence is a volume question, not a database-server question.
Where Grafana gets its data is a separate decision. Common sources in a homelab:
- Prometheus — the standard for node and container metrics (via node_exporter and cAdvisor).
- InfluxDB — popular for IoT and Telegraf setups.
- Loki — log aggregation from Grafana’s own ecosystem.
- Your existing tools — Uptime Kuma exposes a Prometheus-compatible metrics endpoint, and Proxmox, pfSense, and Home Assistant all have community data source plugins.
This guide uses Prometheus for the data source examples because it is the most common pairing, but the dashboard workflow is identical for any source.
Compose file with persistent storage
The official documentation recommends Docker volumes for persistence — Grafana’s SQLite database, dashboards, and plugin state live in /var/lib/grafana, and without a volume they vanish when the container is removed. Here is the Compose file:
services:
grafana:
image: grafana/grafana:12.1.1
container_name: grafana
restart: unless-stopped
environment:
- GF_SERVER_ROOT_URL=https://grafana.example.com
- GF_SECURITY_ADMIN_PASSWORD=change-me-before-first-login
ports:
- "3111:3000"
volumes:
- grafana-storage:/var/lib/grafana
volumes:
grafana-storage: {}
Decisions worth understanding:
- Pinned version tag. The official docs show
grafana/grafana-enterpriseunpinned for evaluation; for a data-holding service, pin a specific version (check Grafana releases for the current stable release) and upgrade deliberately. GF_SERVER_ROOT_URL. Must match the public URL, or OAuth callbacks, password-reset emails, and some links will point to the wrong host.GF_SECURITY_ADMIN_PASSWORD. Sets the initial admin password. If you skip it, the default isadminand Grafana forces a change at first login. Either way, change it immediately and never reuse it elsewhere. Better: leave it unset for first login, change it in the UI, then remove any plaintext password from the Compose file.- Host port 3111. Any free high port; never expose 3000 directly to the internet.
Start it:
mkdir -p ~/docker/grafana && cd ~/docker/grafana
# create docker-compose.yaml with the content above
docker compose up -d
docker compose ps
docker compose logs --tail=50 grafana
Grafana takes a few seconds to become ready. http://SERVER_IP:3111 should show the login page — for local testing only; the public route should be HTTPS via your proxy.
Configuration beyond the basics
Grafana reads every setting from environment variables with the GF_ prefix, following the pattern GF_<SECTION>_<KEY>. The ones homelab operators most often need:
environment:
- GF_SERVER_ROOT_URL=https://grafana.example.com
- GF_USERS_ALLOW_SIGN_UP=false
- GF_USERS_DEFAULT_THEME=dark
- GF_ANALYTICS_REPORTING_ENABLED=false
- GF_SECURITY_DISABLE_GRAVATAR=true
- GF_PLUGINS_PREINSTALL=grafana-clock-panel
GF_USERS_ALLOW_SIGN_UP=false stops visitors from self-registering — the first thing to set before any public exposure. GF_PLUGINS_PREINSTALL installs plugins at container start (the official docs show installing multiple with a comma-separated list, and pinning versions as [email protected]).
Configuration you would rather keep in files instead of env vars goes in a mounted provisioning directory:
volumes:
- grafana-storage:/var/lib/grafana
- ./provisioning:/etc/grafana/provisioning
Provisioning lets you declare data sources and dashboards as code — worth doing once you have more than two or three.
HTTPS with a reverse proxy
Put Grafana behind the Caddy reverse proxy you may already run:
grafana.example.com {
reverse_proxy 127.0.0.1:3111
}
Two notes for other proxies, straight from common Grafana deployment experience: set forwarded headers correctly (X-Forwarded-Proto and X-Forwarded-Host) so Grafana generates correct absolute URLs, and if you see mixed-content warnings or redirect loops, the almost-always-cause is GF_SERVER_ROOT_URL disagreeing with what the proxy sends.
After HTTPS works, log in through the public URL, change the admin password, and confirm GF_SERVER_ROOT_URL matches — the browser address bar and the URLs Grafana generates for sharing should agree.
Add Prometheus as a data source
If you already run Prometheus (with node_exporter on each machine you want graphs for), adding it to Grafana is two fields: Connections → Data sources → Prometheus, URL http://prometheus:9090 (service name if in the same Docker network, host IP otherwise), Save & Test.
No Prometheus yet? The fastest path is adding it to the same Compose project:
services:
prometheus:
image: prom/prometheus:v3.3.1
container_name: prometheus
restart: unless-stopped
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus-data:/prometheus
ports:
- "9090:9090"
volumes:
prometheus-data: {}
With a minimal prometheus.yml scraping node_exporter on your hosts:
global:
scrape_interval: 15s
scrape_configs:
- job_name: "nodes"
static_configs:
- targets: ["192.168.1.10:9100", "192.168.1.11:9100"]
Restart the stack, then add http://prometheus:9090 as the Grafana data source. Grafana discovers it on the shared Compose network by service name.
Build your first dashboard
Import before you build: Grafana’s dashboard library has ready-made panels for nearly every exporter. Dashboards → New → Import, enter a dashboard ID from grafana.com/grafana/dashboards — the Node Exporter Full dashboard (ID 1860) is the standard starting point for Prometheus + node_exporter, and community dashboards exist for Proxmox, TrueNAS, pfSense, Docker (cAdvisor), and Home Assistant.
Importing ID 1860, selecting your Prometheus data source, gives you an immediately useful host dashboard: CPU per core, memory breakdown, disk I/O, filesystem usage, and network throughput, all with sensible defaults. From there, customization is a matter of deleting panels you don’t care about and adding ones you do.
For a home dashboard of your own, the useful queries tend to be boring and durable:
100 - (avg by(instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100)— CPU usage per host.(1 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes)) * 100— memory usage percentage.(1 - node_filesystem_avail_bytes{mountpoint="/"} / node_filesystem_size_bytes{mountpoint="/"}) * 100— root disk usage.
Set each panel’s unit (percent, bytes/sec) and Grafana’s display handles the rest.
Alerts: from graphs to notifications
A dashboard you don’t watch is decoration. Grafana’s alerting evaluates PromQL (or any data source query) on a schedule and notifies when conditions breach. The alerting setup: Alerting → Alert rules → New alert rule, pick a query (for example, root disk usage above 90 for 10 minutes), set an evaluation interval, then attach a contact point.
Contact points are where your own ntfy server (or any webhook inbox you self-host) shines: Grafana speaks generic webhooks, and a small relay script can translate a Grafana webhook POST into an ntfy publish, so hardware alerts arrive on your phone through infrastructure you own. Grafana also natively supports email, Telegram, and Discord contact points if you prefer those channels.
Test the full path with a deliberately silly rule (CPU above 0% for 1 minute) before trusting it for real ones. An alert pipeline you have never seen fire is a pipeline you cannot rely on.
Backups and upgrades
Grafana’s state — users, dashboards, data sources, alert rules — lives in the SQLite database inside the grafana-storage volume. Back it up with the container stopped or Grafana’s built-in command:
docker compose exec grafana grafana-cli --homepath /usr/share/grafana admin data:export
In practice, a periodic filesystem snapshot of the volume plus the Compose file in version control covers most homelab needs; fold the volume into your existing restic backup routine.
Upgrades are the standard Docker dance, but for a stateful service read the changelog first and take a backup before pulling a new major version:
docker compose pull
docker compose up -d
docker compose logs --tail=50 grafana
Pin the version tag in the Compose file rather than using latest, and move it forward deliberately. Grafana’s major-version migrations have historically been smooth, but your dashboards are an asset — treat upgrades like you treat database upgrades, not like a stateless container restart.
FAQ
Is Grafana free for personal use?
Yes. Grafana OSS is free and open source, and Grafana Enterprise is free to self-host with all OSS features included; paid tiers cover support and enterprise plugins. There is no per-dashboard or per-user licensing to worry about in a homelab.
Do I need Prometheus to use Grafana?
No. Grafana is data-source agnostic — InfluxDB, Loki, PostgreSQL, CloudWatch, and dozens of others all work. Prometheus is just the most common pairing for server and container metrics. If your existing monitoring tool exposes Prometheus-format metrics, Grafana can read it.
Where are my dashboards stored?
In Grafana’s SQLite database in the /var/lib/grafana volume. That is why the volume is non-negotiable — without it, every dashboard dies with the container. For infrastructure-as-code, use provisioning or export dashboards as JSON.
Can I use it on a Raspberry Pi?
Yes — Grafana publishes ARM images, and a Pi 4 handles a small homelab dashboard comfortably. The data store (Prometheus, InfluxDB) is what needs resources; keep the retention window short on low-memory hosts.
How do I share a dashboard without exposing everything?
Grafana supports organizations, teams, and per-dashboard permissions. For public sharing of a single panel, snapshot sharing generates a static, point-in-time image — no live data access. Never expose anonymous access (GF_AUTH_ANONYMOUS_ENABLED=true) on a public host.
Grafana rewards a small upfront investment: one Compose file, one volume, one data source, and suddenly six months of infrastructure history is a graph you can zoom into. Start with an imported dashboard, add the alerts that would have saved you the last 3 a.m. surprise, and let the metrics accumulate — the value compounds the longer it runs.