Skip to content

Consolidate WAL-G backup scripts into unified manager - #24

Open
gpas45 wants to merge 1 commit into
mainfrom
claude/wal-g-scripts-consolidate-3z3pj6
Open

Consolidate WAL-G backup scripts into unified manager#24
gpas45 wants to merge 1 commit into
mainfrom
claude/wal-g-scripts-consolidate-3z3pj6

Conversation

@gpas45

@gpas45 gpas45 commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

Consolidates the separate WAL-G backup management scripts (wal-g-cfg.sh, wal-g-list.sh, wal-g-backup.sh, wal-g-backup-all.sh, wal-g-delete.sh, wal-g-restore.sh, wal-g-install.sh, and wal-g-menu.sh) into a single unified wal-g-manager.sh script with an interactive menu interface, following the pattern of existing pgpro-setup.sh and pg-server-manager.sh.

Key Changes

  • New unified script: wal-g-manager.sh (1768 lines) consolidates all WAL-G operations into one entry point with multiple operational modes:

    • Interactive menu (default, root-only)
    • Configuration mode (cfg)
    • Backup listing (list)
    • Interactive backup creation (backup)
    • Non-interactive backup-all for systemd timers (backup-all)
    • Backup deletion/retention (delete)
    • Cluster restoration (restore)
    • Installation/setup (install, units, uninstall-units, uninstall)
  • Removed individual scripts: All separate scripts from wal-g-scripts/ directory are removed:

    • wal-g-cfg.sh
    • wal-g-list.sh
    • wal-g-backup.sh
    • wal-g-backup-all.sh
    • wal-g-delete.sh
    • wal-g-restore.sh
    • wal-g-install.sh
    • wal-g-menu.sh
  • Updated systemd service: backup-pgsql.service now references the unified manager script instead of the separate wal-g-backup-all.sh

  • Unified helper functions: Common functionality (logging, prompts, PostgreSQL interaction, JSON config handling, systemd service management) is consolidated into shared utility functions within the single script

Implementation Details

  • Maintains backward compatibility with existing configuration file format (.walg-<port>.json in /etc/wal-g.d/)
  • Preserves all original functionality including S3 and file-based storage backends
  • Implements consistent color-coded logging (INFO, WARN, ERROR, section headers)
  • Supports both interactive TTY and non-interactive modes
  • Respects NO_COLOR environment variable for accessibility
  • Requires root privileges for most operations with appropriate permission checks
  • Uses umask 077 during configuration to protect sensitive credentials

https://claude.ai/code/session_016qQMR1LRFfnB6ZkWprECWk

Семь отдельных скриптов (cfg/list/backup/backup-all/delete/restore/install/
menu) сведены в один файл с интерактивным меню в стиле pgpro-setup.sh —
подкоманды сохранены для CLI/systemd (backup-all для таймера).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qQMR1LRFfnB6ZkWprECWk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants