A Docker container for WAL-G with ntfy notification support and flexible configuration via environment variables. Based on apecloud/wal-g.
- Automated PostgreSQL backup and restore with WAL-G
- ntfy notifications for backup success/failure
- Highly configurable via environment variables
- Supports S3 and SSH backup targets
- Example
docker-compose.ymlfor easy orchestration
- Copy
.env.templateto.envand edit your configuration:cp .env.template .env # Edit .env with your preferred values - Build and run the container:
docker build -t wal-g-ntfy-env . docker run --env-file .env wal-g-ntfy-env - Or use the provided
docker-compose.ymlfor easier setup:docker compose up
To automate backups, set up a cronjob on your host system. Example entries:
# Basebackups (daily at 2:00 AM)
0 2 * * * docker compose exec -T wal-g do-base-backup.sh >/dev/null 2>&1
# WAL Files Push (every 15 minutes)
*/15 * * * * docker compose exec -T wal-g do-wal-push.sh >/dev/null 2>&1
# send a "i'm still alive" every sunday @ 8a.m. to ntfy
0 8 * * 0 docker compose exec -T wal-g do-push-test.sh >/dev/null 2>&1All configuration is done via environment variables. See .env.template for full details. Key variables include:
USER- Default user (default:root)WAL_USER- PostgreSQL WAL user (default:postgres)WAL_GROUP- PostgreSQL WAL group (default:postgres)WALG_COMPRESSION_METHOD- Compression method (lz4,zstd,brotli)WALG_RETAIN_DAYS- Days to retain backupsWALG_RETAIN_COUNT- Number of backups to retain
AWS_ACCESS_KEY_ID- AWS access key IDAWS_SECRET_ACCESS_KEY- AWS secret access keyAWS_REGION- AWS regionAWS_ENDPOINT- AWS endpoint (optional, e.g. for MinIO)WALG_S3_PREFIX- S3 bucket and path (e.g.s3://your-bucket-name/path/to/backups/)
SSH_PORT- SSH port (default:22)SSH_USERNAME- SSH usernameSSH_PASSWORD- SSH passwordWALG_SSH_PREFIX- SSH backup target (e.g.ssh://$SSH_USERNAME:$SSH_PASSWORD@$SSH_HOST:$SSH_PORT/backup)
PGUSER- PostgreSQL user (default:postgres)PGPASSWORD- PostgreSQL passwordPGHOST- PostgreSQL host (default:localhost)PGPORT- PostgreSQL port (default:5432)PGDATABASE- PostgreSQL database name
NTFY_ENABLED- Enable ntfy notifications (true/false)NTFY_TOPIC- ntfy topic URL (e.g.https://ntfy.sh/your-topic-name)NTFY_NOTIFY_ON- When to notify (success,failure,both)NTFY_TITLE- Notification titleNTFY_USER- ntfy username (optional)NTFY_PASS- ntfy password (optional)NTFY_AUTH_TOKEN- ntfy auth token (optional)
See LICENSE.