Skip to main content

No project description provided

Project description

fuelrod-backup

Interactive PostgreSQL backup and restore CLI — Docker-aware, wizard-driven.

fuelrod-backup replaces fragile bash backup scripts with a Python CLI that gives you:

  • Type-safe configuration loaded from a .backup env file
  • Rich interactive wizards (database picker, schema filter, role analysis)
  • Docker-aware subprocess handling — no binary pipe corruption, no env-var leakage
  • Non-interactive mode for cron / CI (--no-interactive)
  • pg_dump custom-format backups with optional gzip compression
  • Automatic rotation of old backups

Installation

pip install fuelrod-backup

Or with pipx (recommended for CLI tools):

pipx install fuelrod-backup

Or inside a Poetry project:

poetry add fuelrod-backup

Quick start

1. Create a .backup config file

# .backup  (place next to your scripts or in the fuelrod-backup directory)
PG_USERNAME=postgres
PG_PASSWORD=secret
PG_HOST=127.0.0.1
PG_PORT=5432
SERVICE=postgres          # Docker container name
USE_DOCKER=true
BASE_DIR=/var/backups/postgres
COMPRESS_FILE=false
KEEP_DAYS=7

2. Run the interactive backup wizard

fuelrod-backup backup

3. Run the interactive restore wizard

fuelrod-backup restore

4. Non-interactive backup (for cron / CI)

fuelrod-backup backup --no-interactive

Commands

fuelrod-backup backup

Usage: fuelrod-backup backup [OPTIONS]

  Back up one or more PostgreSQL databases.

Options:
  --no-interactive          Skip all wizard prompts; back up all databases.
  --compress / --no-compress
                            Compress output with gzip.
  --keep-days INTEGER       Delete backups older than N days (0 = keep forever).
  --db TEXT                 Database(s) to back up (repeatable). Default: all.
  --schemas TEXT            Comma-separated schemas to include (applied to every DB).
  --config PATH             Path to .backup config file.

fuelrod-backup restore

Usage: fuelrod-backup restore [OPTIONS]

  Interactively restore a PostgreSQL database from a dump file.

Options:
  --config PATH   Path to .backup config file.

Restore wizard steps

  1. Connection — review / override host, user, password; live connection test
  2. Database folder — pick from directories under BASE_DIR
  3. Backup file — sorted list with sizes; defaults to latest
  4. Schema selection — parsed from dump TOC via pg_restore --list
  5. Table selection — optional per-schema table filter
  6. Role analysis — detect missing owners; offer: create / --no-owner / ignore
  7. Restore options — full / schema-only / data-only, clean mode, parallel workers, dry-run
  8. Target database — rename, drop-and-recreate, or overlay

Configuration reference

Key Default Description
PG_USERNAME postgres PostgreSQL role to connect as
PG_PASSWORD (required) Password
PG_HOST 127.0.0.1 Host (ignored in Docker mode)
PG_PORT 5432 Port (ignored in Docker mode)
SERVICE postgres Docker container name
USE_DOCKER true Use docker exec instead of direct connection
BASE_DIR (required) Root directory for backup files
COMPRESS_FILE false Gzip compress dump files
KEEP_DAYS 7 Retention in days (0 = keep forever)
PSQL_CMD psql Override psql binary path
PG_DUMP_CMD pg_dump Override pg_dump binary path
PG_RESTORE_CMD pg_restore Override pg_restore binary path

Environment variables take precedence over the .backup file.


Docker notes

When USE_DOCKER=true, fuelrod-backup runs all commands via docker exec, explicitly injecting PGPASSWORD and PGUSER as -e flags so the container's own POSTGRES_USER env var cannot override them.

TOC reads use docker cp (not docker exec -i) to avoid binary stream corruption under WSL/Docker Desktop.


License

GNU General Public License v3 or later — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fuelrod_backup-1.0.0.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fuelrod_backup-1.0.0-py3-none-any.whl (30.8 kB view details)

Uploaded Python 3

File details

Details for the file fuelrod_backup-1.0.0.tar.gz.

File metadata

  • Download URL: fuelrod_backup-1.0.0.tar.gz
  • Upload date:
  • Size: 27.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.13.7 Windows/11

File hashes

Hashes for fuelrod_backup-1.0.0.tar.gz
Algorithm Hash digest
SHA256 37df5533a06012a5e258b3176335cff576669a52c9d9ab4de58b2b46c51b3334
MD5 b6e763a5c735fa25ee44f9aa9526c377
BLAKE2b-256 5ccd1de351f6516cb2d796086b720777a072d1f779b3de6c364668ff0f1666a2

See more details on using hashes here.

File details

Details for the file fuelrod_backup-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: fuelrod_backup-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 30.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.13.7 Windows/11

File hashes

Hashes for fuelrod_backup-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc017936ec2f44e6a4a6d0f573a14a2ea19a0460d923abf9a61b0283614dcb29
MD5 a1a91c960224a2476b8b5d89fa1d33d2
BLAKE2b-256 5ce29a2e18fa3d5a58481504b0d6a3727921fd15fb628c21c5df947875a17602

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page