docker-postgres-backup-local
docker-postgres-backup-local copied to clipboard
Improve documentation regarding BACKUP_KEEP_**** behaviour
I have this variables set to 0
BACKUP_KEEP_WEEKS | Number of weekly backups to keep before removal. Defaults to 4.
BACKUP_KEEP_MONTHS | Number of monthly backups to keep before removal. Defaults to 6.
pgbackups:
container_name: Immich_pgbackups
image: prodrigestivill/postgres-backup-local
restart: unless-stopped
user: postgres:postgres # Optional: see below
networks:
- immich_network
volumes:
- /mnt/user/Docker/Immich/pgbackups:/backups
links:
- database
depends_on:
- database
environment:
- TZ
- POSTGRES_HOST=database
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_USER=${DB_USERNAME}
- POSTGRES_DB=${DB_DATABASE_NAME}
#- POSTGRES_PASSWORD_FILE=/run/secrets/db_password <-- alternative for POSTGRES_PASSWORD (to use with docker secrets)
- POSTGRES_EXTRA_OPTS=-Z6
- SCHEDULE=30 1 */3 * * #At 01:30 AM, every 3 days
- BACKUP_KEEP_DAYS=6
- BACKUP_KEEP_WEEKS=1
- BACKUP_KEEP_MONTHS=0
- HEALTHCHECK_PORT=5432
But I still get monthy backups stored, is there a way to configure this only to keep 6 days of backup? not weekly not monthly?
I get a folder called last, with the same backup that in the daily....
I see this is another one of those super-active github projects. I'm also confused by the KEEP settings. I just want to have daily backups for the past two weeks (no more than 14 backups kept).
Okay. Reading the documentation, I can see in our case we only need to pay attention to the last folder. Other folders just have hard links to the files in the last folder. So, yeah, you'll always have a file in the month folder as there will always be a latest backup for the current month. It's all about this last folder and the BACKUP_KEEP_MINS variable. If you want to keep the last 6 backups, then I guess you have to set this to 8640??? The doc says the MINS settings will remove any backups from the last folder that are older then its value. So, if a backup is more than 8640 minutes old (6 days), then it'll delete it. Then you can still set the DAYS to 6 and see the same backup files in there as the last folder. The week and month folder should then always have 1 file each, the latest backup. Backup retention settings are very convoluted.