aboutsummaryrefslogtreecommitdiff
path: root/modules/private/databases
diff options
context:
space:
mode:
Diffstat (limited to 'modules/private/databases')
-rw-r--r--modules/private/databases/mariadb_replication.nix6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/private/databases/mariadb_replication.nix b/modules/private/databases/mariadb_replication.nix
index 740bdac..ae54265 100644
--- a/modules/private/databases/mariadb_replication.nix
+++ b/modules/private/databases/mariadb_replication.nix
@@ -138,16 +138,18 @@ in
138 138
139 set -euo pipefail 139 set -euo pipefail
140 140
141 filename=${backupDir}/$(${pkgs.coreutils}/bin/date -Iminutes).sql
141 ${hcfg.package}/bin/mysqldump \ 142 ${hcfg.package}/bin/mysqldump \
142 --defaults-file=${config.secrets.location}/mysql_replication/${name}/mysqldump \ 143 --defaults-file=${config.secrets.location}/mysql_replication/${name}/mysqldump \
143 -S /run/mysqld_${name}/mysqld.sock \ 144 -S /run/mysqld_${name}/mysqld.sock \
144 --gtid \ 145 --gtid \
145 --master-data \ 146 --master-data \
146 --flush-privileges \ 147 --flush-privileges \
147 --all-databases > ${backupDir}/$(${pkgs.coreutils}/bin/date -Iminutes).sql 148 --all-databases > $filename
149 ${pkgs.gzip}/bin/gzip $filename
148 ''; 150 '';
149 u = pkgs.callPackage ./utils.nix {}; 151 u = pkgs.callPackage ./utils.nix {};
150 cleanup_script = pkgs.writeScript "cleanup_mysql_${name}" (u.exponentialDumps "sql" backupDir); 152 cleanup_script = pkgs.writeScript "cleanup_mysql_${name}" (u.exponentialDumps "sql.gz" backupDir);
151 in [ 153 in [
152 "0 22,4,10,16 * * * root ${backup_script}" 154 "0 22,4,10,16 * * * root ${backup_script}"
153 "0 3 * * * root ${cleanup_script}" 155 "0 3 * * * root ${cleanup_script}"