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
.backupor.envfile - 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_dumpcustom-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 config file
fuelrod-backup auto-discovers config in this order:
| Priority | File | Location searched |
|---|---|---|
| 1st | .backup |
project dir, then repo root |
| 2nd | .env |
project dir, then repo root |
You can also pass an explicit path with --config /path/to/file.
.backup (shell-style, used by the legacy bash scripts):
# .backup
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
.env (Docker Compose style — same key=value format, also supported):
# .env
PG_USERNAME=postgres
PG_PASSWORD=secret
PG_HOST=127.0.0.1
PG_PORT=5432
SERVICE=postgres
USE_DOCKER=true
BASE_DIR=/var/backups/postgres
COMPRESS_FILE=false
KEEP_DAYS=7
Both formats support:
# commentsexport KEY=value(theexportkeyword is stripped)- Single- and double-quoted values
Priority: environment variables always override file values.
2. Run the interactive backup wizard
fuelrod-backup backup
3. Run the interactive restore wizard
fuelrod-backup restore
4. Non-interactive backup (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 or .env config file.
--help Show this message and exit.
fuelrod-backup restore
Usage: fuelrod-backup restore [OPTIONS]
Interactively restore a PostgreSQL database from a dump file.
Options:
--config PATH Path to .backup or .env config file.
--help Show this message and exit.
Restore wizard steps
- Connection — review / override host, user, password; live connection test
- Database folder — pick from directories under
BASE_DIR - Backup file — sorted list with sizes; defaults to latest
- Schema selection — parsed from dump TOC via
pg_restore --list - Table selection — optional per-schema table filter
- Role analysis — detect missing owners; offer: create /
--no-owner/ ignore - Restore options — full / schema-only / data-only, clean mode, parallel workers, dry-run
- 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 |
Config file lookup order
When no --config flag is given, the tool searches these locations in order and
uses the first file found:
<project-dir>/.backup ← checked first
<project-dir>/.env
<repo-root>/.backup
<repo-root>/.env
This means you can drop either a .backup or a .env alongside the tool (or in
the repo root for monorepo layouts) and it will be picked up automatically.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fuelrod_backup-1.1.3.tar.gz.
File metadata
- Download URL: fuelrod_backup-1.1.3.tar.gz
- Upload date:
- Size: 38.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.13.7 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f5a80694736612bf50f4e8a5a012c1f94224c42f19bda42367b21150d1446eb
|
|
| MD5 |
600bf3270d04a15ea825e9d717dd2659
|
|
| BLAKE2b-256 |
2095ef12f6d09702c81418f0684a574e6bb728e928db6211f268598a41712f68
|
File details
Details for the file fuelrod_backup-1.1.3-py3-none-any.whl.
File metadata
- Download URL: fuelrod_backup-1.1.3-py3-none-any.whl
- Upload date:
- Size: 46.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.3.2 CPython/3.13.7 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fc654f01188c9b0d2b2458a3434207e248bac69618254c78d1005dd12540751
|
|
| MD5 |
45a7c45cc8f0eeabe5b4fa546ba8bdf1
|
|
| BLAKE2b-256 |
00fdd9a71487d7f31115abe995f601cd690f428f83b8881a510525edaf8303a0
|