🐳 Docker synchronization container for Dropbox using a token app
When your docker is ready, all files and folders will be sync in realtime. A watchdog check every time if a file or folder is created, deleted or modified, and will be update your dropbox folder.
If you add in your root a file .dropboxignore
you can select witch type of file or folder you want exclude, look like your git repository.
To use this docker is really easy:
- Create your App in dropbox
- Generated refresh token by using
init_dropbox_refreshToken.sh
script. - Pull this docker
docker pull rbonghi/dropbox
- Run your docker
docker run \
-e DROPBOX_APP_KEY=<WRITE YOUR APPLICATION KEY HERE> \
-e DROPBOX_APP_SECRET=<WRITE YOUR APPLICATION SECRET HERE> \
-e DROPBOX_REFRESH_TOKEN=<WRITE YOUR REFRESH TOKEN HERE> \
-v <FOLDER YOU WANT SYNC>:/dropbox rbonghi/dropbox
How to start up the docker-dropbox app machine:
- Create your App in dropbox
- Generated refresh token by using
init_dropbox_refreshToken.sh
script. - Write your docker-compose.yml file or add:
version: '3'
services:
dropbox:
image: rbonghi/dropbox:latest
environment:
- PYTHONUNBUFFERED=1
- DROPBOX_APP_KEY=<WRITE YOUR APPLICATION KEY HERE>
- DROPBOX_APP_SECRET=<WRITE YOUR APPLICATION SECRET HERE>
- DROPBOX_REFRESH_TOKEN=<WRITE YOUR REFRESH TOKEN HERE>
volumes:
- <FOLDER YOU WANT SYNC>:/dropbox
- Start your docker:
docker-compose up
You have two option to run the dropboxsync:
- --inverval [Default: 10s] Interval refresh folder from Dropbox
- --fromLocal Will be overwriten from your PC follder to Dropbox
- --fromDropbox Will be overwriten from Dropbox to your PC folder
- --verbose Show all debug messages
To select this option you can run the docker machine adding:
docker run -e DROPBOX_TOKEN=<WRITE YOUR TOKEN HERE> -v <FOLDER YOU WANT SYNC>:/dropbox dropbox --fromDropbox
or
version: '3'
services:
dropbox:
image: rbonghi/dropbox:latest
command: ["--fromDropbox", "-i", "120"]
environment:
- PYTHONUNBUFFERED=1
- DROPBOX_APP_KEY=<WRITE YOUR APPLICATION KEY HERE>
- DROPBOX_APP_SECRET=<WRITE YOUR APPLICATION SECRET HERE>
- DROPBOX_REFRESH_TOKEN=<WRITE YOUR REFRESH TOKEN HERE>
volumes:
- <FOLDER YOU WANT SYNC>:/dropbox
If you want launch this script without start a docker container:
python dbsync \
--rootdir <ROOT_FOLDER> \
--folder <DROPBOX_FOLDER> \
--appKey <WRITE YOUR APP KEY HERE> \
--appSecret <WRITE YOUR APP SECRET HERE> \
[options]
For [options]
:
- --verbose Show in detail all steps for each sync
- --fromLocal or --fromDropbox Read Configuration
- --interval [default=60s] The Interval to sync from Dropbox in --fromDropbox mode
- --refreshToken Set the refresh token retrieved and logged in the console at first launch or via the init_script. (This will avoid the manual acceptation step via a generated access code in the navigator)