Backup Postgresql to Minio
- 11 - 18
MINIO_ACCESS_KEY=12345678
MINIO_SECRET_KEY=12345678
MINIO_BUCKET=minio
MINIO_SERVER=http://127.0.0.1:9000
version: '3'
services:
pg2minio:
container_name: pg2minio
image: anhnmt/backup-pg2minio:latest
build:
context: .
dockerfile: ./Dockerfile
env_file:
- .env
network_mode: host
-
MINIO_ACCESS_KEY- Your Minio access key. -
MINIO_SECRET_KEY- Your Minio access key. -
MINIO_BUCKET- Your Minio bucket. -
MINIO_SERVER- Your Minio server -
POSTGRES_HOST- Hostname of the PostgreSQL database to backup, alternatively this container can be linked to the container with the namepostgres.
-
SCHEDULE- Cron schedule to run periodic backups. -
POSTGRES_PASSWORD- Password for the PostgreSQL user, if you are using a database on the same machine this isn't usually needed. -
POSTGRES_PORT- Port of the PostgreSQL database, uses the default5432. -
POSTGRES_EXTRA_OPTS- Extra arguments to pass to thepg_dumpcommand. -
POSTGRES_DATABASE- Name of the PostgreSQL database to backup. -
POSTGRES_USER- PostgreSQL user, with priviledges to dump the database. -
POSTGRES_PRERUN- Check connection before executing. -
MINIO_API_VERSION- you can change withS3v4orS3v2. -
MINIO_CLEAN- Assign a value to activate, default is0. For example:7d,14d,1m,30s -
MINIO_BACKUP_DIR- Allows you to change the path in the bucket. e.g. abc/def (without / at the beginning and end) -
MINIO_INSECURE- Disables TLS/SSL certificate verification. -
MINIO_DEBUG- Enables verbose output to the console. -
MINIO_PRERUN- Check connection before executing. -
TELEGRAM_ENABLED- Settrueto enable. Default isfalse -
TELEGRAM_CHAT_ID- Chat ID for example-40054422 -
TELEGRAM_TOKEN- Telegram bot token for example610864305:AAGw2BVSPYPjcc8940bswQTRUZIssSFJA, withoutbotat the beginning -
METRICS_ENABLED- Settrueto enable metrics collection. Default isfalse. -
METRICS_NAMESPACE- Namespace for the metrics. Default is empty. -
METRICS_SUBSYSTEM- Subsystem for the metrics. Default is empty. -
METRICS_PORT- Port for the metrics endpoint. Default is8080. -
METRICS_PATH- Path for the metrics endpoint. Default is/metrics.
- alpine packages : https://pkgs.alpinelinux.org/packages
- go-cron : https://github.com/michaloo/go-cron
- docker-backup-postgres-s3 : https://github.com/wonderu/docker-backup-postgres-s3
- postgres-backup-s3 : https://github.com/schickling/dockerfiles/tree/master/postgres-backup-s3
- MinIO Client : https://github.com/minio/mc
- Cron parser : https://elmah.io/tools/cron-parser
- More information about the scheduling can be found here.