kamal 1.8.2 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kamal/cli/accessory.rb +19 -0
- data/lib/kamal/cli/base.rb +4 -0
- data/lib/kamal/cli/main.rb +31 -0
- data/lib/kamal/cli/traefik.rb +40 -0
- data/lib/kamal/commander/specifics.rb +1 -1
- data/lib/kamal/commander.rb +7 -0
- data/lib/kamal/commands/builder/multiarch/remote.rb +4 -0
- data/lib/kamal/commands/traefik.rb +9 -0
- data/lib/kamal/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0a4a9384d3b2777b9658de6f8308fa3a57e7ee2b33eb037aa3fb9ff8ebff888
|
4
|
+
data.tar.gz: ec4a27d73c1ffc847689fd6705becb900729aba8f297d60fcad9cff216e91d2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f05b438b853f996e0784011dde4aeaf51daa0f62b01e0a607469915f557a9a99bd708e93a0ea216e1b20970afcf530d3a9eccc7f1449a51ec4cf7bb86521056b
|
7
|
+
data.tar.gz: 1538c364fdfa4a416b140cf88a4cefb8d456ed7eb56010ebb3ce29673c37f700cec6d8ac391078bc5092fae131dcf9059fd42f83d43f6f2037210b13473656f6
|
data/lib/kamal/cli/accessory.rb
CHANGED
@@ -222,6 +222,25 @@ class Kamal::Cli::Accessory < Kamal::Cli::Base
|
|
222
222
|
end
|
223
223
|
end
|
224
224
|
|
225
|
+
desc "downgrade", "Downgrade accessories from Kamal 2 to 1.9"
|
226
|
+
option :rolling, type: :boolean, default: false, desc: "Upgrade one host at a time"
|
227
|
+
option :confirmed, aliases: "-y", type: :boolean, default: false, desc: "Proceed without confirmation question"
|
228
|
+
def downgrade(name)
|
229
|
+
confirming "This will restart all accessories" do
|
230
|
+
with_lock do
|
231
|
+
host_groups = options[:rolling] ? KAMAL.accessory_hosts : [ KAMAL.accessory_hosts ]
|
232
|
+
host_groups.each do |hosts|
|
233
|
+
host_list = Array(hosts).join(",")
|
234
|
+
KAMAL.with_specific_hosts(hosts) do
|
235
|
+
say "Downgrading #{name} accessories on #{host_list}...", :magenta
|
236
|
+
reboot name
|
237
|
+
say "Downgraded #{name} accessories on #{host_list}...", :magenta
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
225
244
|
private
|
226
245
|
def with_accessory(name)
|
227
246
|
if KAMAL.config.accessory(name)
|
data/lib/kamal/cli/base.rb
CHANGED
@@ -206,6 +206,10 @@ module Kamal::Cli
|
|
206
206
|
instance_variable_get("@_invocations").first
|
207
207
|
end
|
208
208
|
|
209
|
+
def reset_invocation(cli_class)
|
210
|
+
instance_variable_get("@_invocations")[cli_class].pop
|
211
|
+
end
|
212
|
+
|
209
213
|
def ensure_run_and_locks_directory
|
210
214
|
on(KAMAL.hosts) do
|
211
215
|
execute(*KAMAL.server.ensure_run_directory)
|
data/lib/kamal/cli/main.rb
CHANGED
@@ -217,6 +217,37 @@ class Kamal::Cli::Main < Kamal::Cli::Base
|
|
217
217
|
end
|
218
218
|
end
|
219
219
|
|
220
|
+
desc "downgrade", "Downgrade from Kamal 2 to 1.9"
|
221
|
+
option :confirmed, aliases: "-y", type: :boolean, default: false, desc: "Proceed without confirmation question"
|
222
|
+
option :rolling, type: :boolean, default: false, desc: "Downgrade one host at a time"
|
223
|
+
def downgrade
|
224
|
+
confirming "This will replace Traefik with kamal-proxy and restart all accessories" do
|
225
|
+
with_lock do
|
226
|
+
if options[:rolling]
|
227
|
+
(KAMAL.hosts | KAMAL.accessory_hosts).each do |host|
|
228
|
+
KAMAL.with_specific_hosts(host) do
|
229
|
+
say "Downgrading #{host}...", :magenta
|
230
|
+
if KAMAL.hosts.include?(host)
|
231
|
+
invoke "kamal:cli:traefik:downgrade", [], options.merge(confirmed: true, rolling: false)
|
232
|
+
reset_invocation(Kamal::Cli::Traefik)
|
233
|
+
end
|
234
|
+
if KAMAL.accessory_hosts.include?(host)
|
235
|
+
invoke "kamal:cli:accessory:downgrade", [ "all" ], options.merge(confirmed: true, rolling: false)
|
236
|
+
reset_invocation(Kamal::Cli::Accessory)
|
237
|
+
end
|
238
|
+
say "Downgraded #{host}", :magenta
|
239
|
+
end
|
240
|
+
end
|
241
|
+
else
|
242
|
+
say "Downgrading all hosts...", :magenta
|
243
|
+
invoke "kamal:cli:traefik:downgrade", [], options.merge(confirmed: true)
|
244
|
+
invoke "kamal:cli:accessory:downgrade", [ "all" ], options.merge(confirmed: true)
|
245
|
+
say "Downgraded all hosts", :magenta
|
246
|
+
end
|
247
|
+
end
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
220
251
|
desc "version", "Show Kamal version"
|
221
252
|
def version
|
222
253
|
puts Kamal::VERSION
|
data/lib/kamal/cli/traefik.rb
CHANGED
@@ -119,4 +119,44 @@ class Kamal::Cli::Traefik < Kamal::Cli::Base
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
end
|
122
|
+
|
123
|
+
desc "downgrade", "Downgrade to Traefik on servers (stop container, remove container, start new container, reboot app)"
|
124
|
+
option :rolling, type: :boolean, default: false, desc: "Reboot proxy on hosts in sequence, rather than in parallel"
|
125
|
+
option :confirmed, aliases: "-y", type: :boolean, default: false, desc: "Proceed without confirmation question"
|
126
|
+
def downgrade
|
127
|
+
invoke_options = { "version" => KAMAL.config.latest_tag }.merge(options)
|
128
|
+
|
129
|
+
confirming "This will cause a brief outage on each host. Are you sure?" do
|
130
|
+
host_groups = options[:rolling] ? KAMAL.hosts : [ KAMAL.hosts ]
|
131
|
+
host_groups.each do |hosts|
|
132
|
+
host_list = Array(hosts).join(",")
|
133
|
+
say "Downgrading to Traefik on #{host_list}...", :magenta
|
134
|
+
run_hook "pre-traefik-reboot", hosts: host_list
|
135
|
+
on(hosts) do |host|
|
136
|
+
execute *KAMAL.auditor.record("Rebooted Traefik"), verbosity: :debug
|
137
|
+
execute *KAMAL.registry.login
|
138
|
+
|
139
|
+
"Stopping and removing kamal-proxy on #{host}, if running..."
|
140
|
+
execute *KAMAL.traefik.cleanup_kamal_proxy
|
141
|
+
|
142
|
+
"Stopping and removing Traefik on #{host}, if running..."
|
143
|
+
execute *KAMAL.traefik.stop, raise_on_non_zero_exit: false
|
144
|
+
execute *KAMAL.traefik.remove_container
|
145
|
+
execute *KAMAL.traefik.remove_image
|
146
|
+
end
|
147
|
+
|
148
|
+
KAMAL.with_specific_hosts(hosts) do
|
149
|
+
invoke "kamal:cli:traefik:boot", [], invoke_options
|
150
|
+
reset_invocation(Kamal::Cli::Traefik)
|
151
|
+
invoke "kamal:cli:app:boot", [], invoke_options
|
152
|
+
reset_invocation(Kamal::Cli::App)
|
153
|
+
invoke "kamal:cli:prune:all", [], invoke_options
|
154
|
+
reset_invocation(Kamal::Cli::Prune)
|
155
|
+
end
|
156
|
+
|
157
|
+
run_hook "post-traefik-reboot", hosts: host_list
|
158
|
+
say "Downgraded to Traefik on #{host_list}", :magenta
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
122
162
|
end
|
data/lib/kamal/commander.rb
CHANGED
@@ -56,6 +56,13 @@ class Kamal::Commander
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
+
def with_specific_hosts(hosts)
|
60
|
+
original_hosts, self.specific_hosts = specific_hosts, hosts
|
61
|
+
yield
|
62
|
+
ensure
|
63
|
+
self.specific_hosts = original_hosts
|
64
|
+
end
|
65
|
+
|
59
66
|
def accessory_names
|
60
67
|
config.accessories&.collect(&:name) || []
|
61
68
|
end
|
@@ -62,6 +62,15 @@ class Kamal::Commands::Traefik < Kamal::Commands::Base
|
|
62
62
|
[ :rm, "-f", env.secrets_file ]
|
63
63
|
end
|
64
64
|
|
65
|
+
def cleanup_kamal_proxy
|
66
|
+
chain \
|
67
|
+
docker(:container, :stop, "kamal-proxy"),
|
68
|
+
combine(
|
69
|
+
docker(:container, :prune, "--force", "--filter", "label=org.opencontainers.image.title=kamal-proxy"),
|
70
|
+
docker(:image, :prune, "--all", "--force", "--filter", "label=org.opencontainers.image.title=kamal-proxy")
|
71
|
+
)
|
72
|
+
end
|
73
|
+
|
65
74
|
private
|
66
75
|
def publish_args
|
67
76
|
argumentize "--publish", port if publish?
|
data/lib/kamal/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kamal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -327,7 +327,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
327
327
|
- !ruby/object:Gem::Version
|
328
328
|
version: '0'
|
329
329
|
requirements: []
|
330
|
-
rubygems_version: 3.
|
330
|
+
rubygems_version: 3.3.22
|
331
331
|
signing_key:
|
332
332
|
specification_version: 4
|
333
333
|
summary: Deploy web apps in containers to servers running Docker with zero downtime.
|