diff options
author | lassulus <lassulus@lassul.us> | 2018-12-25 14:29:41 +0100 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2018-12-25 14:38:35 +0100 |
commit | 81de4a0473da780b449c9a5e502c2c6a12f57d3d (patch) | |
tree | 59ee2bd929faa00673a3a9887e1a7f10a82e2e94 /lass | |
parent | a46b64750512ebc167a65a39b563eeca8ce8d8b9 (diff) |
l sqlBackup: fix permissions/folders
Diffstat (limited to 'lass')
-rw-r--r-- | lass/2configs/websites/sqlBackup.nix | 4 | ||||
-rw-r--r-- | lass/3modules/mysql-backup.nix | 16 |
2 files changed, 9 insertions, 11 deletions
diff --git a/lass/2configs/websites/sqlBackup.nix b/lass/2configs/websites/sqlBackup.nix index 897e35e61..10a6e4643 100644 --- a/lass/2configs/websites/sqlBackup.nix +++ b/lass/2configs/websites/sqlBackup.nix @@ -20,9 +20,7 @@ lass.mysqlBackup = { enable = true; - config.all = { - password = toString (<secrets/mysql_rootPassword>); - }; + config.all = {}; }; } diff --git a/lass/3modules/mysql-backup.nix b/lass/3modules/mysql-backup.nix index d2ae67171..516f96c34 100644 --- a/lass/3modules/mysql-backup.nix +++ b/lass/3modules/mysql-backup.nix @@ -41,7 +41,7 @@ let }; location = mkOption { type = str; - default = "/bku/sql_dumps"; + default = "/backups/sql_dumps"; }; }; })); @@ -51,11 +51,9 @@ let imp = { - #systemd.timers = - # mapAttrs (_: plan: { - # wantedBy = [ "timers.target" ]; - # timerConfig = plan.timerConfig; - #}) cfg.config; + services.mysql.ensureUsers = [ + { ensurePermissions = { "*.*" = "ALL"; }; name = "root"; } + ]; systemd.services = mapAttrs' (_: plan: nameValuePair "mysqlBackup-${plan.name}" { @@ -75,8 +73,10 @@ let start = plan: let - backupScript = plan: db: - "mysqldump -u ${plan.user} ${optionalString (plan.password != null) "-p$(cat ${plan.password})"} ${db} | gzip -c > ${plan.location}/${db}.gz"; + backupScript = plan: db: '' + mkdir -p ${plan.location} + mysqldump -u ${plan.user} ${optionalString (plan.password != null) "-p$(cat ${plan.password})"} ${db} | gzip -c > ${plan.location}/${db}.gz + ''; in pkgs.pkgs.writeDash "mysqlBackup.${plan.name}" '' ${concatMapStringsSep "\n" (backupScript plan) plan.databases} |