barman: Add wrapper script, minimum redundancy and backup max age

This commit is contained in:
Erwin Boskma 2024-10-10 08:41:09 +02:00
parent 6c88b600eb
commit 72c1018be1
Signed by: erwin
SSH key fingerprint: SHA256:/Wk1WZdLg+vQHs3in9qq7PsIp8SMzwGSk/RLZ5zPuZk
2 changed files with 29 additions and 11 deletions

View file

@ -23,6 +23,9 @@
streaming_archiver = true;
backup_method = "postgres";
slot_name = "barman";
bandwidth_limit = 0;
last_backup_maximum_age = "3 DAYS";
minimum_redundancy = 3;
retention_policy = "RECOVERY WINDOW OF 4 WEEKS";
};
};

View file

@ -9,6 +9,27 @@ let
iniFormat = pkgs.formats.ini { };
defaultUser = "barman";
defaultHome = "/var/lib/barman";
runtimeInputs = with pkgs; [
cfg.package
bash
bzip2
gzip
lz4
pigz
postgresql
zstd
];
barmanWrapper = pkgs.writeShellApplication {
name = "bm";
inherit runtimeInputs;
text = ''
sudo --set-home --user ${cfg.settings.barman.barman_user} -- ${cfg.package}/bin/barman "$@"
'';
};
in
{
options.services.barman = {
@ -73,7 +94,10 @@ in
};
}) cfg.servers);
systemPackages = [ cfg.package ];
systemPackages = [
cfg.package
barmanWrapper
];
};
systemd = {
timers.barman = {
@ -87,16 +111,7 @@ in
services.barman = {
description = "Run barman maintenance tasks";
path = with pkgs; [
cfg.package
bash
bzip2
gzip
lz4
pigz
postgresql
zstd
];
path = runtimeInputs;
# environment = {
# PGPASSFILE = lib.mkIf (cfg.passwordsFile != null) cfg.passwordsFile;
# };