/grafana-dashboard-sync-plugin

A Grafana backend plugin for automatic synchronization of dashboard between multiple Grafana instances.

Primary LanguageGoApache License 2.0Apache-2.0

Grafana Dashboard Synchronization Backend Plugin

A Grafana backend plugin for automatic synchronization of dashboard between multiple Grafana instances.

This plugin can be used to synchronize dashboards via a Git repository.
A possible use case is: One Grafana instance is using the plugin to push dashboards to a Git repository, another Grafana instance is using it to pull the dashboards.
As an example this is useful to stage dashboards from "dev" to "prod" environments.

Getting started

A data source backend plugin consists of both frontend and backend components.

Frontend

  1. Install dependencies

    yarn install
  2. Build plugin in development mode or run in watch mode

    yarn dev

    or

    yarn watch
  3. Build plugin in production mode

    yarn build

Backend

  1. Update Grafana plugin SDK for Go dependency to the latest minor version:

    go get -u github.com/grafana/grafana-plugin-sdk-go
    go mod tidy
  2. Build backend plugin binaries for Linux, Windows and Darwin:

    mage -v
  3. List all available Mage targets for additional commands:

    mage -l

Local Development

Set environment variables

PLUGIN_REPO = local path to cloned repo
GIT_SSH_KEY = path to private git sshkey

Build frontend and backend and start docker-compose

docker-compose up 

Under datasources the Grafana Dashboard Plugin Sync should be available now

Releasing the Plugin

The release process of the plugin is automated using Github Actions. On each push to the main branch, a new prerelease is created and the corresponding commit is tagged "latest". Old prereleases will be deleted.

To create a normal release, the commit that is used as the basis for the release must be tagged with the following format: v*.*.*. After that, the release is built and created with the version number extracted from the tag. Furthermore, a new commit is created, which sets the current version in the main branch to the version that has been released.

Learn more