8000 GitHub - lafayettegabe/wald-cli: ⚙️ DevOps-friendly PostgreSQL backup management CLI for lafayettegabe/wald Docker image. One-command backup, restore, and monitoring with WAL-G automation.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

⚙️ DevOps-friendly PostgreSQL backup management CLI for lafayettegabe/wald Docker image. One-command backup, restore, and monitoring with WAL-G automation.

License

Notifications You must be signed in to change notification settings

lafayettegabe/wald-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WALD CLI - WAL-G + Docker Management Tool

WALD (WAL-G + Docker) is a user-friendly command-line interface for managing PostgreSQL backups using WAL-G in Docker containers. It provides simple commands for backup, restore, and monitoring operations.

What is WALD?

WALD is designed to work with PostgreSQL containers that have WAL-G pre-configured for automated backups to S3-compatible storage. It simplifies complex WAL-G operations into easy-to-use commands.

WALD = WAL-G + Docker - A management CLI for PostgreSQL backup operations in containerized environments.

Features

  • Simple Backup & Restore - One-command backup and restore operations
  • Status Monitoring - Real-time backup system status and health checks
  • Log Management - Easy access to backup, archive, and recovery logs
  • Backup Verification - Validate backup integrity and S3 connectivity
  • Automated Cleanup - Manage backup retention policies
  • Docker Native - Designed specifically for containerized PostgreSQL + WAL-G setups

Architecture

WALD works with Docker containers running the WALD Image - a specialized PostgreSQL container with:

  • PostgreSQL 16.x
  • WAL-G backup tool
  • Automated backup scheduling
  • S3-compatible storage integration
  • Recovery automation

Prerequisites

  • Ubuntu 20.04+
  • Docker and Docker Compose
  • S3-compatible storage (AWS S3, MinIO, etc.)
  • WALD PostgreSQL Image (PostgreSQL + WAL-G container)

Quick Installation

One-Line Install

curl -fsSL https://raw.githubusercontent.com/lafayettegabe/wald-cli/main/install.sh | sudo bash

Manual Installation

wget https://github.com/lafayettegabe/wald-cli/archive/main.zip
unzip main.zip
cd wald-cli-main
sudo ./install.sh

Verify installation

wald --version

Setup & Configuration

Configure WALD for your container

wald config

This will prompt you to:

  • Set your PostgreSQL container name
  • Configure encryption key (optional)

Example Docker Compose Setup

Create a docker-compose.yml for your PostgreSQL + WAL-G container:

version: '3.8'
services:
  db:
    image: lafayettegabe/wald:latest
    container_name: db
    environment:
      POSTGRES_DB: myapp
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: secure_password
      
      AWS_ACCESS_KEY_ID: your_access_key
      AWS_SECRET_ACCESS_KEY: your_secret_key
      AWS_REGION: us-east-1
      WALG_S3_PREFIX: s3://your-bucket/backups/myapp
      
      WALG_LIBSODIUM_KEY: your_hex_encryption_key
      
      WALG_RETENTION_DAYS: 30
    volumes:
      - postgres_data:/var/lib/postgresql/data
      - backup_logs:/var/log/wal-g
    ports:
      - "5432:5432"
    restart: unless-stopped

volumes:
  postgres_data:
  backup_logs:

Start your database

docker-compose up -d

Usage Guide

Basic Commands

wald config
wald list
wald backup
wald restore
wald status
wald logs
wald verify
wald cleanup

Command Details

wald config

Interactive configuration for container name and encryption settings.

wald list / wald l

Shows all available backups with timestamps and details.

wald backup / wald b

Creates an immediate backup and shows progress.

wald restore

Interactive restore process with safety confirmations.

wald status

Comprehensive system status including container status, PostgreSQL health, archive mode, backup count, and latest backup info.

wald logs

Access different log types:

  1. Archive logs (WAL archiving)
  2. Backup logs (automated backups)
  3. Container logs
  4. Recovery logs (WAL restore)
  5. All WAL-G logs

wald verify

Health check for the entire backup system including S3 connectivity, backup availability, PostgreSQL status, and WAL-G configuration.

Security Considerations

Encryption

Always use encryption for production backups:

openssl rand -hex 32

Access Control

  • Store S3 credentials securely
  • Use IAM roles when possible
  • Restrict S3 bucket access
  • Regular key rotation

Automated Backup Schedule

The WALD image includes automatic backup scheduling:

  • Incremental backups: Every 2 hours
  • Full backups: Daily at 4 AM UTC
  • Cleanup: Daily at 5 AM UTC
  • Retention: 30 days (configurable)

Monitor automated backups:

wald logs

Troubleshooting

Common Issues

Container not found:

wald config
docker ps

Backup failures:

wald verify
wald logs

Restore issues:

wald logs
docker logs -f your_container_name

S3 connectivity:

docker exec your_container_name envdir /etc/wal-g/env /usr/local/bin/wal-g backup-list

Log Locations

Inside the container:

  • Archive logs: /var/log/wal-g/archive.log
  • Backup logs: /var/log/wal-g/backup-cron.log
  • Recovery logs: /var/log/wal-g/restore-wal.log
  • Cleanup logs: /var/log/wal-g/cleanup-cron.log

Advanced Configuration

Environment Variables for WALD Image

POSTGRES_DB: myapp
POSTGRES_USER: postgres
POSTGRES_PASSWORD: secure_password

AWS_ACCESS_KEY_ID: your_access_key
AWS_SECRET_ACCESS_KEY: your_secret_key
AWS_REGION: us-east-1
AWS_ENDPOINT: https://s3.amazonaws.com
WALG_S3_PREFIX: s3://bucket/path/

WALG_LIBSODIUM_KEY: hex_encryption_key
WALG_COMPRESSION_METHOD: lz4

WALG_RETENTION_DAYS: 30
WALG_DELTA_MAX_STEPS: 6
WALG_UPLOAD_CONCURRENCY: 16
WALG_DOWNLOAD_CONCURRENCY: 10

WALG_NOTIFICATION_EMAIL: admin@example.com

Custom Backup Scripts

docker exec db_container /scripts/backup-cron.sh incremental
0 */6 * * * /usr/local/bin/wald backup >/dev/null 2>&1

API Reference

wald <command> [options]
Command Aliases Description
config - Configure container and settings
list l List all available backups
backup b Create manual backup
restore - Restore from backup
status - Show system status
logs - View various log files
cleanup - Run manual cleanup
verify - Verify system health
help -h, --help Show help information
version --version Show version

Contributing

We welcome contributions! Please see our Contributing Guide for details.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

Version History

  • v1.0.0 - Initial release with core backup/restore functionality

WALD CLI - Making PostgreSQL backup management simple and reliable in Docker environments.

About

⚙️ DevOps-friendly PostgreSQL backup management CLI for lafayettegabe/wald Docker image. One-command backup, restore, and monitoring with WAL-G automation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0