Remove local backup after upload to S3
Kavan72 opened this issue · 3 comments
Kavan72 commented
I've configured the backup of my PostgreSQL Docker instance, where I've set it to take a backup from the last month and upload it to S3. Now, all these backups are also present in the local file system. Is there any way to remove them after uploading to S3?
m90 commented
Unless you have also configured a local storage backend, the in-container archive files will be deleted after upload. What makes you think they persist locally? Could you share your configuration?
Kavan72 commented
here is my configured file
services:
backup:
image: offen/docker-volume-backup:${DOCKER_VOLUME_BACKUP__DOCKER_IMAGE_VERSION}
restart: always
environment:
# Take a backup on every n
BACKUP_CRON_EXPRESSION: ${DOCKER_VOLUME_BACKUP__BACKUP_CRON_EXPRESSION}
BACKUP_SOURCES: ${DOCKER_VOLUME_BACKUP__BACKUP_SOURCES}
# Backing up to AWS S3
AWS_S3_BUCKET_NAME: ${DOCKER_VOLUME_BACKUP__AWS_S3_BUCKET_NAME}
AWS_ACCESS_KEY_ID: ${DOCKER_VOLUME_BACKUP__AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${DOCKER_VOLUME_BACKUP__AWS_SECRET_ACCESS_KEY}
AWS_S3_PATH: ${DOCKER_VOLUME_BACKUP__AWS_S3_PATH}
# Rotating away backups that are older than 7 days
BACKUP_FILENAME: ${DOCKER_VOLUME_BACKUP__BACKUP_FILENAME}
BACKUP_PRUNING_PREFIX: ${DOCKER_VOLUME_BACKUP__BACKUP_PRUNING_PREFIX}
BACKUP_RETENTION_DAYS: ${DOCKER_VOLUME_BACKUP__BACKUP_RETENTION_DAYS}
volumes:
- postgresql_data:/data:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./docker-volume-backup/lead-backend:/archive
volumes:
postgresql_data:
m90 commented
By mounting your local path to /archive
, you configure a local storage backend: https://offen.github.io/docker-volume-backup/reference/ thus files are persisted by design.
If you don't want to keep local backups, remove the mount.