The backup container can be used to backup a Postgres, MySQL, or MongoDB database. It will backup the database to a PVC, usually in /backups
.
As parto of this project, I want to integrate the ability to move and store backups to an S3 compatible object storage system.
The current workflow for the backup container is:
In this scenario the a number of backups are stored locally on a Kubernets PVC. When rotated the oldest backup is removed from the PVC.
This is the current directory structure of a running backup:
The desired worklow for the backup container is:
In this scenario the there is one backup stored locally on PVC. This backup is the most recent. All other backups are stored in an S3 compatible storage.
The backups are rotated as per the retention policy. This means the oldest backup is removed from the S3 bucket.
.dump
or .tar.gz
files exist then all of them should be moved to the bucket. Once moved the local copy should be deleted. Only the latest backup should remain on the local /backups
file system.https://github.com/fullboar/backup/blob/main/docker/backup.utils
S3_HOST_URL
S3_BUCKET
S3_ACCESS_KEY
S3_SECRET_ACCESS_KEY