docker-sync 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f8b70cd8eadb981ebb2d30dbb2aa82ed2457a24
4
- data.tar.gz: e5b01b4e856a62db95006063eb10e13bccfba9f5
3
+ metadata.gz: a88e284e5884eb996bd63ce35feef44508aa275d
4
+ data.tar.gz: 7d0c466307ff7b6cb86336e0b729f1795f0f376a
5
5
  SHA512:
6
- metadata.gz: a84e897db840254b726b4fbefc20905b4b186f8c46053c5d3b8f34e48749c0bd6d9b12f4e579caa3ff34ea6e03f5428fbc876d92a878e1964cd735c6c39943af
7
- data.tar.gz: 4917fb9c501ff074d3266d56557fe2859880e2383f46acb6c14efbdf54267e4baf7c868be7b39fef3d1e41524867a0761331d9d319a01da3c5ded71f141395e5
6
+ metadata.gz: 8823db30b0c6ca9eaa21aad241b6525595071028e75db3c307d295a4b1d3cf69cd0fced01a8a4757a73071f0b5135eaa3fc26186bbb499e17cd556d56f06dc16
7
+ data.tar.gz: 0a0c5a4759a34b0dbec794903529f61a515918f5e46b160af8acd1b242e001d49e04fc5dd32bb7dcb634efc90d9a5c63ea9cb5758d8baefa87ab78b790d2e68b
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.4
1
+ 0.5.5
@@ -23,12 +23,12 @@ module DockerSync
23
23
  if @options.key?('image')
24
24
  @docker_image = @options['image']
25
25
  else
26
- @docker_image = 'eugenmayer/unison:hostsync_0.3'
26
+ @docker_image = 'eugenmayer/unison:2.51.2.0'
27
27
  end
28
28
 
29
29
  # TODO: remove this when we have a more stable image, but for now, we need this
30
30
  uc = UpdateChecker.new
31
- uc.check_unison_hostsync_image(true)
31
+ uc.check_unison_image
32
32
 
33
33
  begin
34
34
  Dependencies::Docker.ensure!
@@ -47,8 +47,8 @@ module DockerSync
47
47
  env = {}
48
48
  raise 'sync_user is no longer supported, since it is not needed. Use sync_userid only please' if @options.key?('sync_user')
49
49
 
50
- ignore_strings = expand_ignore_strings
51
- env['UNISON_EXCLUDES'] = ignore_strings.join(' ')
50
+ env['UNISON_SRC'] = '/host_sync'
51
+ env['UNISON_DEST'] = '/app_sync'
52
52
 
53
53
  env['UNISON_ARGS'] = ''
54
54
  if @options.key?('sync_args')
@@ -57,7 +57,12 @@ module DockerSync
57
57
  env['UNISON_ARGS'] = sync_args
58
58
  end
59
59
 
60
- env['UNISON_SYNC_PREFER'] = sync_prefer
60
+ ignore_strings = expand_ignore_strings
61
+ env['UNISON_ARGS'] << ' ' << ignore_strings.join(' ')
62
+ env['UNISON_ARGS'] << ' ' << sync_prefer
63
+ env['UNISON_ARGS'] << ' -numericids -auto -batch'
64
+ env['UNISON_WATCH_ARGS'] = '-repeat watch'
65
+
61
66
  env['MAX_INOTIFY_WATCHES'] = @options['max_inotify_watches'] if @options.key?('max_inotify_watches')
62
67
  if @options['sync_userid'] == 'from_host'
63
68
  env['OWNER_UID'] = Process.uid
@@ -22,7 +22,7 @@ module DockerSync
22
22
  if @options.key?('image')
23
23
  @docker_image = @options['image']
24
24
  else
25
- @docker_image = 'eugenmayer/unison:0.3'
25
+ @docker_image = 'eugenmayer/unison:2.51.2.0'
26
26
  end
27
27
  begin
28
28
  Dependencies::Unison.ensure!
@@ -147,10 +147,21 @@ module DockerSync
147
147
  container_name = get_container_name
148
148
  volume_name = get_volume_name
149
149
  env = {}
150
- say_status 'ok', 'sync_user is no longer supported, since it ise no needed, use sync_userid only please', :yellow if @options.key?('sync_user')
150
+ raise 'sync_user is no longer supported, since it ise no needed, use sync_userid only please' if @options.key?('sync_user')
151
151
 
152
+ env['UNISON_SRC'] = '-socket 5000'
153
+ env['UNISON_DEST'] = '/app_sync'
154
+
155
+
156
+ env['MONIT_ENABLE'] = 'false'
157
+ env['MONIT_INTERVAL'] = ''
158
+ env['MONIT_HIGH_CPU_CYCLES'] = ''
159
+
160
+ env['UNISON_ARGS'] = ''
152
161
  ignore_strings = expand_ignore_strings
153
- env['UNISON_EXCLUDES'] = ignore_strings.join(' ')
162
+ env['UNISON_ARGS'] << ignore_strings.join(' ')
163
+ env['UNISON_WATCH_ARGS'] = ''
164
+
154
165
  env['MAX_INOTIFY_WATCHES'] = @options['max_inotify_watches'] if @options.key?('max_inotify_watches')
155
166
  if @options['sync_userid'] == 'from_host'
156
167
  env['OWNER_UID'] = Process.uid
@@ -158,6 +169,10 @@ module DockerSync
158
169
  env['OWNER_UID'] = @options['sync_userid'] if @options.key?('sync_userid')
159
170
  end
160
171
 
172
+ # start unison-image in unison socket mode mode
173
+ env['HOSTSYNC_ENABLE']=0
174
+ env['UNISONSOCKET_ENABLE']=1
175
+
161
176
  additional_docker_env = env.map{ |key,value| "-e #{key}=\"#{value}\"" }.join(' ')
162
177
  running = `docker ps --filter 'status=running' --filter 'name=#{container_name}' --format "{{.Names}}" | grep '^#{container_name}$'`
163
178
  if running == ''
@@ -167,7 +182,7 @@ module DockerSync
167
182
  say_status 'ok', "creating #{container_name} container", :white if @options['verbose']
168
183
  run_privileged = ''
169
184
  run_privileged = '--privileged' if @options.key?('max_inotify_watches') #TODO: replace by the minimum capabilities required
170
- cmd = "docker run -p '#{@options['sync_host_ip']}::#{UNISON_CONTAINER_PORT}' -v #{volume_name}:#{@options['dest']} -e VOLUME=#{@options['dest']} -e TZ=${TZ-`readlink /etc/localtime | sed -e 's,/usr/share/zoneinfo/,,'`} #{additional_docker_env} #{run_privileged} --name #{container_name} -d #{@docker_image}"
185
+ cmd = "docker run -p '#{@options['sync_host_ip']}::#{UNISON_CONTAINER_PORT}' -v #{volume_name}:#{@options['dest']} -e APP_VOLUME=#{@options['dest']} -e TZ=${TZ-`readlink /etc/localtime | sed -e 's,/usr/share/zoneinfo/,,'`} #{additional_docker_env} #{run_privileged} --name #{container_name} -d #{@docker_image}"
171
186
  else
172
187
  say_status 'ok', "starting #{container_name} container", :white if @options['verbose']
173
188
  cmd = "docker start #{container_name} && docker exec #{container_name} supervisorctl restart unison"
@@ -25,7 +25,6 @@ class UpdateChecker
25
25
  # do not check the image if its the first run - since this it will be downloaded anyway
26
26
  unless @config.first_run?
27
27
  unless has_internet?
28
- check_unison_hostsync_image
29
28
  check_unison_image
30
29
  check_rsync_image
31
30
  # stop if there was an update
@@ -47,6 +46,8 @@ class UpdateChecker
47
46
  def should_run
48
47
  return false unless has_internet?
49
48
  now = DateTime.now
49
+ return true if @config['update_last_check'].nil?
50
+
50
51
  last_check = DateTime.iso8601(@config['update_last_check'])
51
52
  check_after_days = 2
52
53
  if now - last_check > check_after_days
@@ -69,24 +70,11 @@ class UpdateChecker
69
70
 
70
71
  end
71
72
 
72
- def check_unison_hostsync_image(silent = false)
73
- return if ENV['DOCKER_SYNC_SKIP_UPDATE']
74
- say_status 'ok','Checking if a newer native_osx (unison:hostsync_0.2) image is available' unless silent
75
-
76
- if system("docker pull eugenmayer/unison:hostsync_0.2 | grep 'Downloaded newer image for'")
77
- say_status 'ok', 'Downloaded newer image for native_osx', :green unless silent
78
- @newer_image_found = true
79
- else
80
- say_status 'ok', 'No newer image found - current image is up to date.' unless silent
81
- end
82
-
83
- end
84
-
85
73
  def check_unison_image
86
74
  return if ENV['DOCKER_SYNC_SKIP_UPDATE']
87
75
  say_status 'ok','Checking if a newer unison image is available'
88
76
 
89
- if system("docker pull eugenmayer/unison | grep 'Downloaded newer image for'")
77
+ if system("docker pull eugenmayer/unison:2.51.2.0 | grep 'Downloaded newer image for'")
90
78
  say_status 'ok', 'Downloaded newer image for unison', :green
91
79
  @newer_image_found = true
92
80
  else
@@ -40,7 +40,9 @@ class UpgradeChecker
40
40
 
41
41
  def self.get_current_version
42
42
  path = File.expand_path('../../../', __FILE__)
43
- return File.read("#{path}/VERSION")
43
+ version = File.read("#{path}/VERSION")
44
+ version.gsub!(/ *\n+/, "\n")
45
+ version.strip
44
46
  end
45
47
 
46
48
  def docker_sync_update_check
@@ -98,7 +100,7 @@ class UpgradeChecker
98
100
 
99
101
  if Gem::Version.new(last_upgraded_version) < Gem::Version.new('0.4.2')
100
102
  checker = UpdateChecker.new
101
- checker.check_unison_hostsync_image
103
+ checker.check_unison_image
102
104
 
103
105
  Thor::Shell::Basic.new.say_status 'warning', "The native_osx is NOW ONLY for docker-for-mac, this is due to https://github.com/EugenMayer/docker-sync/issues/346\n\nThat means that unison is picked as a default automatically if you use docker-machine", :red
104
106
 
@@ -109,17 +111,28 @@ class UpgradeChecker
109
111
 
110
112
  if Gem::Version.new(last_upgraded_version) < Gem::Version.new('0.4.3')
111
113
  checker = UpdateChecker.new
112
- checker.check_unison_hostsync_image
114
+ checker.check_unison_image
113
115
  end
114
116
 
115
117
  if Gem::Version.new(last_upgraded_version) < Gem::Version.new('0.4.4')
116
118
  checker = UpdateChecker.new
117
- checker.check_unison_hostsync_image
119
+ checker.check_unison_image
118
120
  end
119
121
 
120
122
  if Gem::Version.new(last_upgraded_version) < Gem::Version.new('0.4.5')
121
123
  checker = UpdateChecker.new
122
- checker.check_unison_hostsync_image
124
+ checker.check_unison_image
125
+ end
126
+
127
+ if Gem::Version.new(last_upgraded_version) < Gem::Version.new('0.5.5')
128
+ checker = UpdateChecker.new
129
+ checker.check_unison_image
130
+
131
+ Thor::Shell::Basic.new.say_status 'warning', "There has been a major unison update. Please clean and restart all your stacks. If you are using the unison strategy, please upgrade unison by doing 'brew update && brew upgrade unison' to upgrade to 2.51.2", :red
132
+
133
+ unless Thor::Shell::Basic.new.yes?('Just wanted you to know that! (y/N)')
134
+ exit 1
135
+ end
123
136
  end
124
137
 
125
138
  # update the upgrade_status
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker-sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugen Mayer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-12 00:00:00.000000000 Z
11
+ date: 2018-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor