Giter VIP home page Giter VIP logo

docker-dropbox-app's Introduction

docker-dropbox-app

🐳 Docker synchronization container for Dropbox using a token app

Docker Image Size (tag) Docker Pulls Build CodeQL

Twitter Follow robo.panther Join our Discord

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.

Start with docker

To use this docker is really easy:

  1. Create your App in dropbox
  2. Generated refresh token by using init_dropbox_refreshToken.sh script.
  3. Pull this docker
docker pull rbonghi/dropbox
  1. 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

Start with docker-compose

How to start up the docker-dropbox app machine:

  1. Create your App in dropbox
  2. Generated refresh token by using init_dropbox_refreshToken.sh script.
  3. 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
  1. Start your docker:
docker-compose up

Configuration

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

Start without docker

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)

docker-dropbox-app's People

Contributors

dependabot[bot] avatar rbonghi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

docker-dropbox-app's Issues

LookupError('restricted_content', None)

Running docker-compose with or without specifying the command option I got this error

dropbox_1 | DropboxSync [START] dropbox_1 | Directory is empty, start first download dropbox_1 | Traceback (most recent call last): dropbox_1 | File "DropBoxSync.py", line 394, in <module> dropbox_1 | updown.syncFromDropbox() dropbox_1 | File "DropBoxSync.py", line 102, in syncFromDropbox dropbox_1 | res = self.download(subfolder, nname) dropbox_1 | File "DropBoxSync.py", line 263, in download dropbox_1 | md, res = self.dbx.files_download(path) dropbox_1 | File "/usr/local/lib/python3.7/site-packages/dropbox/base.py", line 1115, in files_download dropbox_1 | None, dropbox_1 | File "/usr/local/lib/python3.7/site-packages/dropbox/dropbox.py", line 296, in request dropbox_1 | user_message_locale) dropbox_1 | dropbox.exceptions.ApiError: ApiError('665a583f1e067c47f24ab0f538e997fa', DownloadError('path', LookupError('restricted_content', None)))

TypeError

Hey, getting this after it has been running successfully for a while, and I have to restart the container.

dropbox - INFO - Request to files/list_folder
dropbox - INFO - Request to files/list_folder
dropbox - INFO - Request to files/list_folder
dropbox - INFO - Request to files/list_folder
dropbox - INFO - Request to files/list_folder
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.11/site-packages/dbsync-1.0.0-py3.11.egg/dbsync/updown.py", line 114, in run
    while not self.stopped.wait(self.interval):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/threading.py", line 622, in wait
    signaled = self._cond.wait(timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/threading.py", line 323, in wait
    if timeout > 0:
       ^^^^^^^^^^^
TypeError: '>' not supported between instances of 'str' and 'int'

Cannot set the interval argument

Hi all,

Any idea on what I'm doing wrong regaring the interval argument? Tnx!

usage: dbsync [-h] [--rootdir ROOTDIR] [--folder FOLDER] [--appKey APPKEY]
              [--appSecret APPSECRET] [--refreshToken REFRESHTOKEN]
              [--interval INTERVAL] [--fromDropbox] [--fromLocal] [--verbose]
dbsync: error: unrecognized arguments: --fromLocal --interval 10

Doesn't work on a Raspberry 3 (ARM v7)

This image claims to work on "ARM and x86." (Hub Docker)

I think that it has to do with the image architecture:

https://hub.docker.com/r/rbonghi/dropbox/tags

OS/ARCH
linux/amd64

Error:

dropbox is up-to-date
Attaching to dropbox
dropbox    | standard_init_linux.go:211: exec user process caused "exec format error"

"uname -a" output:

Linux raspberrypi 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l GNU/Linux

UnicodeDecodeError (utf-8 codec can't decode byte 0xff in position 0: invalid start byte)

Hi. I launched your dropbox container and it worked perfectly for some time and has already synchronized ~500 files, but then it stopped and I couldn't relauch it anymore. I looked into logs and found this info:

DropboxSync [�[32mSTART�[0m]
2019-06-16 17.40.16.jpg is already synced [stats match]
лира9.jpg is already synced [stats match]
2019-06-16 18.09.29.jpg is already synced [stats match]
2019-06-01 12.39.57-2.jpg exists with different stats, downloading
Traceback (most recent call last):
File "DropBoxSync.py", line 396, in
updown.syncFromLocal()
File "DropBoxSync.py", line 149, in syncFromLocal
data = f.read()
File "/usr/local/lib/python3.7/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
disconnected
dropbox

I'm not familiar with Python, but I found some info on stackoverflow related to this issue:
https://stackoverflow.com/questions/42339876/error-unicodedecodeerror-utf-8-codec-cant-decode-byte-0xff-in-position-0-in

fromDropbox crash after first sync

If I run compose the first time I am to sync all remote dirs and files, but just it finish to sync I get this error
Traceback (most recent call last): dropbox-download | File "DropBoxSync.py", line 389, in <module> dropbox-download | do_every(args.interval, updown.syncFromDropbox()) dropbox-download | File "DropBoxSync.py", line 51, in do_every dropbox-download | worker_func () dropbox-download | TypeError: 'NoneType' object is not callable

And I have to restart the container in order to sync new added files

overwrite only older files

Hey,

is there a possibility that it recognize changed files and overwrites then the local if the dropbox is newer or overwrites the dropbox if the local is newer?

Greetings

Daniel

WriteError('conflict', WriteConflictError('file', None))))

I always get below error, seems otherwise to work fine.

Traceback (most recent call last):
File "/usr/local/bin/dbsync", line 33, in
sys.exit(load_entry_point('dbsync==1.0.0', 'console_scripts', 'dbsync')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/dbsync-1.0.0-py3.11.egg/dbsync/main.py", line 112, in main
updown.start()
File "/usr/local/lib/python3.11/site-packages/dbsync-1.0.0-py3.11.egg/dbsync/updown.py", line 129, in start
self.syncFromDropbox(overwrite=overwrite_db)
File "/usr/local/lib/python3.11/site-packages/dbsync-1.0.0-py3.11.egg/dbsync/updown.py", line 262, in syncFromDropbox
self.syncFromDropbox(subfolder=subfolder + "/" + nname)
File "/usr/local/lib/python3.11/site-packages/dbsync-1.0.0-py3.11.egg/dbsync/updown.py", line 262, in syncFromDropbox
self.syncFromDropbox(subfolder=subfolder + "/" + nname)
File "/usr/local/lib/python3.11/site-packages/dbsync-1.0.0-py3.11.egg/dbsync/updown.py", line 262, in syncFromDropbox
self.syncFromDropbox(subfolder=subfolder + "/" + nname)
[Previous line repeated 2 more times]
File "/usr/local/lib/python3.11/site-packages/dbsync-1.0.0-py3.11.egg/dbsync/updown.py", line 245, in syncFromDropbox
self.upload(path, subfolder, os.path.basename(path))
File "/usr/local/lib/python3.11/site-packages/dbsync-1.0.0-py3.11.egg/dbsync/updown.py", line 388, in upload
res = self.dbx.files_upload_session_finish(f.read(CHUNK_SIZE), cursor, commit)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/dropbox/base.py", line 3345, in files_upload_session_finish
r = self.request(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/dropbox/dropbox_client.py", line 351, in request
raise ApiError(res.request_id,
dropbox.exceptions.ApiError: ApiError('7df371d9879e4851a614e334c74a0972', UploadSessionFinishError('path', WriteError('conflict', WriteConflictError('file', None))))

Sync 2 ways both from local and Dropbox

In my case, I want to sync 2 ways both from my local and from my Dropbox.
I tried with 2 params "--fromLocal" and "--fromDropbox" at same time but I get this error: At most one of --fromDropbox or --fromLocal is allowed
Could you please show me how to do this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.