Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker sync not syncing files #2544

Closed
robertwt7 opened this issue Apr 1, 2020 · 1 comment
Closed

Docker sync not syncing files #2544

robertwt7 opened this issue Apr 1, 2020 · 1 comment

Comments

@robertwt7
Copy link

robertwt7 commented Apr 1, 2020

Hey guys,

I followed the issue on #1226

I followed the settings of @coderars and @godbout for the docker-compose.sync.yml and docker-sync.yml but after I run everything I can't seem to get it synced to my workspace. When I run docker-compose exec workspace bash I can't see any of my files in there.

Can anyone help me please?

Here's my docker-sync.yml

version: "2"

options:
  verbose: false
  compose-dev-file-path: 'docker-compose.sync.yml' # docker-compose override file

syncs:
  applications-docker-sync: # name of the intermediary sync volume
    sync_strategy: '${DOCKER_SYNC_STRATEGY}' # for osx use 'native_osx', for windows use 'unison'
    src: '${APP_CODE_PATH_HOST}' # host source directory
    sync_userid: 1000 # giving permissions to www-data user (as defined in nginx and php-fpm Dockerfiles)
    sync_excludes: ['laradock'] # ignored directories

Here's the docker-compose.sync.yml

version: '3'

services:
    workspace:
        volumes:
            - applications-docker-sync:/var/www:nocopy
    php-fpm:
        volumes:
            - applications-docker-sync:/var/www:nocopy
    nginx:
        volumes:
            - applications-docker-sync:/var/www:nocopy

volumes:
    applications-docker-sync:
        external: true

Also I'm pretty suspicious about the unison thing. Should I follow sync.sh install script or should I follow the guide from docker-sync docs. I followed the docs and when I try to force sync it I got expected Unison 2.48 error:

Manually triggering sync between host and docker-sync container.
       error  Error starting sync, exit code 0
     message
     message  Contacting server...
Fatal error: Received unexpected header from the server:
 expected "Unison 2.48\n" but received "Unison 2.51 with OCaml >= 4.01.2\n\000\000\000\000\017",
which differs at "Unison 2.5".
This can happen because you have different versions of Unison
installed on the client and server machines, or because
your connection is failing and somebody is printing an error
message, or because your remote login shell is printing
something itself before starting Unison.

I'm not sure what did I do wrong.. When I start the sync.sh script I also got a traceback from docker-sync

╰ ./sync.sh up nginx mysql
Initializing Docker Sync
May take a long time (15min+) on the first run
/var/lib/gems/2.5.0/gems/docker-sync-0.5.14/lib/docker-sync/update_check.rb:41: warning: Insecure world writable dir /mnt/c in PATH, mode 040777
          ok  Starting unison for sync applications-docker-sync
Traceback (most recent call last):
        15: from /usr/local/bin/docker-sync:23:in `<main>'
        14: from /usr/local/bin/docker-sync:23:in `load'
        13: from /var/lib/gems/2.5.0/gems/docker-sync-0.5.14/bin/docker-sync:14:in `<top (required)>'
        12: from /var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
        11: from /var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
        10: from /var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
         9: from /var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
         8: from /var/lib/gems/2.5.0/gems/docker-sync-0.5.14/tasks/sync/sync.thor:47:in `start'
         7: from /var/lib/gems/2.5.0/gems/docker-sync-0.5.14/tasks/sync/sync.thor:170:in `daemonize'
         6: from /var/lib/gems/2.5.0/gems/docker-sync-0.5.14/lib/docker-sync/sync_manager.rb:102:in `start_container'
         5: from /var/lib/gems/2.5.0/gems/docker-sync-0.5.14/lib/docker-sync/sync_manager.rb:102:in `each'
         4: from /var/lib/gems/2.5.0/gems/docker-sync-0.5.14/lib/docker-sync/sync_manager.rb:103:in `block in start_container'
         3: from /var/lib/gems/2.5.0/gems/docker-sync-0.5.14/lib/docker-sync/sync_process.rb:105:in `start_container'
         2: from /var/lib/gems/2.5.0/gems/docker-sync-0.5.14/lib/docker-sync/sync_strategy/unison.rb:211:in `start_container'
         1: from /var/lib/gems/2.5.0/gems/docker-sync-0.5.14/lib/docker-sync/sync_strategy/unison.rb:211:in `loop'
/var/lib/gems/2.5.0/gems/docker-sync-0.5.14/lib/docker-sync/sync_strategy/unison.rb:216:in `block in start_container': Failed to start unison container in time, try to increase max_attempt (currently 5) in your configuration. See https:
//github.com/EugenMayer/docker-sync/wiki/2.-Configuration for more informations (RuntimeError)

Can anyone please help?

@robertwt7
Copy link
Author

Found it, unison does not want to start without sudo command so I just had to run sudo before hand. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant