You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 31, 2025. It is now read-only.
A Grafana backend plugin for automatic synchronization of dashboard between multiple Grafana instances.
3
+
A small CLI tool to do a tag-base automatic synchornization and backup Grafana of dashboards across multiple Grafana instances.
4
+
5
+
This application can be used to synchronize dashboards, using a Git repository, across multiple Grafana instances.
6
+
A possible use case is: push Grafana dashboards from one Grafana instance to a Git repository and import them into another Grafana instance. In addition, users can use tags to determine for themselves when a dashboard should be synchronized.
4
7
5
-
This plugin can be used to synchronize dashboards via a Git repository.
6
-
A possible use case is: One Grafana instance is using the plugin to push dashboards to a Git repository,
7
-
another Grafana instance is using it to pull the dashboards.
8
8
As an example this is useful to stage dashboards from "dev" to "prod" environments.
9
9
10
-
## Getting started
10
+
## Usage
11
11
12
-
A data source backend plugin consists of both frontend and backend components.
12
+
The application can be used as follows:
13
13
14
-
### Frontend
14
+
$ ./grafana-dashboard-synchronizer [options]
15
15
16
-
1. Install dependencies
16
+
By default, the application will use a configuration file named `configuration.yml` next to the binary. A custom configuration file can be used using the `--config` or `-c` option flag:
2. Build plugin in development mode or run in watch mode
20
+
In addition, a dry-run flag can be used. When the `--dry-run` flag is used, the application does not perform any modifications. This can be useful when testing what changes would be made.
23
21
24
-
```bash
25
-
yarn dev
26
-
```
22
+
$ ./grafana-dashboard-synchronizer --dry-run
27
23
28
-
or
24
+
By default, the application logs in an easy-to-read text format. With the `--log-as-json` flag, the application generates logs in JSON format, which is convenient if the logs are processed by other tools such as Logstash:
The configuration file can contain multiple jobs, which will be sequentially executed. Furthermore, the push (export) step of a job is executed before its pull (import) step.
39
+
40
+
See the following configuration for available configuration options:
39
41
40
-
### Backend
42
+
- job-name: "example-job"
43
+
# API token to interact with the specified Grafana instance
44
+
grafana-token: "eyJrIjoiSEp4dzhGdVBxMUhBdm..."
45
+
# Base URL of the Grafana instance
46
+
grafana-url: "http://localhost:3000"
47
+
# SSH-URL of the Git repository to use
48
+
git-repository-url: "<GIT_REPOSITORY_URL>"
49
+
# Private key to use for authentication against the Git repository
50
+
private-key-file: "<PRIVATE_SSH_KEY>"
41
51
42
-
1. Update [Grafana plugin SDK for Go](https://grafana.com/docs/grafana/latest/developers/plugins/backend/grafana-plugin-sdk-for-go/) dependency to the latest minor version:
52
+
# push (export) related configurations
53
+
push-configuration:
54
+
# whether to export dashboards
55
+
enable: true
56
+
# the branch to use for exporting dashboards
57
+
git-branch: "push-branch"
58
+
# only dashboards with match this pattern will be considered in the sync process
59
+
filter: ""
60
+
# the tag to determine which dashboards should be exported
61
+
tag-pattern: "agent"
62
+
# whether the sync-tag should be kept during exporting
63
+
push-tags: true
64
+
65
+
# pull (import) related configurations
66
+
pull-configuration:
67
+
# whether to import dashboards
68
+
enable: true
69
+
# the branch to use for importing dashboards
70
+
git-branch: "pull-branch"
71
+
# only dashboards with match this pattern will be considered in the sync process
72
+
filter: ""
73
+
74
+
## Development
75
+
76
+
### Getting started
77
+
78
+
1. Update and get dependencies:
43
79
44
80
```bash
45
-
go get -u github.com/grafana/grafana-plugin-sdk-go
46
81
go mod tidy
47
82
```
48
83
49
-
2. Build backend plugin binaries for Linux, Windows and Darwin:
84
+
2. Build binaries for Linux, Windows and Darwin:
50
85
51
86
```bash
52
87
mage -v
@@ -58,36 +93,12 @@ A data source backend plugin consists of both frontend and backend components.
58
93
mage -l
59
94
```
60
95
61
-
### Local Development
62
-
63
-
Set environment variables
64
-
```
65
-
PLUGIN_REPO = local path to cloned repo
66
-
GIT_SSH_KEY = path to private git sshkey
67
-
```
68
-
69
-
Build frontend and backend and start docker-compose
96
+
### Releasing the Application
70
97
71
-
```
72
-
docker-compose up
73
-
```
74
-
75
-
Under datasources the Grafana Dashboard Plugin Sync should be available now
76
-
77
-
## Releasing the Plugin
78
-
79
-
The release process of the plugin is automated using Github Actions.
98
+
The release process of the application is automated using Github Actions.
80
99
On each push to the `main` branch, a new prerelease is created and the corresponding commit is tagged "latest".
81
100
Old prereleases will be deleted.
82
101
83
102
To create a normal release, the commit that is used as the basis for the release must be tagged with the following format: `v*.*.*`.
84
103
After that, the release is built and created with the version number extracted from the tag.
85
104
Furthermore, a new commit is created, which sets the current version in the `main` branch to the version that has been released.
86
-
87
-
## Learn more
88
-
89
-
-[Build a data source backend plugin tutorial](https://grafana.com/tutorials/build-a-data-source-backend-plugin)
0 commit comments