From 741bfb3d43759e8dbed5e65430e2f5299260da60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Fri, 2 Dec 2022 22:13:18 +0000 Subject: [PATCH] backup woodpecker ci --- nixos/boxes/vpsfree1/backups.nix | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/nixos/boxes/vpsfree1/backups.nix b/nixos/boxes/vpsfree1/backups.nix index 5d32bd38..8629a3fd 100644 --- a/nixos/boxes/vpsfree1/backups.nix +++ b/nixos/boxes/vpsfree1/backups.nix @@ -1,4 +1,8 @@ -{ config, pkgs, ... }: rec { +{ config, pkgs, ... }: +let + genericBackupPath = "/var/lib/backups/"; + containersBackupPath = "${genericBackupPath}/oci-containers/"; +in rec { environment.systemPackages = with pkgs; [ restic ]; @@ -13,8 +17,17 @@ services = { restic.backups.b2 = { passwordFile = "/run/secrets/restic-backups-b2-repo-password"; - paths = [ "/var/lib/foundryvtt" "/var/lib/gitea" "/var/lib/mastodon" ]; + paths = [ + "/var/lib/foundryvtt" + "/var/lib/gitea" + "/var/lib/mastodon" + "${containersBackupPath}" + ]; repository = "b2:cyplo-restic-vpsfree"; + backupPrepareCommand = '' + mkdir -p ${containersBackupPath}/ + ${pkgs.podman}/bin/podman volume export woodpecker-server-data -o ${containersBackupPath}/woodpecker.tar + ''; timerConfig = { OnCalendar = "hourly"; }; environmentFile = "${config.sops.secrets.restic-backups-b2-environment.path}";