diff --git a/modules/restic-client-server-mysql/default.nix b/modules/restic-client-server-mysql/default.nix index 5d6faf8..e0a882a 100644 --- a/modules/restic-client-server-mysql/default.nix +++ b/modules/restic-client-server-mysql/default.nix @@ -33,11 +33,11 @@ --exclude-file=${custom.inputs.self}/modules/restic/excludes.txt \ --tag ${tag} ${path} - ${pkgs.mariadb}/bin/mysqldump --add-drop-database --opt --single-transaction --all-databases | \ + ${pkgs.mariadb}/bin/mariabackup --backup --stream=xbstream | \ ${pkgs.restic}/bin/restic backup \ --tag mariadb \ --stdin \ - --stdin-filename all_databases.sql + --stdin-filename mariadb.xb ${pkgs.restic}/bin/restic forget \ --tag home-dir \ diff --git a/modules/restic-server-mysqlutf8-client/default.nix b/modules/restic-server-mysqlutf8-client/default.nix deleted file mode 100644 index cc4ca97..0000000 --- a/modules/restic-server-mysqlutf8-client/default.nix +++ /dev/null @@ -1,59 +0,0 @@ -{ custom -, path -, tag ? "home-dir" -, time -}: { config, pkgs, ... }: -{ - imports = [ - (import "${custom.inputs.self}/modules/telegram-notifications" { inherit custom; }) - ]; - - age.secrets.resticKey.file = "${custom.inputs.self}/scrts/restic.key.age"; - - systemd.timers."restic-backups" = { - wantedBy = [ "timers.target" ]; - partOf = [ "restic-backups.service" ]; - timerConfig = { - OnCalendar = time; - }; - }; - - systemd.services."restic-backups" = { - serviceConfig = { - User = "root"; - Type = "oneshot"; - }; - environment = { - RESTIC_PASSWORD_FILE = config.age.secrets.resticKey.path; - RESTIC_REPOSITORY = "rest:http://10.7.89.30:8000"; - }; - onFailure = [ "unit-status-telegram@%n.service" ]; - script = '' - ${pkgs.restic}/bin/restic backup \ - --exclude-file=${custom.inputs.self}/modules/restic/excludes.txt \ - --tag ${tag} ${path} - - ${pkgs.mariadb}/bin/mysqldump --default-character-set=utf8mb4 --add-drop-database --opt --single-transaction --all-databases | \ - ${pkgs.restic}/bin/restic backup \ - --tag mariadb \ - --stdin \ - --stdin-filename all_databases.sql - - ${pkgs.restic}/bin/restic forget \ - --tag home-dir \ - --host ${config.networking.hostName} \ - --keep-daily 7 \ - --keep-weekly 5 \ - --keep-monthly 12 \ - --keep-yearly 75 - - ${pkgs.restic}/bin/restic forget \ - --tag mariadb \ - --host ${config.networking.hostName} \ - --keep-daily 7 \ - --keep-weekly 5 \ - --keep-monthly 12 \ - --keep-yearly 75 - ''; - }; -}