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)
BACKUP_USE_AWS = False # True if you want to use Amazon s3
BACKUP_REGION = 'eu-west-1' # only used when BACKUP_USE_AWS is True
# Optional, for compressing the backup
BACKUP_COMPRESS = True
BACKUP_RECOVER_N_WORKERS = 4 # Optional, default to 1
# Optional, security backup settings - for duplicating files to a second location
SECURITY_BACKUP_PATH_LIST = ['/path/to/media'] # List of paths to backup
SECURITY_BACKUP_BUCKET = 'my_project_security_backup' # Destination bucket
SECURITY_BACKUP_DESTINATION = 'security_backup' # Optional, prefix in destination bucket
SECURITY_BACKUP_HOST = 's3.fr-par.scw.cloud' # Optional, defaults to BACKUP_HOST
SECURITY_BACKUP_REGION = 'fr-par' # Optional, defaults to BACKUP_REGION
BACKUP_MAX_PAGINATION_ITERATIONS = 10000 # Optional, safety limit for S3 pagination
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 backupto back up current databasepython manage.py backup_db backup_mediato back upsettings.MEDIA_ROOTpython manage.py backup_db listto list previous backupspython manage.py backup_db recover [file_name]to recover previous database
View last backup and if it is recent
/backup/last-backupshows the latest backup/backup/backup-is-less-than-XX-hours-oldanswersyes(status 200) orno(status 500). This route can be used with a service such as uptimerobot.com.
Security Backup
This solution duplicates media files currently stored directly on S3, providing a backup in case of accidental deletion (for example, due to a misconfigured Ansible script). This is designed to mitigate this specific risk, as Scaleway already provides data redundancy (3 copies by default, even in case of hardware failure).
Gitignore
If you use it in local environment, ignore the backup files
.telescoop_backup_last_backup
*.sqlite
Development
- Update version in
setup.cfg; - Create a tag for PyPI publishing ;
Metadata
Release files for telescoop-backup 0.6.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| telescoop_backup-0.6.5.tar.gz | 14.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| telescoop_backup-0.6.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.1 kB
Release files / telescoop_backup-0.6.5.tar.gz
| Download URL | telescoop_backup-0.6.5.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1e834be3c1b37727f9a0f3cda5c403e92bf467b5632f433033c9a38f917d8827
|
|
BLAKE2b-256 checksum How to use checksums |
78dcba3c9794851c89f24f53ec4a4b275107f8ec4be3ca2d182e73ba5f5fefd4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|
Release files / telescoop_backup-0.6.5-py3-none-any.whl
| Download URL | telescoop_backup-0.6.5-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d13a4e42aa656facb3107aae8ab4391f6392e429a158709169a5563e08a4aa91
|
|
BLAKE2b-256 checksum How to use checksums |
d36bea148647df8b0c169e9904dcfe8bfc24f422ae6b5215a2fb28a57360f89e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.4
|