mirror of
https://github.com/offen/docker-volume-backup.git
synced 2025-12-05 17:18:02 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0782af88f4 | ||
|
|
f82577fcb5 | ||
|
|
7f261a54b6 | ||
|
|
0069faa7fd |
14
README.md
14
README.md
@@ -51,11 +51,12 @@ AWS_S3_BUCKET_NAME="<xxx>"
|
|||||||
|
|
||||||
# **IMPORTANT, PLEASE READ THIS BEFORE USING THIS FEATURE**:
|
# **IMPORTANT, PLEASE READ THIS BEFORE USING THIS FEATURE**:
|
||||||
# The mechanism used for pruning backups is not very sophisticated
|
# The mechanism used for pruning backups is not very sophisticated
|
||||||
# and applies its rules to **all files in the target directory**,
|
# and applies its rules to **all files in the target directory** by default,
|
||||||
# which means that if you are storing your backups next to other files,
|
# which means that if you are storing your backups next to other files,
|
||||||
# these might become subject to deletion too. When using this option
|
# these might become subject to deletion too. When using this option
|
||||||
# make sure the backup files are stored in a directory used exclusively
|
# make sure the backup files are stored in a directory used exclusively
|
||||||
# for storing them or you might lose data.
|
# for storing them or to configure BACKUP_PRUNING_PREFIX to limit
|
||||||
|
# removal to certain files.
|
||||||
|
|
||||||
# Define this value to enable automatic pruning of old backups. The value
|
# Define this value to enable automatic pruning of old backups. The value
|
||||||
# declares the number of days for which a backup is kept.
|
# declares the number of days for which a backup is kept.
|
||||||
@@ -71,6 +72,15 @@ AWS_S3_BUCKET_NAME="<xxx>"
|
|||||||
|
|
||||||
# BACKUP_PRUNING_LEEWAY="10m"
|
# BACKUP_PRUNING_LEEWAY="10m"
|
||||||
|
|
||||||
|
# In case your target bucket or directory contains other files than the ones
|
||||||
|
# managed by this container, you can limit the scope of rotation by setting
|
||||||
|
# a prefix value. This would usually be the non-parametrized part of your
|
||||||
|
# BACKUP_FILENAME. E.g. if BACKUP_FILENAME is `db-backup-%Y-%m-%dT%H-%M-%S.tar.gz`,
|
||||||
|
# you can set BACKUP_PRUNING_PREFIX to `db-backup-` and make sure
|
||||||
|
# unrelated files are not affected.
|
||||||
|
|
||||||
|
# BACKUP_PRUNING_PREFIX="backup-"
|
||||||
|
|
||||||
########### BACKUP ENCRYPTION
|
########### BACKUP ENCRYPTION
|
||||||
|
|
||||||
# Backups can be encrypted using gpg in case a passphrase is given
|
# Backups can be encrypted using gpg in case a passphrase is given
|
||||||
|
|||||||
@@ -105,6 +105,10 @@ echo "Will wait for next scheduled backup."
|
|||||||
|
|
||||||
prune () {
|
prune () {
|
||||||
target=$1
|
target=$1
|
||||||
|
if [ ! -z "$BACKUP_PRUNING_PREFIX" ]; then
|
||||||
|
target="$target/${BACKUP_PRUNING_PREFIX}"
|
||||||
|
fi
|
||||||
|
|
||||||
rule_applies_to=$(
|
rule_applies_to=$(
|
||||||
mc rm $MC_GLOBAL_OPTIONS --fake --recursive --force \
|
mc rm $MC_GLOBAL_OPTIONS --fake --recursive --force \
|
||||||
--older-than "${BACKUP_RETENTION_DAYS}d" \
|
--older-than "${BACKUP_RETENTION_DAYS}d" \
|
||||||
@@ -137,7 +141,7 @@ if [ ! -z "$BACKUP_RETENTION_DAYS" ]; then
|
|||||||
sleep "$BACKUP_PRUNING_LEEWAY"
|
sleep "$BACKUP_PRUNING_LEEWAY"
|
||||||
if [ ! -z "$AWS_S3_BUCKET_NAME" ]; then
|
if [ ! -z "$AWS_S3_BUCKET_NAME" ]; then
|
||||||
info "Pruning old backups from remote storage"
|
info "Pruning old backups from remote storage"
|
||||||
prune "backup-target/$bucket"
|
prune "backup-target/$AWS_S3_BUCKET_NAME"
|
||||||
fi
|
fi
|
||||||
if [ -d "$BACKUP_ARCHIVE" ]; then
|
if [ -d "$BACKUP_ARCHIVE" ]; then
|
||||||
info "Pruning old backups from local archive"
|
info "Pruning old backups from local archive"
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ BACKUP_ARCHIVE="${BACKUP_ARCHIVE:-/archive}"
|
|||||||
|
|
||||||
BACKUP_RETENTION_DAYS="${BACKUP_RETENTION_DAYS:-}"
|
BACKUP_RETENTION_DAYS="${BACKUP_RETENTION_DAYS:-}"
|
||||||
BACKUP_PRUNING_LEEWAY="${BACKUP_PRUNING_LEEWAY:-10m}"
|
BACKUP_PRUNING_LEEWAY="${BACKUP_PRUNING_LEEWAY:-10m}"
|
||||||
|
BACKUP_PRUNING_PREFIX="${BACKUP_PRUNING_PREFIX:-}"
|
||||||
BACKUP_STOP_CONTAINER_LABEL="${BACKUP_STOP_CONTAINER_LABEL:-true}"
|
BACKUP_STOP_CONTAINER_LABEL="${BACKUP_STOP_CONTAINER_LABEL:-true}"
|
||||||
|
|
||||||
AWS_S3_BUCKET_NAME="${AWS_S3_BUCKET_NAME:-}"
|
AWS_S3_BUCKET_NAME="${AWS_S3_BUCKET_NAME:-}"
|
||||||
|
|||||||
Reference in New Issue
Block a user