Package a plugin

You’ve just built your first plugin, and now you want to share it with the world. In this guide, you’ll learn how to package and share your plugin with others.

For Grafana to be able to load a plugin, it first needs to be built. When you build a plugin from source, a dist directory is created that contains the production build, or plugin assets, for your plugin.

When the Grafana server starts, it recursively looks in the plugin directory for any directory that contains a plugin.json file and tries to load the plugin assets in the same directory.

There are three steps needed to package a plugin:

  • Building the plugin
  • Signing the plugin
  • Archiving the plugin
  1. Build the plugin

    1. yarn install --pure-lockfile
    2. yarn build
  2. (Optional) If your data source plugin has a backend plugin, build it as well.

    1. mage
  3. Sign the plugin.

  4. Create a ZIP archive of the dist directory.

    1. mv dist/ myorg-simple-panel
    2. zip myorg-simple-panel-1.0.0.zip myorg-simple-panel -r

Publish your plugin on Grafana.com

The best way to share your plugin with the world is to publish it on Grafana Plugins. By having your plugin published on Grafana.com, more users will be able to discover your plugin.

To publish a plugin to Grafana Plugins, create a pull request to the Grafana Plugin Repository. Please note that both the source code and the packaged plugin archive need to be publicly available.