diff --git a/hosts/bicep/services/mysql/backup.nix b/hosts/bicep/services/mysql/backup.nix index 9824e66..91faa84 100644 --- a/hosts/bicep/services/mysql/backup.nix +++ b/hosts/bicep/services/mysql/backup.nix @@ -40,7 +40,7 @@ in path = with pkgs; [ cfg.package coreutils - gzip + zstd ]; script = let @@ -48,11 +48,11 @@ in in '' set -eo pipefail - mysqldump --all-databases | gzip -c -9 --rsyncable > "/var/lib/mysql-backups/mysql-dump.sql.gz" + mysqldump --all-databases | zstd --compress -9 --rsyncable -o "/var/lib/mysql-backups/mysql-dump.sql.zst" ''; # NOTE: keep multiple backups and symlink latest one once we have more disk again - # mysqldump --all-databases | gzip -c -9 --rsyncable > "${backupDir}/$(date --iso-8601)-dump.sql.gz" + # mysqldump --all-databases | zstd --compress -9 --rsyncable -o "${backupDir}/$(date --iso-8601)-dump.sql.zst" # while [ $(ls -1 "${backupDir}" | wc -l) -gt ${toString rotations} ]; do # rm $(find "${backupDir}" -type f -printf '%T+ %p\n' | sort | head -n 1 | cut -d' ' -f2) diff --git a/hosts/bicep/services/postgresql/backup.nix b/hosts/bicep/services/postgresql/backup.nix index 3b06652..151fa52 100644 --- a/hosts/bicep/services/postgresql/backup.nix +++ b/hosts/bicep/services/postgresql/backup.nix @@ -40,7 +40,7 @@ in path = with pkgs; [ coreutils - gzip + zstd cfg.package ]; @@ -49,10 +49,10 @@ in in '' set -eo pipefail - pg_dumpall -U postgres | gzip -c -9 --rsyncable > "/var/lib//postgresql-backups/postgresql-dump.sql.gz" + pg_dumpall -U postgres | zstd --compress -9 --rsyncable -o "/var/lib//postgresql-backups/postgresql-dump.sql.zstd" ''; - # pg_dumpall -U postgres | gzip -c -9 --rsyncable > "${backupDir}/$(date --iso-8601)-dump.sql.gz" + # pg_dumpall -U postgres | zstd --compress -9 --rsyncable -o "${backupDir}/$(date --iso-8601)-dump.sql.zst" # while [ $(ls -1 "${backupDir}" | wc -l) -gt ${toString rotations} ]; do # rm $(find "${backupDir}" -type f -printf '%T+ %p\n' | sort | head -n 1 | cut -d' ' -f2) # done