Extend django-dbbackup to backup s3 data to DropBox
- Django >=3.2, <4.0
- Create a new virtualenv and activate it
- Install the packages -
pip install -r requirements.txt -U
and addstorage_sync
to INSTALLED_APPS in Django settings. - Make sure you have set the settings variables for
django-storage
packagesAWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_STORAGE_BUCKET_NAME
AWS_S3_REGION_NAME
DROPBOX_OAUTH2_TOKEN
DROPBOX_OAUTH2_REFRESH_TOKEN
DROPBOX_APP_KEY
DROPBOX_APP_SECRET
DBBACKUP_STORAGE
- Set the values for the following variables in
settings.py
SYNC_S3_BUCKET
- The name of the bucket to sync (default:settings.AWS_STORAGE_BUCKET_NAME
)SYNC_S3_DIR
- The directory in the bucket to sync (default:s3-source-dir/
)SYNC_DROPBOX_DIR
- The directory in the dropbox the backup to be uploaded (default:dropbox-dest-dir/
)SYNC_TARGET_FILE_NAME
- The custom name of the file to be uploaded (default:backup.tar.gz
)
- Run the management command -
python manage.py s3backup
(by default the management command will use the values defined in thesettings.py
. But, it can be overridden by passing commandline args)- Run
python manage.py s3backup --help
to see all available options (incl. Compression of backup)
- Run
docker run -it --rm -v "$(pwd):/app" python:3.7 bash -c "cd /app; pip install -e .[tests]; pytest"