barman: Add wrapper script, minimum redundancy and backup max age
This commit is contained in:
parent
6c88b600eb
commit
72c1018be1
2 changed files with 29 additions and 11 deletions
|
@ -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";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
# };
|
||||
|
|
Loading…
Reference in a new issue