Skip to content

TelesCoop/telescoop-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Telescoop Backup

Backup your sqlite database to an S3 compatible provider.

Quick start

Configuration

  • Add "Telescop Backup" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [
    ...
    'telescoop_backup',
]
  • Include the Telescop Backup URLconf in your project urls.py like this::
    path('backup/', include('telescoop_backup.urls')),
  • Define the following settings in settings.py
BACKUP_ACCESS = 'my_access'  # S3 ACCESS
BACKUP_SECRET = 'my_secret'  # S3 SECRET KEY
BACKUP_BUCKET = 'my_project_backup'  # S3 Bucket
BACKUP_KEEP_N_DAYS = 31  # Optional, defaults to 31
BACKUP_HOST = None  # Optional, default to s3.fr-par.scw.cloud (Scaleway Storage in Paris)

# Optional, for compressing the backup
BACKUP_COMPRESS = True
BACKUP_RECOVER_N_WORKERS = 4  # Optional, default to 1

By default, old backups are removed in order not to take up too much space. If you don't want them removed, just set a very large value for BACKUP_KEEP_N_DAYS.

Backup

You can now backup with the backup_db management command :

  • python manage.py backup_db backup to back up current database
  • python manage.py backup_db backup_media to back up settings.MEDIA_ROOT
  • python manage.py backup_db list to list previous backups
  • python manage.py backup_db recover [file_name] to recover previous database

View last backup and if it is recent

  • /backup/last-backup shows the latest backup
  • /backup/backup-is-less-than-XX-hours-old answers yes (status 200) or no (status 500). This route can be used with a service such as uptimerobot.com.

Gitignore

If you use it in local environment, ignore the backup files

.telescoop_backup_last_backup
*.sqlite

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages