Install Grafana on offline station with plugins

  • What Grafana version and what operating system are you using?
    Grafana 10.3.6, Ubuntu 20.04.6 LTS

  • What are you trying to achieve?
    Install Grafana and its plugins on an offline station.

  • How are you trying to achieve it?
    Build a custom Grafana image, using in Dockerfile command for plugin installation, like it define
    here

  • What happened?
    After the Helm installation, the plugin does not get installed, and the plugin files disappear from the container (custom Grafana image contains them)

  • What did you expect to happen?
    Plugin is installed with Grafana

  • Can you copy/paste the configuration(s) that you are having problems with?
    Dockerfile:

FROM grafana/grafana:10.3.6

# Remove / disable these to require authentication
ENV GF_AUTH_DISABLE_LOGIN_FORM "true"
ENV GF_AUTH_ANONYMOUS_ENABLED "true"
ENV GF_AUTH_ANONYMOUS_ORG_ROLE "Admin"

# Install a specific plugin
RUN grafana cli plugins install marcusolsson-json-datasource 1.3.12

USER grafana

ENTRYPOINT /bin/bash

I added following definitions to helm chart to avoid online signing and checks:

env: 
  GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: "marcusolsson-json-datasource"
  GF_PLUGINS_VERIFY_SIGNATURES: "false"

grafana.ini:
  paths:
    plugins: /var/lib/grafana/plugins
  analytics:
    check_for_updates: false
    check_for_plugin_updates: false
  plugins:
    public_key_retrieval_disabled: true

Grafana logs after installation, no errors exist in log file, it is running but no plugins were installed:

logger=settings t=2024-05-15T13:17:03.358987705Z level=info msg="Config overridden from command line" arg="default.paths.plugins=/var/lib/grafana/plugins"

logger=settings t=2024-05-15T13:17:03.359083404Z level=info msg="Config overridden from Environment variable" var="GF_PATHS_PLUGINS=/var/lib/grafana/plugins"

logger=settings t=2024-05-15T13:17:03.359314401Z level=info msg="Path Plugins" path=/var/lib/grafana/plugins

logger=plugin.store t=2024-05-15T13:17:06.440327823Z level=info msg="Loading plugins..."
logger=local.finder t=2024-05-15T13:17:06.461045698Z level=warn msg="Skipping finding plugins as directory does not exist" path=/usr/share/grafana/plugins-bundled
logger=plugin.store t=2024-05-15T13:17:06.461143886Z level=info msg="Plugins loaded" count=55 duration=20.816473ms

logger=context userId=0 orgId=1 uname= t=2024-05-15T13:18:27.550529428Z level=error msg="Could not find plugin definition for data source" datasource_type=marcusolsson-json-datasource

when I add to helm chart:

plugins: 
  - marcusolsson-json-datasource 1.3.14

Grafana is topped by error with log:

Error: ✗ Get "https://grafana.com/api/plugins/marcusolsson-json-datasource/versions": dial tcp: lookup grafana.com on 10.152.183.10:53: server misbehaving

Hi Community,

Did anyone have suggestions around this. I am also facing same problem.

its offline but your dockerfile has grafana cli install?

you need to have the unzipped plugin bundle in the root folder that you COPY like rest the yaml files

might also want to use infinity plugin for json stuff and avoid the unrecommended unsigned plugin settings

what specifically is the issue you are facing

Greetings,
I stumbled upon this discussion while facing a similar issue (building our own Grafana Docker image that includes certain plugins). To cut a long story short, what seems to be happening is:

  • the plugin gets fetched and stored successfully in the docker file
  • the helm deployment mounts a new emptyDir over /var/lib/grafana
  • this can be checked by editing the deployment and looking for entries in the volumeMounts and volumes sections - removing both configurations for the storage entry a new Pod comes up that now has the plugin present.

While I can edit the deployment manually after the fact, I haven’t been able to adjust the Helm chart itself to fix this (to prevent an emptyDir from being mounted to /var/lib/grafana). Thank you for your help in advance.

Edit / Update: In the end what worked for me was to update the configuration and point to a new plugins directory (/home/grafana/plugins) where I was able to place the plugins without them getting “mounted over”. Not the most elegant solution, I admit, but it works.