bicep/{postgres,mysql}: use zstd for backup compression

This commit is contained in:
h7x4
2026-01-29 13:50:35 +09:00
parent f08bd96b74
commit bac53be707
2 changed files with 6 additions and 6 deletions

View File

@@ -40,7 +40,7 @@ in
path = with pkgs; [ path = with pkgs; [
cfg.package cfg.package
coreutils coreutils
gzip zstd
]; ];
script = let script = let
@@ -48,11 +48,11 @@ in
in '' in ''
set -eo pipefail 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 # 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 # 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) # rm $(find "${backupDir}" -type f -printf '%T+ %p\n' | sort | head -n 1 | cut -d' ' -f2)

View File

@@ -40,7 +40,7 @@ in
path = with pkgs; [ path = with pkgs; [
coreutils coreutils
gzip zstd
cfg.package cfg.package
]; ];
@@ -49,10 +49,10 @@ in
in '' in ''
set -eo pipefail 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 # 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) # rm $(find "${backupDir}" -type f -printf '%T+ %p\n' | sort | head -n 1 | cut -d' ' -f2)
# done # done