drop creating backups, will be done with Restic

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2021-03-18 19:34:34 +01:00
parent ce2e583d8f
commit 19b0702d4c
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
4 changed files with 0 additions and 62 deletions

View File

@ -44,29 +44,3 @@ Configuration consists of two templates:
* `grafana.ini.j2` - Grafana main configuration file.
* `prometheus.yml.j2` - Initial configuration of the query backend(s).
# Backups
Done by a Sytemd timer daily:
```
> sudo systemctl list-timers 'grafana-backup'
NEXT LEFT LAST PASSED UNIT ACTIVATES
Wed 2020-12-09 00:00:00 UTC 3h 10min left n/a n/a grafana-backup.timer grafana-backup.service
> sudo systemctl status grafana-backup
● grafana-backup.service - Grafana batabase backup
Loaded: loaded (/lib/systemd/system/grafana-backup.service; static; vendor preset: enabled)
Active: inactive (dead) since Tue 2020-12-08 20:48:45 UTC; 6s ago
TriggeredBy: ● grafana-backup.timer
Docs: https://github.com/status-im/infra-role-systemd-timer
Process: 1938613 ExecStart=/usr/local/bin/grafana-backup (code=exited, status=0/SUCCESS)
Main PID: 1938613 (code=exited, status=0/SUCCESS)
```
```
> ls -lh /var/backups/grafana
total 2.3M
-rw-r--r-- 1 root root 563K Dec 5 20:20 grafana-20201205-202043.db.gz
-rw-r--r-- 1 root root 563K Dec 6 20:48 grafana-20201206-204838.db.gz
-rw-r--r-- 1 root root 563K Dec 7 20:48 grafana-20201207-204840.db.gz
-rw-r--r-- 1 root root 563K Dec 8 20:48 grafana-20201208-204845.db.gz
```

View File

@ -39,13 +39,6 @@ grafana_smtp_port: ~
grafana_smtp_user: ~
grafana_smtp_pass: ~
# Backups
grafana_backup_dir: '/var/backups/{{ grafana_service_name }}'
grafana_backup_user: 'root'
grafana_backup_frequency: 'daily'
grafana_backup_timeout_sec: 30
grafana_backup_max_kept: 14
# optional anonymous access
grafana_anonymous: false

View File

@ -1,28 +0,0 @@
---
- name: Create backups directory
file:
path: '{{ grafana_backup_dir }}'
owner: '{{ grafana_backup_user }}'
group: 'adm'
state: directory
mode: 0750
- name: Create backup timer service
include_role: name=systemd-timer
vars:
systemd_timer_description: 'Grafana batabase backup'
systemd_timer_name: 'backup-{{ grafana_service_name }}'
systemd_timer_user: '{{ grafana_backup_user }}'
systemd_timer_frequency: '{{ grafana_backup_frequency }}'
systemd_timer_timeout_sec: '{{ grafana_backup_timeout_sec }}'
systemd_timer_work_dir: '{{ grafana_backup_dir }}'
systemd_timer_start_on_creation: true
systemd_timer_script_content: |
#!/usr/bin/env bash
MAX_KEPT={{ grafana_backup_max_kept }}
DB_PATH="{{ grafana_cont_vol }}/lib/grafana.db"
TSAMP=$(date -u +%Y%m%d-%H%M%S)
echo "Saving Grafana database..."
gzip -c "${DB_PATH}" > "grafana-${TSAMP}.db.gz"
echo "Cleaning up old archives..."
rm -vf $(ls -Art | head -n -${MAX_KEPT})

View File

@ -2,4 +2,3 @@
- import_tasks: config.yml
- import_tasks: container.yml
- import_tasks: consul.yml
- import_tasks: backup.yml