Docker-sync: native_osx and sync excludes?

Created on 10 Jun 2017  路  13Comments  路  Source: EugenMayer/docker-sync

Error/Feature Requestion/Docs

Can't seem to be able to exclude files and folders from sync with native_osx

Docker Driver

docker-machine stable Version 17.03.1-ce-mac12 (17661

Sync strategy

native_osx

your docker-sync.yml

````
version: '2'

options:
compose-file-path: 'docker-compose-ums1.yml'
compose-dev-file-path: 'docker-compose-ums1-dev.yml'
verbose: true

syncs:
ums_sync:
notify_terminal: true
src: '.'
sync_strategy: 'native_osx'
# sync_excludes: ['cache', 'log', '.git']
# sync_args:
# - "-ignore='Path .git'"
# - "-ignore='Path cache'"
# - "-ignore='Path log'"
umsweb_sync:
notify_terminal: true
src: './web'
sync_strategy: 'native_osx'
````

OS

macOS 10.12.6 beta

I've tried with sync_excludes, and sync_args, but in both cases the sync still happens on those folders. I can run docker-sync-stack with no issue, and use docker and sync without any other problem (that is fast!). Anything I'm doing wrong here?

Most helpful comment

Just want to add that you need to do docker-sync-stack clear if you want to ignore folder that is synced by current stack. Otherwise it won't work (at least didn't work for me)

All 13 comments

Please see the boilerplate and use the example's there.. I cannot reproduce this

Yep, that's I did. I went through the boilerplates and the whole wiki. Tried the sync_excludes and the sync_args but can't make it work. I was not sure whether I was using wrong options or not. Well, it's not a big issue. I will keep looking. If you can't pinpoint something I did not do correctly, then it's fine. Thanks for the help.

@godbout can you also include the commands that you run, the result (how do you know the excludes files is still included in the synced volumes), and your docker-compose-dev.yml file related with this issue.

Sure thing.

I run:

docker-sync-stack start

my docker-compose(-ums1).yml:

version: '3' services: ums: image: godbout/ums container_name: ums volumes: - dbdata-ums:/var/lib/mysql:nocopy ports: - "8081:80" - "33067:3306"

my docker-compose(-ums1)-dev.yml:

version: '3' services: ums: volumes: - ums_sync:/srv/www/ums/public_html:nocopy - umsweb_sync:/srv/www/ums/public_html/web:nocopy volumes: ums_sync: external: true umsweb_sync: external: true dbdata-ums: external: true

So I'm not sure whether I got it wrong with the sync_args or sync_excludes or even maybe you're right and what I'm expecting doesn't make sense.

Basically I expect the cache and log folders to be empty within my container. (I'll add more folders and files if I can make it work). Currently, the cache and log folders from my host and sync the container. I delete on the host, it gets deleted in the container and vice-versa.

@godbout one thing I notice from your configuration is that you shouldn't need umsweb_sync because web is already inside ums_sync folder.

About your problems, can you set it up using sync_excludes, do the operation (add file to cache, then delete it), then paste the .docker-sync/daemon.log file here. Thanks.

Hey @donnykurnia. Correct. I started with this because symfony 1 defines those folders in its .htaccess. I was planning to update the docker-sync.yml later. It's done now, this part is removed.

I copy below 2 logs. The first one is within the container, the second is from the host. See if it helps.

From container:
Sync Log: UNISON 2.48.4 finished propagating changes at 16:17:17.33 on 15 Jun 2017 Sync Log: Synchronization incomplete at 16:17:17 (0 items transferred, 0 skipped, 1 failed) Sync Log: failed: .docker-sync Sync Log: UNISON 2.48.4 started propagating changes at 16:17:19.40 on 15 Jun 2017 Sync Log: [BGN] Copying .docker-sync/daemon.log from /host_sync to /app_sync Sync Log: [END] Copying .docker-sync/daemon.log Sync Log: [BGN] Copying .docker-sync/daemon.pid from /host_sync to /app_sync Sync Log: [END] Copying .docker-sync/daemon.pid Sync Log: UNISON 2.48.4 finished propagating changes at 16:17:19.41 on 15 Jun 2017 Sync Log: Synchronization complete at 16:17:19 (2 items transferred, 0 skipped, 0 failed)
That's all I have. When I change files on the host, the log doesn't change within the container.

From the host:
... Sync Log: UNISON 2.48.4 finished propagating changes at 16:26:23.56 on 15 Jun 2017 Sync Log: Synchronization complete at 16:26:23 (1 item transferred, 0 skipped, 0 failed) Sync Log: UNISON 2.48.4 started propagating changes at 16:26:27.21 on 15 Jun 2017 Sync Log: [BGN] Copying cache/project_autoload.cache from /host_sync to /app_sync Sync Log: [END] Copying cache/project_autoload.cache Sync Log: UNISON 2.48.4 finished propagating changes at 16:26:27.22 on 15 Jun 2017 Sync Log: Synchronization complete at 16:26:27 (1 item transferred, 0 skipped, 0 failed) Sync Log: UNISON 2.48.4 started propagating changes at 16:26:29.28 on 15 Jun 2017 Sync Log: [BGN] Copying cache/.DS_Store from /host_sync to /app_sync Sync Log: [END] Copying cache/.DS_Store Sync Log: UNISON 2.48.4 finished propagating changes at 16:26:29.28 on 15 Jun 2017 Sync Log: Synchronization complete at 16:26:29 (1 item transferred, 0 skipped, 0 failed) Sync Log: Synchronization complete at 16:26:43 (0 item transferred, 1 skipped, 0 failed) Sync Log: skipped: .git/index.lock (Error in digesting /host_sync/.git/index.lock: Sync Log: /host_sync/.git/index.lock: No such file or directory) Sync Log: UNISON 2.48.4 started propagating changes at 16:26:44.75 on 15 Jun 2017 Sync Log: [BGN] Deleting .git/index.lock from /app_sync Sync Log: [END] Deleting .git/index.lock Sync Log: UNISON 2.48.4 finished propagating changes at 16:26:44.75 on 15 Jun 2017 Sync Log: Synchronization complete at 16:26:44 (1 item transferred, 0 skipped, 0 failed)

The docker-sync.yml file:
````
version: '2'

options:
compose-file-path: 'docker-compose-ums1.yml'
compose-dev-file-path: 'docker-compose-ums1-dev.yml'
verbose: true

syncs:
ums_sync:
notify_terminal: true
src: '.'
sync_strategy: 'native_osx'
sync_excludes: ['cache', 'log', '.git']
````

Thanks!

@godbout here is my docker-sync configuration and the process that executed inside the docker process:

$ docker-sync start
          ok  Starting native_osx for sync bundle-bundle-sync
          ok  bundle-bundle-sync container not running
          ok  starting bundle-bundle-sync container
     command  docker start bundle-bundle-sync && docker exec bundle-bundle-sync supervisorctl restart unison
          ok  starting initial sync of bundle-bundle-sync
     success  Sync container started
          ok  Starting native_osx for sync bundle-app-sync
          ok  bundle-app-sync container not running
          ok  starting bundle-app-sync container
     command  docker start bundle-app-sync && docker exec bundle-app-sync supervisorctl restart unison
          ok  starting initial sync of bundle-app-sync
     success  Sync container started
     success  Starting Docker-Sync in the background

$ cat docker-sync.yml
version: "2"

options:
  verbose: true
  max_attempt: 90
syncs:
  bundle-bundle-sync:
    src: './vendor/bundle'
    sync_excludes: ['.DS_Store', '._*']
    watch_args: '-v'
  bundle-app-sync:
    src: '.'
    sync_excludes: ['vendor/bundle', 'tmp/cache', 'public/assets', '.git*', '.DS_Store', '._*', '.docker*', 'docker*yml', 'Dockerfile*', 'notes', 'data']
    watch_args: '-v'

$ docker ps
CONTAINER ID        IMAGE                                        COMMAND                  CREATED             STATUS              PORTS                             NAMES
b19ae9ff9956        eugenmayer/unison:hostsync_0.2               "/entrypoint.sh su..."   9 days ago          Up 2 minutes        500/tcp                           bundle-app-sync
9b83dc6e4c6c        eugenmayer/unison:hostsync_0.2               "/entrypoint.sh su..."   9 days ago          Up 2 minutes        500/tcp                           bundle-bundle-sync

$ docker exec bundle-app-sync ps afux
PID   USER     TIME   COMMAND
    1 root       0:00 {supervisord} /usr/bin/python /usr/bin/supervisord
   28 root       0:00 unison -ignore=Name vendor/bundle -ignore=Name tmp/cache -ignore=Name public/assets -ignore=Name .git* -ignore=Name .DS_Store -ignore=Name ._* -ignore=Name .docker* -ignore=Name docker*yml -ignore=Name Dockerfile* -ignore=Name notes -ignore=Name data -prefer /host_sync -numericids -repeat watch -auto -batch /host_sync /app_sync -logfile /tmp/unison.log
   29 root       0:00 /usr/local/bin/unison-fsmonitor
   30 root       0:00 tail -F /tmp/unison.log
   34 root       0:00 ps afux

In your case, what is your result of running docker exec ums_sync ps afux ?

@donnykurnia not sure why but it works now. I've checked with ps afux and the ignore flags where not passed at first, then I changed my docker-composer ymls from version 3 to version 2, tried again and it worked. Changed back to version 3, tried again, and still worked. So not really sure where's the problem from, but it does work now.

i guess you just had an indentation issue? Since nobody could yet reproduce this issue and you are yet the only one reported this, i would assume closing this issue. Yes since @donnykurnia did all the hard work here, i wait for his approval of this

@godbout glad it works for you now. I agree with @EugenMayer it could be an indentation issue. Please use space in yml file. Using a good text editor will warn you about this and you can easily switch from tab to space. Closing this issue now.

I have doubts it's an indentation issue. I just changed from version 2 to 3, using Sublime Text with Vintage mode, so I really just replaced that number. Anyways, works now. Now sure what happened, maybe some cache issue or something. All good now. Thanks to you guys!

Just want to add that you need to do docker-sync-stack clear if you want to ignore folder that is synced by current stack. Otherwise it won't work (at least didn't work for me)

For me, not using docker-sync-stack, but docker-sync directly the solution was to run docker-sync clean, afterwards the excludes work as expected.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aandrushchenko picture aandrushchenko  路  5Comments

YouriT picture YouriT  路  4Comments

markglenn picture markglenn  路  7Comments

brucemead picture brucemead  路  3Comments

zedtux picture zedtux  路  8Comments