aboutsummaryrefslogtreecommitdiff
path: root/modules/private/databases/postgresql_replication.nix
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-12-05 00:51:45 +0100
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-12-05 00:51:45 +0100
commit9f6a78629aad1d22dc8b928860fd05eb40f07352 (patch)
tree25c918ccd80eeb3e04d5d0c3ed4815ff3de5dcae /modules/private/databases/postgresql_replication.nix
parent304a7dac48405d63a5d20466d4afc7ba04d11164 (diff)
downloadNix-9f6a78629aad1d22dc8b928860fd05eb40f07352.tar.gz
Nix-9f6a78629aad1d22dc8b928860fd05eb40f07352.tar.zst
Nix-9f6a78629aad1d22dc8b928860fd05eb40f07352.zip
Add mysql replication
Diffstat (limited to 'modules/private/databases/postgresql_replication.nix')
-rw-r--r--modules/private/databases/postgresql_replication.nix4
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/private/databases/postgresql_replication.nix b/modules/private/databases/postgresql_replication.nix
index 145fcac..cc32c2b 100644
--- a/modules/private/databases/postgresql_replication.nix
+++ b/modules/private/databases/postgresql_replication.nix
@@ -115,9 +115,11 @@ in
115 115
116 ${hcfg.package}/bin/pg_dumpall -h ${dataDir} -f ${backupDir}/$(${pkgs.coreutils}/bin/date -Iseconds).sql 116 ${hcfg.package}/bin/pg_dumpall -h ${dataDir} -f ${backupDir}/$(${pkgs.coreutils}/bin/date -Iseconds).sql
117 ''; 117 '';
118 u = pkgs.callPackage ./utils.nix {};
119 cleanup_script = pkgs.writeScript "cleanup_postgresql_${name}" (u.keepLastNDumps backupDir 12);
118 in [ 120 in [
119 "0 22,4,10,16 * * * postgres ${backup_script}" 121 "0 22,4,10,16 * * * postgres ${backup_script}"
120 "0 3 * * * postgres ${pkgs.coreutils}/bin/rm -f $(${pkgs.coreutils}/bin/ls -1 ${backupDir}/*.sql | ${pkgs.coreutils}/bin/sort -r | ${pkgs.gnused}/bin/sed -e '1,12d')" 122 "0 3 * * * postgres ${cleanup_script}"
121 ]) cfg.hosts); 123 ]) cfg.hosts);
122 }; 124 };
123 125