-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e69a5c6
commit 0af30a1
Showing
7 changed files
with
53 additions
and
10 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,53 @@ | ||
# Grafana Backup | ||
# Grafana Backup Action | ||
|
||
This is a simple script to backup Grafana dashboards. | ||
<p align="center"> | ||
<img src=".github/assets/featured-image.jpg"> | ||
</p> | ||
|
||
[![Publish](https://github.com/zentered/grafana-backup/actions/workflows/publish.yml/badge.svg)](https://github.com/zentered/grafana-backup/actions/workflows/publish.yml) | ||
|
||
This is a simple GitHub Action to backup Grafana Cloud dashboards. | ||
|
||
## Usage | ||
|
||
- `GRAFANA_CLOUD_API_KEY` - your Grafana Cloud API key | ||
- `GRAFANA_ORG` - the Grafana organization name | ||
- `OUTPUT_FOLDER` - the folder to save the dashboards to (ie: `backup`) | ||
- `OVERWRITE_FILES` - true to overwrite/update files, false to create | ||
date-stamped sub-folders | ||
|
||
### GitHub Actions | ||
|
||
Create a new repository and add the following workflow file to | ||
`.github/workflows/grafana-backup.yml`: | ||
|
||
``` | ||
name: Grafana Backup | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 2 * * *' | ||
jobs: | ||
grafana-backup: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Grafana Backup | ||
uses: zentered/[email protected] | ||
env: | ||
GRAFANA_CLOUD_API_KEY: ${{ secrets.GRAFANA_CLOUD_API_KEY }} | ||
GRAFANA_ORG: '<your-org>' | ||
OUTPUT_FOLDER: '' | ||
OVERWRITE_FILES: true | ||
- uses: EndBug/add-and-commit@v9 | ||
with: | ||
default_author: github_actions | ||
``` | ||
|
||
### Local | ||
|
||
Add your API key and the organization name to `.env` (see `.env.example`). | ||
|
||
Run `pnpm start` to backup all dashboards to `backup`. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
branding: | ||
color: blue | ||
icon: bar-chart-2 | ||
description: 'Grafana Backup' | ||
name: Grafana Backup | ||
description: 'Run scheduled or triggered backups of your Grafana Cloud instance' | ||
name: Grafana Backup Action | ||
runs: | ||
main: dist/index.js | ||
using: node16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export const grafanaOrg = process.env.GRAFANA_ORG | ||
export const grafanaApiKey = process.env.GRAFANA_CLOUD_API_KEY | ||
export const outputFolder = process.env.OUTPUT_FOLDER | ||
export const overwriteFiles = process.env.OVERWRITE_FILES === 'true' | ||
export const overwriteFiles = process.env.OVERWRITE_FILES === 'false' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "@zentered/grafana-backup", | ||
"name": "@zentered/grafana-backup-action", | ||
"version": "1.0.0", | ||
"private": false, | ||
"description": "Fetches Grafana dashboards and saves them to a local directory", | ||
|
@@ -8,11 +8,11 @@ | |
], | ||
"homepage": "https://zentered.co/", | ||
"bugs": { | ||
"url": "https://github.com/zentered/grafana-backup/issues" | ||
"url": "https://github.com/zentered/grafana-backup-action/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/zentered/grafana-backup.git" | ||
"url": "git+https://github.com/zentered/grafana-backup-action.git" | ||
}, | ||
"license": "MIT", | ||
"author": "Patrick Heneise <[email protected]> (https://zentered.co)", | ||
|