add offsite backup support to modded mc

This commit is contained in:
2026-07-23 12:57:03 -05:00
parent bd37a7bbd4
commit a27d6b11c0
@@ -49,6 +49,21 @@ in {
default = "/holocron/archives/gameservers/minecraft/modded"; default = "/holocron/archives/gameservers/minecraft/modded";
description = "path to take hourly backups to with borg!"; description = "path to take hourly backups to with borg!";
}; };
offsite_user = lib.mkOption {
type = lib.types.str;
default = "lifeboat";
description = "user to connect to offsite host with";
};
offsite_target = lib.mkOption {
type = lib.types.str;
default = "lifeboat.holocron.blue";
description = "ip or domain for offsite backups";
};
offsite_dir = lib.mkOption {
type = lib.types.str;
default = "lifeboat/holocron/archives/gameservers";
description = "path to rsync offsite backups to";
};
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@@ -140,6 +155,13 @@ in {
); );
compression = "auto,zstd"; compression = "auto,zstd";
#preHook = "systemctl start mysql-backup.service"; #preHook = "systemctl start mysql-backup.service";
postHook = ''
${pkgs.sshpass}/bin/sshpass -f ${sec."lifeboat_rsync".path} \
${pkgs.rsync}/bin/rsync -aHAX --partial --numeric-ids --info=progress2,name1,stats2 --delete \
-e "ssh -o StrictHostKeyChecking=no" \
${toString cfg.backup_repo} \
${cfg.offsite_user}@${cfg.offsite_target}::${cfg.offsite_dir}
'';
startAt = "*-*-* *:00:00"; startAt = "*-*-* *:00:00";
group = "archives"; group = "archives";
encryption.mode = "repokey-blake2"; encryption.mode = "repokey-blake2";