chore: add backup prune, replace period flag by BACKUP_RETENTION_DAYS environment variable

This commit is contained in:
Jonas Kaninda
2024-10-20 06:01:30 +02:00
parent 6d50862538
commit f7514ccf33
10 changed files with 44 additions and 10 deletions

View File

@@ -60,7 +60,7 @@ services:
# for a list of available releases.
image: jkaninda/pg-bkup
container_name: pg-bkup
command: backup --storage s3 -d my-database --mode scheduled --period "0 1 * * *"
command: backup --storage s3 -d my-database"
environment:
- DB_PORT=5432
- DB_HOST=postgres
@@ -74,6 +74,8 @@ services:
- AWS_ACCESS_KEY=xxxx
- AWS_SECRET_KEY=xxxxx
# - BACKUP_CRON_EXPRESSION=0 1 * * * # Optional
#Delete old backup created more than specified days ago
#- BACKUP_RETENTION_DAYS=7
## In case you are using S3 alternative such as Minio and your Minio instance is not secured, you change it to true
- AWS_DISABLE_SSL="false"
# pg-bkup container must be connected to the same network with your database

View File

@@ -78,6 +78,8 @@ services:
- SSH_USER=user
- REMOTE_PATH=/home/jkaninda/backups
- SSH_IDENTIFY_FILE=/tmp/id_ed25519
#Delete old backup created more than specified days ago
#- BACKUP_RETENTION_DAYS=7
## We advise you to use a private jey instead of password
#- SSH_PASSWORD=password
# pg-bkup container must be connected to the same network with your database

View File

@@ -77,6 +77,8 @@ services:
- DB_USERNAME=username
- DB_PASSWORD=password
- BACKUP_CRON_EXPRESSION=0 1 * * *
#Delete old backup created more than specified days ago
#- BACKUP_RETENTION_DAYS=7
# pg-bkup container must be connected to the same network with your database
networks:
- web

View File

@@ -26,8 +26,6 @@ Backup, restore and migrate targets, schedule and retention are configured using
| --dbname | -d | Database name |
| --port | -p | Database port (default: 5432) |
| --disable-compression | | Disable database backup compression |
| --prune | | Delete old backup, default disabled |
| --keep-last | | Delete old backup created more than specified days ago, default 7 days |
| --cron-expression | | Backup cron expression, eg: (* * * * *) or @daily |
| --help | -h | Print this help message and exit |
| --version | -V | Print version information and exit |
@@ -52,6 +50,7 @@ Backup, restore and migrate targets, schedule and retention are configured using
| GPG_PASSPHRASE | Optional, required to encrypt and restore backup | GPG passphrase |
| GPG_PUBLIC_KEY | Optional, required to encrypt backup | GPG public key, used to encrypt backup (/config/public_key.asc) |
| BACKUP_CRON_EXPRESSION | Optional if it was provided from the `--cron-expression` flag | Backup cron expression for docker in scheduled mode |
| BACKUP_RETENTION_DAYS | Optional | Delete old backup created more than specified days ago |
| SSH_HOST | Optional, required for SSH storage | ssh remote hostname or ip |
| SSH_USER | Optional, required for SSH storage | ssh remote user |
| SSH_PASSWORD | Optional, required for SSH storage | ssh remote user's password |