docker-sync 0.5.5 → 0.5.6

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: a88e284e5884eb996bd63ce35feef44508aa275d
4
- data.tar.gz: 7d0c466307ff7b6cb86336e0b729f1795f0f376a
3
+ metadata.gz: 9348b2439ef75d3de7b56ef33a856825ef08c27b
4
+ data.tar.gz: 55dfdc5a30341018e3e69ca8e45610e681a02263
5
5
  SHA512:
6
- metadata.gz: 8823db30b0c6ca9eaa21aad241b6525595071028e75db3c307d295a4b1d3cf69cd0fced01a8a4757a73071f0b5135eaa3fc26186bbb499e17cd556d56f06dc16
7
- data.tar.gz: 0a0c5a4759a34b0dbec794903529f61a515918f5e46b160af8acd1b242e001d49e04fc5dd32bb7dcb634efc90d9a5c63ea9cb5758d8baefa87ab78b790d2e68b
6
+ metadata.gz: 97ab57f9c920bc3dc850d6296483844fd3b4d0bfbe22826b910399e2e4a1b508ff2e7bbe96d2b8f0bfb07a61b1977b1427e0f89edd698ce6a8f1bd6d1df0abdc
7
+ data.tar.gz: cad2dcbf92b259160cfda0cc5d2d9c8c01e71ffefaa181704fe3ce7d0d14de643c0314bbce3c8b24f05790e97f3be60b8e8ad121a5092014b5bf84e1afbc3737
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.5
1
+ 0.5.6
@@ -92,14 +92,15 @@ module DockerSync
92
92
  say_status 'ok', "creating #{container_name} container", :white if @options['verbose']
93
93
  run_privileged = ''
94
94
  run_privileged = '--privileged' if @options.key?('max_inotify_watches') #TODO: replace by the minimum capabilities required
95
+ tz_expression = '-e TZ=$(basename $(dirname `readlink /etc/localtime`))/$(basename `readlink /etc/localtime`)'
95
96
  say_status 'ok', 'Starting precopy', :white if @options['verbose']
96
97
  # we just run the precopy script and remove the container
97
- cmd = "docker run --rm -v \"#{volume_app_sync_name}:/app_sync\" -v \"#{host_sync_src}:/host_sync#{host_disk_mount_mode}\" -e HOST_VOLUME=/host_sync -e APP_VOLUME=/app_sync -e TZ=${TZ-`readlink /etc/localtime | sed -e 's,/usr/share/zoneinfo/,,'`} #{additional_docker_env} #{run_privileged} --name #{container_name} #{@docker_image} /usr/local/bin/precopy_appsync"
98
+ cmd = "docker run --rm -v \"#{volume_app_sync_name}:/app_sync\" -v \"#{host_sync_src}:/host_sync#{host_disk_mount_mode}\" -e HOST_VOLUME=/host_sync -e APP_VOLUME=/app_sync #{tz_expression} #{additional_docker_env} #{run_privileged} --name #{container_name} #{@docker_image} /usr/local/bin/precopy_appsync"
98
99
  say_status 'precopy', cmd, :white if @options['verbose']
99
100
  system(cmd) || raise('Precopy failed')
100
101
  say_status 'ok', 'Starting container', :white if @options['verbose']
101
102
  # this will be run below and start unison, since we did not manipulate CMD
102
- cmd = "docker run -d -v \"#{volume_app_sync_name}:/app_sync\" -v \"#{host_sync_src}:/host_sync#{host_disk_mount_mode}\" -e HOST_VOLUME=/host_sync -e APP_VOLUME=/app_sync -e TZ=${TZ-`readlink /etc/localtime | sed -e 's,/usr/share/zoneinfo/,,'`} #{additional_docker_env} #{run_privileged} --name #{container_name} #{@docker_image}"
103
+ cmd = "docker run -d -v \"#{volume_app_sync_name}:/app_sync\" -v \"#{host_sync_src}:/host_sync#{host_disk_mount_mode}\" -e HOST_VOLUME=/host_sync -e APP_VOLUME=/app_sync #{tz_expression} #{additional_docker_env} #{run_privileged} --name #{container_name} #{@docker_image}"
103
104
  else
104
105
  say_status 'ok', "starting #{container_name} container", :white if @options['verbose']
105
106
  cmd = "docker start #{container_name} && docker exec #{container_name} supervisorctl restart unison"
@@ -179,10 +179,17 @@ module DockerSync
179
179
  say_status 'ok', "#{container_name} container not running", :white if @options['verbose']
180
180
  exists = `docker ps --filter "status=exited" --filter "name=#{container_name}" --format "{{.Names}}" | grep '^#{container_name}$'`
181
181
  if exists == ''
182
- say_status 'ok', "creating #{container_name} container", :white if @options['verbose']
183
182
  run_privileged = ''
184
183
  run_privileged = '--privileged' if @options.key?('max_inotify_watches') #TODO: replace by the minimum capabilities required
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}"
184
+ tz_expression = '-e TZ=$(basename $(dirname `readlink /etc/localtime`))/$(basename `readlink /etc/localtime`)'
185
+ say_status 'ok', 'Starting precopy', :white if @options['verbose']
186
+ # we just run the precopy script and remove the container
187
+ cmd = "docker run --rm -v \"#{volume_name}:#{@options['dest']}\" -e APP_VOLUME=#{@options['dest']} #{tz_expression} #{additional_docker_env} #{run_privileged} --name #{container_name} #{@docker_image} /usr/local/bin/precopy_appsync"
188
+ say_status 'precopy', cmd, :white if @options['verbose']
189
+ system(cmd) || raise('Precopy failed')
190
+
191
+ say_status 'ok', "creating #{container_name} container", :white if @options['verbose']
192
+ cmd = "docker run -p '#{@options['sync_host_ip']}::#{UNISON_CONTAINER_PORT}' -v #{volume_name}:#{@options['dest']} -e APP_VOLUME=#{@options['dest']} #{tz_expression} #{additional_docker_env} #{run_privileged} --name #{container_name} -d #{@docker_image}"
186
193
  else
187
194
  say_status 'ok', "starting #{container_name} container", :white if @options['verbose']
188
195
  cmd = "docker start #{container_name} && docker exec #{container_name} supervisorctl restart unison"
@@ -85,7 +85,9 @@ class UpdateChecker
85
85
 
86
86
  def get_current_version
87
87
  path = File.expand_path('../../../', __FILE__)
88
- return File.read("#{path}/VERSION")
88
+ version = File.read("#{path}/VERSION")
89
+ version.strip
90
+ version
89
91
  end
90
92
 
91
93
  def docker_sync_update_check
@@ -41,8 +41,8 @@ class UpgradeChecker
41
41
  def self.get_current_version
42
42
  path = File.expand_path('../../../', __FILE__)
43
43
  version = File.read("#{path}/VERSION")
44
- version.gsub!(/ *\n+/, "\n")
45
44
  version.strip
45
+ version
46
46
  end
47
47
 
48
48
  def docker_sync_update_check
@@ -135,6 +135,17 @@ class UpgradeChecker
135
135
  end
136
136
  end
137
137
 
138
+ if Gem::Version.new(last_upgraded_version) < Gem::Version.new('0.5.6')
139
+ checker = UpdateChecker.new
140
+ checker.check_unison_image
141
+
142
+ Thor::Shell::Basic.new.say_status 'warning', "If you are upgrading from 0.5.4 or below, please run `brew update && brew upgrade unison` AND `docker-compose down && docker-sync clean` or `docker-sync-stack clean` since you need to recreate the sync container", :red
143
+
144
+ unless Thor::Shell::Basic.new.yes?('Sync will fail otherwise. Continue? (y/N)')
145
+ exit 1
146
+ end
147
+ end
148
+
138
149
  # update the upgrade_status
139
150
  @config.update! 'upgrade_status' => "#{UpgradeChecker.get_current_version}"
140
151
  end
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.5
4
+ version: 0.5.6
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-15 00:00:00.000000000 Z
11
+ date: 2018-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor