A Docker-based playground for testing WAL-G streaming backups of PostgreSQL with MinIO as S3-compatible storage.
This playground provides a complete environment for testing WAL-G backup and restore operations with PostgreSQL. It includes:
- PostgreSQL 15 with WAL-G installed and configured for streaming backups
- MinIO as S3-compatible storage backend
- WAL-G client container for backup operations
- Automated scripts for backup, restore, and testing
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ MinIO │ │ PostgreSQL │ │ WAL-G │
│ S3 Storage │◄───┤ Database │◄───┤ Client │
│ │ │ │ │ │
└─────────────┘ └─────────────┘ └─────────────┘
- Docker and Docker Compose
- Make (optional, for convenience commands)
-
Build and start all services:
make build make up
-
Initialize MinIO bucket:
make init-minio
-
Insert test data:
make test-data
-
Create a full backup:
make backup-full
-
List available backups:
make backup-list
- Port: 5432
- Database: testdb
- User: postgres
- Password: postgres
- WAL Level: replica
- Archive Mode: enabled
- API Port: 9000
- Console Port: 9001
- Access Key: minioadmin
- Secret Key: minioadmin
- Bucket: walg-backups
- Available for backup operations
- Configured to use MinIO as S3 backend
make build
- Build all Docker imagesmake up
- Start all servicesmake down
- Stop and remove all servicesmake start
- Start services (if already built)make stop
- Stop servicesmake restart
- Restart servicesmake logs
- Show logs from all services
make init-minio
- Initialize MinIO bucketmake backup-full
- Create a full backupmake backup-incremental
- Create an incremental backupmake backup-list
- List available backupsmake backup-restore
- Restore from latest backupmake test-restore
- Test restore functionalitymake verify-restore
- Verify restore data integrity
make test-data
- Insert test data into databasemake db-status
- Show database statusmake db-connect
- Connect to database
make clean
- Remove all containers, volumes, and imagesmake walg-version
- Show WAL-G versionmake minio-status
- Show MinIO status
-
Start the environment:
make build make up make init-minio
-
Insert initial data:
make test-data
-
Create a full backup:
make backup-full
-
Add more data and create incremental backup:
make test-data make backup-incremental
-
List backups:
make backup-list
-
Test restore (optional):
make backup-restore
The playground uses the following environment variables:
WALG_S3_PREFIX
: S3 bucket prefix for backupsAWS_ACCESS_KEY_ID
: MinIO access keyAWS_SECRET_ACCESS_KEY
: MinIO secret keyAWS_ENDPOINT
: MinIO endpoint URLAWS_S3_FORCE_PATH_STYLE
: Force path-style S3 URLs
PostgreSQL is configured with:
- WAL level: replica
- Archive mode: enabled
- Archive command: wal-g wal-push
- Max WAL senders: 10
- Max replication slots: 10
walg-playground/
├── docker-compose.yml # Main orchestration file
├── Dockerfile.postgres # PostgreSQL with WAL-G
├── Dockerfile.walg # WAL-G client container
├── Makefile # Convenience commands
├── scripts/ # Utility scripts
│ ├── init-walg.sh # PostgreSQL initialization
│ ├── init-minio.sh # MinIO bucket setup
│ ├── backup-full.sh # Full backup script
│ ├── backup-incremental.sh # Incremental backup script
│ ├── backup-list.sh # List backups script
│ ├── backup-restore.sh # Restore script
│ └── insert-test-data.sql # Test data insertion
├── backups/ # Local backup storage
└── Readme.md # This file
- Ensure MinIO is healthy:
docker-compose ps
- Check MinIO logs:
docker-compose logs minio
- Verify bucket exists:
make minio-status
- Check PostgreSQL health:
docker-compose ps
- View PostgreSQL logs:
docker-compose logs postgres
- Test connection:
make db-status
- Verify WAL-G version:
make walg-version
- Check WAL-G logs:
docker-compose logs walg
- Ensure MinIO bucket is initialized:
make init-minio
- PostgreSQL:
localhost:5432
- MinIO API:
localhost:9000
- MinIO Console:
http://localhost:9001
(login: minioadmin/minioadmin)
To completely remove all data and containers:
make clean
This will remove all containers, volumes, and images created by this playground.