From 6d2872c94c20dd6c4b0e296163aaffebc786ba23 Mon Sep 17 00:00:00 2001 From: Timo Wilken Date: Thu, 2 Nov 2023 23:29:41 +0100 Subject: Back up Grafana database --- tw/system/vin.scm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tw') diff --git a/tw/system/vin.scm b/tw/system/vin.scm index d05a493b..24dd367a 100644 --- a/tw/system/vin.scm +++ b/tw/system/vin.scm @@ -140,10 +140,30 @@ ;; For running the Grafana docker container. (service grafana-service-type (grafana-configuration + (data-path "/var/lib/grafana") (bind-address (server-wireguard-address host-name)))) (service docker-service-type) ; required by `grafana-service-type' (service dbus-root-service-type) ; required by `docker-service-type' (service elogind-service-type) ; required by `docker-service-type' + (simple-service 'grafana-restic-backup restic-backup-service-type + (list (restic-scheduled-backup + (schedule #~"0 3 * * *") + (paths (list "/var/lib/grafana")) + (repo (restic-local-repository + (path "/var/backups/grafana"))) + (password (restic-password-source + (type 'file) + (name "/etc/restic/vin-grafana")))))) + (simple-service 'grafana-restic-cleanup restic-cleanup-service-type + (list (restic-scheduled-cleanup + (schedule #~"0 4 * * *") + (repo (restic-local-repository + (path "/var/backups/grafana"))) + (password (restic-password-source + (type 'file) + (name "/etc/restic/vin-grafana"))) + (keep-daily 30) + (keep-monthly -1)))) ;; Personal statistics exporter: stores hledger data (and soon location ;; data?) in Postgres for Grafana to read. -- cgit v1.2.3