Skip to main content

Simple package for backups and recovery

Project description

PatronX

PatronX is a lightweight toolkit for PostgreSQL backups, point‑in‑time recovery and object‑storage offloading. The project is written in modern typed Python and ships with a clean command‑line interface.

codecov Test Docker publish PyPI publish PyPI

Features

  • Simple CLI for backup, restore and listing available dumps
  • Scheduled backups via cron expressions
  • Optional upload to S3 for off‑site storage
  • Typed Python code with unit tests

DB

  • postgres >= 16
pip install -e . # to install in editable mode
patronx --version
patronx list
patronx check-db
patronx backup [--plain] [--no-progress]
patronx restore --inp /path/to/backup.dump [--plain] [--no-progress]
patronx server

patronx enqueue-backup # with remoulade and rabbitmq

The server command starts schedulers that enqueue backup and cleanup jobs periodically. The backup schedule is controlled via the BACKUP_CRON environment variable while cleanup uses CLEANUP_CRON. Both take standard cron expressions. When unset they default to running once per day for backups and at 1AM for cleanup. Old backups are removed according to the number of days specified in RETENTION_DAYS (defaults to 30).

AWS configuration

Set the following variables so AwsAssetStore can authenticate using the s3-uploader-luxoai IAM user:

AWS_ACCESS_KEY_ID Access key for the IAM user. AWS_SECRET_ACCESS_KEY Secret key for the IAM user. AWS_REGION Region where the bucket resides.

Test

pytest

Linting and Formatting

ruff check . --fix
isort .

Generate requirements

pip install pip-tools
pip-compile --output-file=requirements.txt pyproject.toml

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

patronx-2.0.0.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

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

patronx-2.0.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file patronx-2.0.0.tar.gz.

File metadata

  • Download URL: patronx-2.0.0.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for patronx-2.0.0.tar.gz
Algorithm Hash digest
SHA256 551d85510bd6b3d13fa069afb04e5800c1473802b379ff9e25b2db3495f0ce22
MD5 317495af2eb662bd8ef2965f4c1b6602
BLAKE2b-256 a49511ad0d3e92b2bd70ffcc1a91363554759ab17e490a7a8d28a29fccbb6246

See more details on using hashes here.

Provenance

The following attestation bundles were made for patronx-2.0.0.tar.gz:

Publisher: cd-publish-to-pypi.yml on xdanielsb/patronx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file patronx-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: patronx-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for patronx-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 38071daa1283188a620047f8c7bd6e72f679a419ed4e0e4d29c8b9793d1ca21c
MD5 c0edc09a1f9b50b73800ef7c6158d803
BLAKE2b-256 722d0756c12912686d38d21ee9abd20e7ad15ffa4f545a437c84047a42c3d6ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for patronx-2.0.0-py3-none-any.whl:

Publisher: cd-publish-to-pypi.yml on xdanielsb/patronx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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