Minimalisitic container (only 25MB) for backing up PostgreSQL databases.
Easily backup your PostgreSQL Database.
Intended to be used with:
- Kubernetes for creating CronJobs that periodically back up your database.
- Container Instances (e.g Azure Container Instances, AWS Fargate) that can be scheduled at specified times.
- Your computer! It's smaller than pgAdmin.
It has to be in the same Resource Group as the Kubernetes Cluster(the cluster resources not the resource group where the Kubernetes Managed Service is located).
Name the storage account uniquely. And update pg-storage-class.yaml to use the unique name instead of "pgbackupstorage"
Replace database creds in pg-backup-cronJob.yaml. !Attention: This is for simplicity these should be replaced with Secrets.
Execute below command:
kubectl create -f ./aks
docker pull rinormaloku/postgres-back-up
docker run -v /host/backup:/pg_backup rinormaloku/postgres-back-up
- You can set prefix for dump filename setting PREFIX env variable
- You can exclude tables by pattern setting EXCLUDE env variable
- Make your desired changes and build the container:
docker build -t $DOCKER_USER/postgres-back-up .
- Test it locally by executing the command below:
docker run -v /d/backup:/pg_backup $DOCKER_USER/postgres-back-up
- Verify that it is an improvement and commit your changes ;)
- upgrade docker image to alpine:edge which is compatible with pg_dump 12.1
- add prefix for dump filename
- add table exclusion pattern