From 49951babc81dbc2972a0c42259625fe7826746af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Wed, 30 Aug 2023 21:54:01 +0200 Subject: [PATCH] default backup policy, environment variable names --- Dockerfile | 6 +++--- README.md | 31 +++++++++++++++++++++---------- libexec/kiwi-backup/build_command | 6 +++--- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index d880a03..be64a08 100644 --- a/Dockerfile +++ b/Dockerfile @@ -85,9 +85,9 @@ ENV \ ################# SCHEDULE_BACKUP="R 2 * * *" \ SCHEDULE_CLEANUP="R 4 * * *" \ - FULL_BACKUP_FREQUENCY=3M \ - BACKUP_RETENTION_TIME=6M \ - KEEP_NUM_FULL_CHAINS=2 \ + POLICY_FULL_BACKUP_FREQUENCY=1W \ + POLICY_BACKUP_RETENTION_TIME=1M \ + POLICY_KEEP_NUM_CHAINS=3 \ \ ###################### # ADDITIONAL OPTIONS # diff --git a/README.md b/README.md index 22a5c96..6c3649d 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,24 @@ backup: - backups the entire service data directory - stores all backup data on the host file system - daily incremental backups at night -- a new full backup once every 3 months -- keeps backups up to 6 months old -- keeps daily backups for two recent sets (3-6 months) +- a new full backup once every week +- keeps backups up to 1 month old +- keeps daily backups for three recent sets (2-3 weeks) - backup jobs run at a random minute past 2 am Be aware though -- backups will use a fair bit of storage space! +## Changes + +### Version `0.13` + +- **Changed default backup policy** +- *old:* full backup 3 months, keep 6 months, keep 2 chains +- *new:* full backup 1 week, keep 1 month, keep 3 chains +- **Changed environment variable names** +- *old:* `FULL_BACKUP_FREQUENCY`, `BACKUP_RETENTION_TIME`, `KEEP_NUM_FULL_CHAINS` +- *new:* `POLICY_FULL_BACKUP_FREQUENCY`, `POLICY_BACKUP_RETENTION_TIME`, `POLICY_KEEP_NUM_CHAINS` + ## Customization The kiwi-backup image allows for extensive customization even without creating a local image variant. @@ -75,16 +86,16 @@ backup: SCHEDULE_CLEANUP: "R 4 * * *" # how often to opt for a full backup - # default: every 3 months - FULL_BACKUP_FREQUENCY: "3M" + # default: every week + POLICY_FULL_BACKUP_FREQUENCY: "1W" # how long to keep backups at all - # default: 6 months - BACKUP_RETENTION_TIME: "6M" + # default: 1 month + POLICY_BACKUP_RETENTION_TIME: "1M" - # how many full backup chains with incrementals to keep - # default: 2 - KEEP_NUM_FULL_CHAINS: "2" + # how many backup chains with incrementals to keep + # default: 3 + POLICY_KEEP_NUM_CHAINS: "3" ``` ### Handling Secrets diff --git a/libexec/kiwi-backup/build_command b/libexec/kiwi-backup/build_command index 14cb7bc..450c469 100755 --- a/libexec/kiwi-backup/build_command +++ b/libexec/kiwi-backup/build_command @@ -49,7 +49,7 @@ case "${task}" in backup) printf ' --allow-source-mismatch' printf ' --volsize %s' "${BACKUP_VOLSIZE}" - printf ' --full-if-older-than %s' "${FULL_BACKUP_FREQUENCY}" + printf ' --full-if-older-than %s' "${POLICY_FULL_BACKUP_FREQUENCY}" printf '%s' "$( add_space "${OPTIONS_BACKUP}" )" printf ' %s' "${BACKUP_SOURCE}" ;; @@ -61,13 +61,13 @@ case "${task}" in ;; rmfull) - printf ' remove-older-than %s' "${BACKUP_RETENTION_TIME}" + printf ' remove-older-than %s' "${POLICY_BACKUP_RETENTION_TIME}" printf ' --force' printf '%s' "$( add_space "${OPTIONS_RMFULL}" )" ;; rmincr) - printf ' remove-all-inc-of-but-n-full %s' "${KEEP_NUM_FULL_CHAINS}" + printf ' remove-all-inc-of-but-n-full %s' "${POLICY_KEEP_NUM_CHAINS}" printf ' --force' printf '%s' "$( add_space "${OPTIONS_RMINCR}" )" ;;