backup woodpecker ci

This commit is contained in:
Cyryl Płotnicki 2022-12-02 22:13:18 +00:00
parent fdb3106554
commit 741bfb3d43

View file

@ -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 ]; environment.systemPackages = with pkgs; [ restic ];
@ -13,8 +17,17 @@
services = { services = {
restic.backups.b2 = { restic.backups.b2 = {
passwordFile = "/run/secrets/restic-backups-b2-repo-password"; 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"; 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"; }; timerConfig = { OnCalendar = "hourly"; };
environmentFile = environmentFile =
"${config.sops.secrets.restic-backups-b2-environment.path}"; "${config.sops.secrets.restic-backups-b2-environment.path}";