Skip to main content

Django database backup with S3 storage and scheduling

Project description

Django DB S3 Backup

A robust Django library for automated PostgreSQL database backups with local and S3 storage support, featuring scheduled backups and restoration capabilities.

Features

  • 🗄️ Automated database backups
  • ⏰ Scheduled backups using cron syntax
  • 💾 Local backup storage with rotation
  • ☁️ S3 backup storage with rotation
  • 🔄 Easy restoration process
  • 🔒 Secure credential management

Installation

pip install django-db-s3-backup



## Configuration
#Add to your INSTALLED_APPS
INSTALLED_APPS = [
    ...
    'django_db_s3_backup',
    'django_apscheduler', 
    ...
]


#Database Configuration
# Optional - falls back to default Django DB settings if not specified
DB_BACKUP_HOST = 'backup.db.example.com'
DB_BACKUP_PORT = '5432'
DB_BACKUP_NAME = 'backup_db'
DB_BACKUP_USER = 'backup_user'
DB_BACKUP_PASSWORD = 'securepassword'


#Local Storage
DB_BACKUP_LOCAL_DIR = os.path.join(BASE_DIR, 'db_backups')  # Local backup directory
DB_BACKUP_MAX_LOCAL = 5  # Max local backups to keep


#S3 Storage

DB_BACKUP_S3_ENABLED = True  # Set False to disable S3
DB_BACKUP_S3_BUCKET_NAME = 'your-backup-bucket'
DB_BACKUP_S3_ACCESS_KEY = 'your-access-key'  # Consider using env vars
DB_BACKUP_S3_SECRET_KEY = 'your-secret-key'  # Consider using env vars
DB_BACKUP_S3_DIR = 'backups'  # S3 path prefix
DB_BACKUP_MAX_S3 = 30  # Max S3 backups to keep



#Scheduling
DB_BACKUP_SCHEDULE_ENABLED = True  # Enable scheduled backups, False by default
DB_BACKUP_SCHEDULE_CRON = '0 2 * * *'  # 2 AM daily (cron syntax)

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

django_db_s3_backup-0.1.1.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

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

django_db_s3_backup-0.1.1-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file django_db_s3_backup-0.1.1.tar.gz.

File metadata

  • Download URL: django_db_s3_backup-0.1.1.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for django_db_s3_backup-0.1.1.tar.gz
Algorithm Hash digest
SHA256 93bec5486f53c0f80db6797355facaf69a24d57cd4dbffd43e494d168a3286de
MD5 8e4f592e21b0fdca4e667c020a97a8da
BLAKE2b-256 1f32246443fb3513a656cc9270b77c81e2549a29a776d3d531c4967868152a37

See more details on using hashes here.

File details

Details for the file django_db_s3_backup-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_db_s3_backup-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c603cd59e7179e4f8c3d237e16e07c2c06bf5941265ca8a2cfe67a5554cd967a
MD5 0c6f932618c014aca52663c05fb1f603
BLAKE2b-256 7a6393ec3a66ab2ea7695a5d2110ad18ee76c8ebba61ee1282fd146ce9f1d49d

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