dash 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 749c8e286224f96b085fc8c325affcfde1cafaa18824e1405f880cc1aea966b1
4
- data.tar.gz: 0dab0ae01b69f742e58551caaeee3352f98548c5a6265e98fcbe2de3025b50d1
3
+ metadata.gz: 8651f7a91510814ccfa26283d3aef0f364caa5c99419a76ee6cdb15820680148
4
+ data.tar.gz: aef6a718f6f4d1427d6e20f73e3096eed8436426e32b6c6ea0a40f52e3588261
5
5
  SHA512:
6
- metadata.gz: 7b8a1e07a72a34388817185a8e476b4c400a90061292fe9d143a9a67ab1e5e5d2a87cba154077d151922a306f577dce9d04d60ecef371296ca9b2e3c49a277cb
7
- data.tar.gz: 5b396df37122ed76ff2e5b7b2b694940a9eb1bcaa5bf31ed0de3f01039bf59836224f225da0a59acc24445f1d6a3dfe19165f2c83fd2e4a4023e68a1ec41c2c6
6
+ metadata.gz: da7a30a00bf6f622aeeb13889670133285a202c5c4481a7b83cc8d980624db48a0c5d8007e0efaf723489d4ea20672999dc8791e5ff4240b6f4fa65ba54a7380
7
+ data.tar.gz: cdcf6391c305f5e84125687bb6f4174729a7c09819a08a5c8a26bd8de2fd5b10933606387f581187c94151574c2607d803689e3d97c2cffa00beab9e26375f09
@@ -61,12 +61,17 @@ class Dash::Cli::Doctor::HostChecks
61
61
 
62
62
  def proxy_checks
63
63
  version, version_error = capture_proxy_version
64
+ # A host that has not been through the stage-3c rename is still running
65
+ # kamal-proxy. Without asking about it too, the version check reports "not
66
+ # running" and the ports check blames a foreign process for the ports that
67
+ # container legitimately holds — failing the very deploy that migrates it.
68
+ legacy_version = version.present? ? nil : capture_legacy_proxy_version
64
69
 
65
70
  {
66
71
  proxy_image: proxy_image_check,
67
- proxy_version: proxy_version_check(version, version_error),
72
+ proxy_version: proxy_version_check(version, version_error, legacy_version),
68
73
  proxy_socket: proxy_socket_check(proxy_running: version.present?),
69
- ports: ports_check(proxy_running: version.present?)
74
+ ports: ports_check(proxy_running: version.present?, legacy_proxy_running: legacy_version.present?)
70
75
  }
71
76
  end
72
77
 
@@ -76,6 +81,14 @@ class Dash::Cli::Doctor::HostChecks
76
81
  [ nil, e ]
77
82
  end
78
83
 
84
+ # Best-effort: a host with no legacy container simply reports nothing, and
85
+ # any error here must not turn into a failing check of its own.
86
+ def capture_legacy_proxy_version
87
+ capture_with_info(*DASH.proxy(host).version(name: Dash::Configuration::Proxy::LEGACY_CONTAINER_NAME)).strip.presence
88
+ rescue StandardError
89
+ nil
90
+ end
91
+
79
92
  def proxy_image_check
80
93
  image = expected_proxy_image
81
94
 
@@ -88,11 +101,15 @@ class Dash::Cli::Doctor::HostChecks
88
101
  result :proxy_image, :fail, "#{e.class}: #{e.message}"
89
102
  end
90
103
 
91
- def proxy_version_check(version, error)
104
+ def proxy_version_check(version, error, legacy_version = nil)
92
105
  minimum = Dash::Configuration::Proxy::Run::MINIMUM_VERSION
93
106
 
94
107
  if error
95
108
  result :proxy_version, :warn, "could not determine the running version (#{error.message})"
109
+ elsif version.nil? && legacy_version.present?
110
+ result :proxy_version, :ok,
111
+ "#{Dash::Configuration::Proxy::LEGACY_CONTAINER_NAME} #{legacy_version} is running; it is renamed to " \
112
+ "#{Dash::Configuration::Proxy::CONTAINER_NAME} on the next deploy, which briefly interrupts this host"
96
113
  elsif version.nil?
97
114
  result :proxy_version, :ok, "not running (will be started on deploy)"
98
115
  elsif Dash::Utils.older_version?(version, minimum)
@@ -146,7 +163,7 @@ class Dash::Cli::Doctor::HostChecks
146
163
  DASH.config.roles.any? { |role| role.running_proxy? && role.proxy.proxy_config["sleep"].present? }
147
164
  end
148
165
 
149
- def ports_check(proxy_running:)
166
+ def ports_check(proxy_running:, legacy_proxy_running: false)
150
167
  run_config = DASH.config.proxy_run(host)
151
168
  return result(:ports, :ok, "proxy ports are not published, nothing to check") if run_config && !run_config.publish?
152
169
 
@@ -155,6 +172,10 @@ class Dash::Cli::Doctor::HostChecks
155
172
 
156
173
  if proxy_running
157
174
  result :ports, :ok, "ports #{http_port}/#{https_port} held by the running dash-proxy"
175
+ elsif legacy_proxy_running
176
+ result :ports, :ok,
177
+ "ports #{http_port}/#{https_port} held by the running #{Dash::Configuration::Proxy::LEGACY_CONTAINER_NAME}, " \
178
+ "replaced on the next deploy"
158
179
  elsif (busy = busy_ports(http_port, https_port)).any?
159
180
  result :ports, :fail, "port(s) #{busy.join(", ")} already in use by another process"
160
181
  else
@@ -106,9 +106,12 @@ class Dash::Commands::Proxy < Dash::Commands::Base
106
106
  docker :ps, "--filter", "'name=^#{container_name}$'"
107
107
  end
108
108
 
109
- def version
109
+ # `name:` so the doctor can also ask about the pre-rename container: during
110
+ # the stage-3c transition a host still runs kamal-proxy, and a check that only
111
+ # ever looks at dash-proxy concludes no proxy is running.
112
+ def version(name: container_name)
110
113
  pipe \
111
- docker(:inspect, container_name, "--format '{{.Config.Image}}'"),
114
+ docker(:inspect, name, "--format '{{.Config.Image}}'"),
112
115
  [ :awk, "-F:", "'{print \$NF}'" ]
113
116
  end
114
117
 
data/lib/dash/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dash
2
- VERSION = "4.0.0"
2
+ VERSION = "4.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dash
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson