-
-
Notifications
You must be signed in to change notification settings - Fork 289
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
Unison > option to map uid from host #21
Changes from all commits
9506ce7
adfcf17
7ff928f
bdce1bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,10 +61,13 @@ def sync_options | |
args.push(@options['src']) | ||
args.push('-auto') | ||
args.push('-batch') | ||
args.push('-owner') if @options['sync_userid'] == 'from_host' | ||
args.push('-group') if @options['sync_groupid'] == 'from_host' | ||
args.push('-numericids') if @options['sync_userid'] == 'from_host' || @options['sync_groupid'] == 'from_host' | ||
args.push(@options['sync_args']) if @options.key?('sync_args') | ||
args.push("socket://#{@options['sync_host_ip']}:#{@options['sync_host_port']}/") | ||
args.push('-debug verbose') if @options['verbose'] | ||
if @options.key?('sync_user') || @options.key?('sync_group') || @options.key?('sync_groupid') || @options.key?('sync_userid') | ||
if @options.key?('sync_user') || @options.key?('sync_group') || @options.key?('sync_groupid') && @options['sync_groupid'] != 'from_host' || @options.key?('sync_userid') && @options['sync_userid'] != 'from_host' | ||
raise('Unison does not support sync_user, sync_group, sync_groupid or sync_userid - please use rsync if you need that') | ||
end | ||
return args | ||
|
@@ -82,6 +85,7 @@ def start_container | |
if exists == '' | ||
say_status 'ok', "creating #{container_name} container", :white if @options['verbose'] | ||
cmd = "docker run -p '#{@options['sync_host_port']}:#{UNISON_CONTAINER_PORT}' -v #{volume_name}:#{@options['dest']} -e UNISON_VERSION=#{UNISON_VERSION} -e UNISON_WORKING_DIR=#{@options['dest']} --name #{container_name} -d #{UNISON_IMAGE}" | ||
cmd = cmd + " && docker exec #{container_name} chown #{Process.uid} #{@options['dest']}" if @options['sync_userid'] == 'from_host' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should not happen here, otherwise its on container start only There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't understand why do we need it elsewhere than docker start ? unison manage uid/gid syncing for other folders, those that will be updated. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when the dest folder on the unison container has uid 10 and you start the container, sync and then run the chown, the files are properly owned. When you now create a file on the host FS, a new one, which then triggers fswatch, which triggers docker-sync sync - this will just run unison on the host, without the docker exec. This means, the files have the wrong permissions on the host - or are they handled "magical" stickiness? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You maybe didn't have remarked that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah, those are very intersting points - i simply was not aware of this, thank you! |
||
else | ||
say_status 'ok', "starting #{container_name} container", :white if @options['verbose'] | ||
cmd = "docker start #{container_name}" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that looks pretty good. Still ,you need to add this option to example/docker-sync.yml and document it. We should then either offer the same for rsync or state that this is unison only and catch this in rsync as a exception the same way i did this for excludes / users in unison before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will improve this, as soon as I finish the testing of my unison docker image with
fsevents
built in it.