Simple package for backups and recovery
Project description
PatronX
PatronX is a small toolkit for managing PostgreSQL backups and point‑in‑time restores. It is written in typed Python and exposes a concise command‑line interface. Backups can be scheduled, diffed and off‑loaded to S3 with a minimal setup.
Docker Tags are available on Docker Hub:
Utilities
| Command | Purpose |
|---|---|
patronx backup |
create a new dump |
patronx restore |
restore a dump into the database |
patronx list |
list all dumps in BACKUP_DIR |
patronx diff |
diff latest dump against the database |
patronx check-db |
verify database connectivity |
patronx start |
run scheduled backup/cleanup loops and listen for healthcheck |
patronx enqueue-backup |
queue a backup job immediately |
patronx enqueue-cleanup |
queue cleanup of old dumps |
backup and enqueue-backup upload the dumps to s3 if s3 is configured.
Configuration
The following environment variables control how PatronX connects to the database and schedules jobs:
PGHOST– database host (defaultlocalhost)PGPORT– database port (default5432)PGUSER– authentication user (defaulttest_user)PGPASSWORD– password forPGUSERPGDATABASE– database name (defaulttest_db)BACKUP_DIR– where dumps are stored (default./backups)BACKUP_CRON– cron expression for automated backupsCLEANUP_CRON– cron expression for removing old dumpsRETENTION_DAYS– how long to keep dumps (default30)S3_BUCKET– optional bucket for S3 uploadsAMQP_URL– RabbitMQ connection stringLOGSTASH_HOST– Logstash host (defaultlogstash)LOGSTASH_PORT– Logstash port (default5000)HEALTH_PORT– port for the built‑in health server (default7775)
Docs
For guidance on setting up an IAM user with minimum access for S3 uploads, see
docs/aws-user-creation.md.
Development
Install uv:
pip install uv
pytest # run tests
ruff check . --fix # lint
isort . # format imports
generate requirements.txt
uv pip install pip-tools
uv pip-compile --output-file=requirements.txt pyproject.toml
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 patronx-2.4.2.tar.gz.
File metadata
- Download URL: patronx-2.4.2.tar.gz
- Upload date:
- Size: 18.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c7c631236735798ab9c2172687629c538e3af67336bd79660122ed3b8520955
|
|
| MD5 |
632e3ab8e941a7032eed9099f60ba1ca
|
|
| BLAKE2b-256 |
b5c0ac6b4b2452709121840e50632cff3c3ef3798c05236240a732b7f546b4b3
|
Provenance
The following attestation bundles were made for patronx-2.4.2.tar.gz:
Publisher:
cd-publish-to-pypi.yml on xdanielsb/patronx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
patronx-2.4.2.tar.gz -
Subject digest:
5c7c631236735798ab9c2172687629c538e3af67336bd79660122ed3b8520955 - Sigstore transparency entry: 273345583
- Sigstore integration time:
-
Permalink:
xdanielsb/patronx@699cebc381ffbf60cb9ea1f7ad4628b6fb3c2b89 -
Branch / Tag:
refs/tags/2.4.2 - Owner: https://github.com/xdanielsb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd-publish-to-pypi.yml@699cebc381ffbf60cb9ea1f7ad4628b6fb3c2b89 -
Trigger Event:
release
-
Statement type:
File details
Details for the file patronx-2.4.2-py3-none-any.whl.
File metadata
- Download URL: patronx-2.4.2-py3-none-any.whl
- Upload date:
- Size: 15.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95de5e67ea4e1fbbb7c782eb6eac8fde16d943bac0eab50d717948183a5553e4
|
|
| MD5 |
4f8d09604831e9567f946ba256843348
|
|
| BLAKE2b-256 |
3fb17fb155d5f83373fdda8b688e8b1a24b435f87a490d1bcd46208857e18454
|
Provenance
The following attestation bundles were made for patronx-2.4.2-py3-none-any.whl:
Publisher:
cd-publish-to-pypi.yml on xdanielsb/patronx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
patronx-2.4.2-py3-none-any.whl -
Subject digest:
95de5e67ea4e1fbbb7c782eb6eac8fde16d943bac0eab50d717948183a5553e4 - Sigstore transparency entry: 273345584
- Sigstore integration time:
-
Permalink:
xdanielsb/patronx@699cebc381ffbf60cb9ea1f7ad4628b6fb3c2b89 -
Branch / Tag:
refs/tags/2.4.2 - Owner: https://github.com/xdanielsb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd-publish-to-pypi.yml@699cebc381ffbf60cb9ea1f7ad4628b6fb3c2b89 -
Trigger Event:
release
-
Statement type: