Skip to content

feat: Grafana image with bundled plugins only - #99

Merged
DavidePrincipi merged 3 commits into
mainfrom
feat-8210-plugins
Oct 14, 2026
Merged

DavidePrincipi merged 3 commits into
mainfrom
feat-8210-plugins

Conversation

@DavidePrincipi

@DavidePrincipi DavidePrincipi commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

At every startup Grafana downloads a default set of plugins from grafana.com into its data volume and keeps them updated. The downloaded copies replace the plugins bundled in the Grafana image, so plugin versions drift from the module release and are harder to track for vulnerabilities. Behind a DNS (Domain Name System) blocker like Pi-hole, each start also generates about 36 failed lookups for grafana.com. NethServer/dev#8210

With this PR Grafana uses only the plugins shipped with its image, and plugin versions change only with a module release. The module now builds its own Grafana image, ghcr.io/nethserver/metrics-grafana, which adds the Logs Drilldown and Metrics Drilldown apps to the data sources bundled by Grafana. Other apps (Traces Drilldown, Pyroscope, Advisor) are no longer available, and plugins cannot be installed from the Grafana catalog. Administrators can allow plugin installs again through PODMAN_RUN_OPTS. Prometheus and Alertmanager are now pulled from docker.io/prom instead of quay.io.

  • grafana/Containerfile: Grafana 13.2.3 plus both apps at pinned versions; bundled plugin directories are read-only, because Grafana deletes a bundled plugin when it installs a newer copy
  • build-images.sh and grafana/check-plugins.sh: after the build, Grafana runs in a temporary container and must load every bundled plugin with a valid Grafana Labs signature, otherwise the build fails and prints the relevant log lines. This catches altered packages and apps not compatible with the Grafana version
  • grafana.service and update-module.d: run METRICS_GRAFANA_IMAGE with plugin preinstall and catalog installs disabled (both overridable); on update, remove every plugin from the grafana-data volume and the previous upstream Grafana image
  • renovate.json: Renovate updates Grafana and the apps together in one pull request, with no manual step

How to test

  • Install the module on a node where an older release already ran Grafana with internet access, so grafana-data/plugins contains the downloaded plugins, then update to this build
  • Check that the volume plugins directory is empty and that Grafana runs from metrics-grafana, with dashboards and data sources working
  • Check that Logs Drilldown and Metrics Drilldown are listed and open, and that Administration > Plugins does not offer installs
  • Check that Grafana's log has no plugin.backgroundinstaller or grafana.com lines, and that the old GRAFANA_IMAGE variable and image are gone

On a test node, a simulated update (new unit and update steps run by hand, image built locally) passed these checks, and the build-time check passed on the good image and failed on an image with one altered app file. A real update from the registry is still to be done.

See also


Generated by Claude Code:claude-opus-5.5 with nethserver-pr

At every startup Grafana downloads a default set of plugins from
grafana.com into its data volume and updates them, replacing the
plugins bundled in the image. Plugin versions then drift from the
module release and are harder to track for vulnerabilities, and the
downloads generate traffic to grafana.com.

Disable the preinstall, so only the plugins bundled in the Grafana
image are used. On update, remove the plugins Grafana already
downloaded, unless the administrator enabled the preinstall again
through PODMAN_RUN_OPTS. Apps that are not bundled, like Logs
Drilldown, are no longer available.

Assisted-by: Claude Code:claude-opus-5.5
@DavidePrincipi DavidePrincipi self-assigned this Oct 13, 2026
A fixed list of preinstalled plugins misses plugins added by future
Grafana releases and leaves any other plugin in the data volume. Since
Grafana must use only the plugins bundled in its image, remove every
plugin found in the volume on update.

Also disable plugin installs from the Grafana catalog, so the UI cannot
install plugins that the next update would remove. Both settings can
be reverted through PODMAN_RUN_OPTS, and then the cleanup is skipped.

Assisted-by: Claude Code:claude-sonnet-5.5
@DavidePrincipi DavidePrincipi changed the title feat: disable Grafana plugin preinstall feat: Grafana uses only bundled plugins Oct 13, 2026

@gsanchietti gsanchietti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not like it much because sometimes Drilldown (and even Logs) is usefull to explore existing data.

Can u please add them?

@DavidePrincipi DavidePrincipi changed the title feat: Grafana uses only bundled plugins feat: Grafana image with bundled plugins only Oct 14, 2026
With plugin downloads disabled, the Logs Drilldown and Metrics
Drilldown apps are no longer installed at runtime. Build a Grafana
image that bundles both apps at pinned versions, so they stay
available and are updated only with the module.

After the build, start Grafana from the image in a temporary container
and check that it loads every bundled plugin with a valid signature
made by Grafana Labs. The build fails if a plugin is altered, or not
compatible with the Grafana version of the image. Renovate updates
Grafana and the apps in one pull request, with no manual step.

The bundled plugin directories are made read-only, because Grafana
deletes a bundled plugin when it installs a newer copy. On update,
remove the upstream Grafana image of the previous release.

Also pull the Prometheus and Alertmanager images from Docker Hub
(docker.io/prom) instead of quay.io.

Assisted-by: Claude Code:claude-opus-5.5

@gsanchietti gsanchietti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding back the plugins.
It's seem a bit too much of work to me, so feel free to remove them and keep only the first commit.

@DavidePrincipi

Copy link
Copy Markdown
Member Author

I will keep separate commits, so they'll be easy to revert in the future.

@DavidePrincipi
DavidePrincipi merged commit 1d5f6d8 into main Oct 14, 2026
5 checks passed
@DavidePrincipi
DavidePrincipi deleted the feat-8210-plugins branch October 14, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants