Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mt3593/grafana-backup
Simple docker image for backing up grafana
https://github.com/mt3593/grafana-backup
backup devops devops-tools grafana wizzy
Last synced: 23 days ago
JSON representation
Simple docker image for backing up grafana
- Host: GitHub
- URL: https://github.com/mt3593/grafana-backup
- Owner: mt3593
- Created: 2019-06-08T14:05:45.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-06-18T08:55:35.000Z (over 5 years ago)
- Last Synced: 2024-12-06T22:39:59.545Z (about 1 month ago)
- Topics: backup, devops, devops-tools, grafana, wizzy
- Language: Shell
- Size: 2.93 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Grafana backup
Using wizzy and git, this simple tool pulls down the current dashboards and
datasource configuration in Grafana. Then saves these into the git repo of your
choice.## Use
### Docker
Run as a docker file:
```bash
docker run --env GIT_NAME="Robot" --env GIT_EMAIL="[email protected]" \
--env GIT_TOKEN_USERNAME="" --env GIT_TOKEN="" \
--env GIT_REPO_USERNAME="" --env GIT_REPO=""
--env GRAFANA_URL="http://grafana" --env GRAFANA_USERNAME="admin"
--env GRAFANA_PASSWORD="admin" mt3593/grafana-backup:v0.0.1
```Where `GIT_REPO_USERNAME` is the user name of the repo, so for this one it would
be `mt3593`.[dockerhub link](https://cloud.docker.com/repository/docker/mt3593/grafana-backup)
### k8s
To run as a `cronJob` in a kubernetes cluster:
```yaml
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: grafana-backup
spec:
schedule: "*/30 * * * *"
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 1
jobTemplate:
spec:
template:
spec:
containers:
- name: grafana-backup
image: mt3593/grafana-backup:v0.0.3
env:
- name: GIT_NAME
value: "Robot"
- name: GIT_EMAIL
value: "[email protected]"
- name: GIT_TOKEN_USERNAME
valueFrom:
secretKeyRef:
name: grafana-git-backup
key: username
- name: GIT_TOKEN
valueFrom:
secretKeyRef:
name: grafana-git-backup
key: token
- name: GIT_REPO_USERNAME
value: ""
- name: GIT_REPO
value: ""
- name: GRAFANA_URL
value: "http://grafana:3000"
- name: GRAFANA_USERNAME
valueFrom:
secretKeyRef:
name: grafana-backup-user
key: username
- name: GRAFANA_PASSWORD
valueFrom:
secretKeyRef:
name: grafana-backup-user
key: password
restartPolicy: Never
```This expects two secrets to be stored in kubernetes under the same namespace,
`grafana-backup-user` and `grafana-git-backup`.These can be created running the following commands with your values for username, token and password substituted in.
```bash
kubemonitoring create secret generic grafana-git-backup --from-literal=username= --from-literal=token=
kubemonitoring create secret generic grafana-backup-user --from-literal=username= --from-literal=password=
```