Closed EugenMayer closed 8 years ago
Currently, the sync_exclude is rather simple and use the Path
ignore method of unison.
FYI, here is my config : sync_excludes: [ '.git', '.idea', 'node_modules' ]
, and I can confirm none of these paths are synced.
Unison supports other excludes methods, like File
and Regex
, you can use them by using directly the sync_args
option.
For example, to exclude the 'sites/*.dev'
, you could use:
sync_args = [ "-ignore='Regex sites/.*\.dev'" ]
@mickaelperrin very interesting, ok. I ll close this ticket for now and give it a ride, if it work out i admit, your syntax is simpler, though for folders .git/ is rather usual, maybe we should write some general examples for that at some point.
Thank you for the hint with -ignore .. that can also become very handy.
For now, unison works pretty reliable in my case, just as rsync. As you suggested, i also have the feeling, that the time to resync from "event to file on the container" is shorter, more responsive.
I can reproduce that e.g. .git / bower_componets folder are synced if excludes looking like this:
sync_excludes: ['Gemfile.lock','Gemfile','config.rb','.sass-cache','sass','sass-cache','composer.json' ,'bower.json','package.json','Gruntfile*','bower_components','node_modules', '.gitignore','.git','*.coffee','*.scss','*.sass','*.ts','*.less','sites/*.dev']
could the issue be "nested" folders, so if .git is not in the top-level of the current sync-root?
Yes you are right -Path
matches exactly the provided path relative to the root.
I added some documentation about it in #122
@mickaelperrin thanks, were could i find those docs? is there any syntax to provide something like "at any level" ?
The provided path points the specific part of the Unison documentation related to Path
and Excludes
. I didn't tried it but I suspect you have to Use the -Name
option rather than -Path
.
Name
name
matches any path in which the last component matchesname
,
http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html#pathspec
implemented in #132, see https://github.com/EugenMayer/docker-sync/blob/master/example/docker-sync.yml#L96 for the new options.
Definitely planning to make "Name" the default type with 0.2.0 if you do not veto it
Great addition, no pb to make 'Name' the default. Indeed, I badly read the unison documentation and it should have been the default since the beginning.
Hi, I couldnt make the excludes work for me.
I've tried using both sync_excludes as well as sync_args specifiying the paths manually. I still can see the cache and logs folder being synced. Can you advice me how to properly setup this? I've followed the unison manual but just doesnt work.
version: "2"
options:
verbose: true
syncs:
dt-akeneo-unison-sync:
notify_terminal: true
src: './'
sync_userid: 1000
sync_strategy: 'unison'
# optional, a list of regular expressions to exclude from the fswatch - see fswatch docs for details
#watch_excludes: ['\.git', '\.gitignore', '.*\.md', '\.cache.\php']
sync_args:
#- "-debug verbose" #force Unison to choose the file with the later (earlier) modtime
- "-ignore='Path app/cache'"
- "-ignore='Path app/logs'"
- "-ignore='Path .git'"
- "-ignore='Path vendor'"
- "-ignore='Path upgrades'"
- "-ignore='Path systems'"
# optional: use this to switch to fswatch verbose mode
watch_args: '-v'
my docker-compose-dev seems like this
version: '3.3'
services:
web:
volumes:
- dt-akeneo-unison-sync:/var/www/html:nocopy # nocopy must be used for docker-sync
- ~/.ssh:/root/.ssh
- ~/.composer:/root/.composer
volumes:
dt-akeneo-unison-sync:
external: true
I've described a bit more in this post on stackoverflow
very good post @nei
migrated from rsync to unison, some of the excludes are not working ( or all )
in specific,
.git/
does not work@mickaelperrin do the excludes work on your side? How do you define folder excludes / wildcards and so on? e.g.
'sites/*.dev'
work to exclude all folders in sites/ with a suffix of devIf we have a lot of edge-cases / odd syntax here, we might want to add some examples to the docs