docker-sync-stack start fail on first run

Created on 19 Jan 2017  路  12Comments  路  Source: EugenMayer/docker-sync

After I boot up Sierra I launch the the command and the docker-compose containers start alright but the sync doesn't work. This is the output:

$ docker-sync-stack start
          ok  Starting unison
       error  Error starting sync, exit code 0
     message
     message  Contacting server...
Fatal error: Lost connection with the server
     success  Unison server started
       error  Error starting sync, exit code 0
     message
     message  Contacting server...
Fatal error: Lost connection with the server
          ok  starting compose
Contacting server...
...

With "docker ps" I can see that all containers are running even the one with eugenmayer/unison:unox

I have to CTRL-C and launch the command again. Just a bit annoying.
This is what I see when I stop it

          ok  Stopping sync container myproject-sync
       error  Stopping failed of myproject-sync:
'up' failed with status 'pid 2815 exit 1': Attaching to myproject_db_1, myproject_web_1
Stopping myproject_web_1 ...
Stopping myproject_db_1 ...

I'm guessing it needs to wait for something that starts too fast.
Please tell me if I can provide more information.
You can see my docker-sync at
https://github.com/EugenMayer/docker-sync/issues/209#issuecomment-271666208

bug feature help wanted

Most helpful comment

I finally upgraded from 0.2 to the 0.4.6 and the default strategy and this issue is completely gone.
Thank you so much for your work

All 12 comments

Can confirm the issue.

I think we need to implement a way to check that unison has started in the container before launching unison on the host.

that would be fairly easy, expose the port and the we use wait-for-it on the host like

wait-for-it.sh -h 127.0.0.1 -o <port>

@mickaelperrin AFAIK you are already using inspect to find the random port right, thats what we would need here.

@rodrigoaguilera could you confirm that this has been fixed by #224

Please help by install 0.2.0-beta1 https://github.com/EugenMayer/docker-sync/wiki/How-to-install-the-new-0.2.0-prior-the-release .. you can easily go back to 0.1.5 after that

I did the migration to 0.2.0 a few days ago but I am still experiencing this. Can you reopen and I will try to give more information?

just provide informations, we can reopen it anytime if its at all the same issue

Here is my docker-sync.yml updated for 0.2.1

version: "2"

options:

  compose-file-path: 'docker-compose.yml'
  verbose: false
  rsync_image: 'eugenmayer/rsync'
  unison_image: 'eugenmayer/unison'
  cli_mode: 'auto'

syncs:
  myproject-sync:
    # optional, default can be either rsync or unison See Strategies in the wiki for explanation
    sync_strategy: 'unison'
    notify_terminal: true
    src: './'
    dest: '/var/www/html'

    sync_host_ip: '127.0.0.1'


    sync_excludes: ['Gemfile.lock', 'Gemfile', 'config.rb', 'sass-cache/', 'bower.json', 'Gruntfile*', 'bower_components/', '.gitignore', '.git/', '*.coffee']


    sync_excludes_type: 'Path'

docker-compose.yml

version: "2"
services:
  web:
    build: docker/drupal
    #  volumes:
    #    - .:/var/www/html
    volumes:
      - myproject-sync:/var/www/html
    links:
      - db
    ports:
    - "80:80"
  # MySQL Server
  db:
    image: mariadb:10
    environment:
      MYSQL_USER: drupal
      MYSQL_PASSWORD: drupal
      MYSQL_DATABASE: drupal
      MYSQL_ROOT_PASSWORD: ''
      MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
    command: "--max-allowed-packet=134217728 --innodb_log_file_size=1GB"
volumes:
  myproject-sync:
    external: true

The console output

$ docker-sync-stack start
       note:  You can also run docker-sync in the background with docker-sync --daemon
          ok  Starting unison
       error  Error starting sync, exit code 0
     message
     message  Contacting server...
Fatal error: Lost connection with the server
     success  Unison server started
       error  Error starting sync, exit code 0
     message
     message  Contacting server...
Fatal error: Lost connection with the server
          ok  starting compose
Contacting server...
Fatal error: Lost connection with the server
Starting myproject_db_1
Recreating myproject_web_1

Does it help? Can I give more info?

ensure you properly killed all previous sync sessions, ensure you delete all containers, also the stopped one.

If that dooes not help, connect to the sync container with docker-exec and see the logs, or use docker logs to see if there are any startup errors

Beside that

  • sync_excludes_type: 'Path' is wrong when you use "*.coffee" - please see then unison docs for this

I completely wiped docker and reinstalled everything

This the log from the eugenmayer/unison container
$ docker logs 2eac99539155

user with uid 0 already exist and its root
/entrypoint.sh: ignoring /docker-entrypoint.d/*
/usr/lib/python2.7/site-packages/supervisor/options.py:296: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
  'Supervisord is running as root and it is searching '
2017-03-09 09:22:53,968 CRIT Supervisor running as root (no user in config file)
2017-03-09 09:22:53,969 WARN Included extra file "/etc/supervisor.conf.d/supervisor.daemon.conf" during parsing
2017-03-09 09:22:53,994 INFO RPC interface 'supervisor' initialized
2017-03-09 09:22:53,994 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2017-03-09 09:22:53,995 INFO supervisord started with pid 1
2017-03-09 09:22:54,998 INFO spawned: 'unison' with pid 23
2017-03-09 09:22:56,119 INFO success: unison entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

I don't know what other places to look

Are you sure you have specified the sync_uid ?

Thanks for the catch. I think you are referring to sync_userid

What I pasted before is my full docker-sync.yml so i didn't have it.

I set it to

sync_userid: 'from_host'

Which I think it should be the default in the example and with the same explanation as the rsync example.

I still get the same error.

If I finally solve the issue I'll go through the thread and submit a PR that clarifies the docs like the example docker-sync I explained above.

I dedicated some time every weekday to this issue so I guess I'll come with new findings on Monday

Thanks.

I finally upgraded from 0.2 to the 0.4.6 and the default strategy and this issue is completely gone.
Thank you so much for your work

well those are good news!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davellx picture davellx  路  8Comments

Nomafin picture Nomafin  路  5Comments

MrMMorris picture MrMMorris  路  7Comments

netiul picture netiul  路  7Comments

aandrushchenko picture aandrushchenko  路  5Comments