dropbox==1.5.1
You can install it using pip:
pip install dropbox==1.5.1
db_backup.sh
is the shell script that makes use of pg_dump
to get the compressed backup of the database,
uploader.py
is the Python script that uploads the database to the Dropbox folder,
client_secrets.json
stores the credentials including app_key, app_secret, access_key and access_secret.
You need to provide the DB_Username
and DB_Name
in db_backup.sh
.
Follow these steps to setup the Dropbox app:
-
You will need to create a Dropbox app, to get the
App_key
andApp_Secret
. You can create it here. (select the App Type as Core and select the Permission type as Full Dropbox) -
Once the app is successfully created, Dropbox will provide you the
app_key
andapp_secret
. Then provide thisapp_key
andapp_secret
inclient_secrets.json
(please do not share your App_Key and App_Secret publicly). -
Then run the
uploader.py
, it will generate an authentication link which you will need to open in your web browser. Press the Allow button, and hit Enter in the shell. -
It will then print the
access_key
and theaccess_secret
, that you will need to provide in theclient_secrets.json
And you are done with the Dropbox setup.
After that, you can setup a Cron job that will execute the db_backup.sh everyday and get your Database backup in your Dropbox folder.
The scripts all yours under creative commons license :)