kamal 2.0.0.rc3 → 2.0.0
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 +4 -4
- data/lib/kamal/cli/proxy.rb +40 -0
- data/lib/kamal/cli/templates/sample_hooks/pre-proxy-reboot.sample +1 -1
- data/lib/kamal/commands/proxy.rb +17 -2
- data/lib/kamal/configuration/proxy.rb +1 -1
- data/lib/kamal/configuration.rb +15 -3
- data/lib/kamal/secrets/adapters/last_pass.rb +2 -2
- 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: d6fd8cd960f0fd6434ee39f897eb22356bcf5d374476ccd71e1cd0fb34aa547e
|
4
|
+
data.tar.gz: 609c5d520f27e51a28a09e9db7f56023fadad1125b1ca5f78cd4c72044d23952
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f88f3d860d07fd44b69688eebb0d285b651db56263c22cd1546cff08e2bbbd3119a50a5ad6e7155b02e7d5b1b2e260a8f56e01d7a6c1115095de574bf14df596
|
7
|
+
data.tar.gz: bf4b40fe0f56affbbd57dc550301fc902fd769e4910d51f2ecc704d45674c315dd70d4a289a865cc2f91e0e1a571c8e8bbd9cb358a25fe18fc0a3e149ec52206
|
data/lib/kamal/cli/proxy.rb
CHANGED
@@ -21,6 +21,36 @@ class Kamal::Cli::Proxy < Kamal::Cli::Base
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
desc "boot_config <set|get|clear>", "Mange kamal-proxy boot configuration"
|
25
|
+
option :publish, type: :boolean, default: true, desc: "Publish the proxy ports on the host"
|
26
|
+
option :http_port, type: :numeric, default: Kamal::Configuration::PROXY_HTTP_PORT, desc: "HTTP port to publish on the host"
|
27
|
+
option :https_port, type: :numeric, default: Kamal::Configuration::PROXY_HTTPS_PORT, desc: "HTTPS port to publish on the host"
|
28
|
+
option :docker_options, type: :array, default: [], desc: "Docker options to pass to the proxy container", banner: "option=value option2=value2"
|
29
|
+
def boot_config(subcommand)
|
30
|
+
case subcommand
|
31
|
+
when "set"
|
32
|
+
boot_options = [
|
33
|
+
*(KAMAL.config.proxy_publish_args(options[:http_port], options[:https_port]) if options[:publish]),
|
34
|
+
*options[:docker_options].map { |option| "--#{option}" }
|
35
|
+
]
|
36
|
+
|
37
|
+
on(KAMAL.proxy_hosts) do |host|
|
38
|
+
execute(*KAMAL.proxy.ensure_proxy_directory)
|
39
|
+
upload! StringIO.new(boot_options.join(" ")), KAMAL.config.proxy_options_file
|
40
|
+
end
|
41
|
+
when "get"
|
42
|
+
on(KAMAL.proxy_hosts) do |host|
|
43
|
+
puts "Host #{host}: #{capture_with_info(*KAMAL.proxy.get_boot_options)}"
|
44
|
+
end
|
45
|
+
when "reset"
|
46
|
+
on(KAMAL.proxy_hosts) do |host|
|
47
|
+
execute *KAMAL.proxy.reset_boot_options
|
48
|
+
end
|
49
|
+
else
|
50
|
+
raise ArgumentError, "Unknown boot_config subcommand #{subcommand}"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
24
54
|
desc "reboot", "Reboot proxy on servers (stop container, remove container, start new container)"
|
25
55
|
option :rolling, type: :boolean, default: false, desc: "Reboot proxy on hosts in sequence, rather than in parallel"
|
26
56
|
option :confirmed, aliases: "-y", type: :boolean, default: false, desc: "Proceed without confirmation question"
|
@@ -169,6 +199,7 @@ class Kamal::Cli::Proxy < Kamal::Cli::Base
|
|
169
199
|
stop
|
170
200
|
remove_container
|
171
201
|
remove_image
|
202
|
+
remove_proxy_directory
|
172
203
|
end
|
173
204
|
end
|
174
205
|
end
|
@@ -193,6 +224,15 @@ class Kamal::Cli::Proxy < Kamal::Cli::Base
|
|
193
224
|
end
|
194
225
|
end
|
195
226
|
|
227
|
+
desc "remove_proxy_directory", "Remove the proxy directory from servers", hide: true
|
228
|
+
def remove_proxy_directory
|
229
|
+
with_lock do
|
230
|
+
on(KAMAL.proxy_hosts) do
|
231
|
+
execute *KAMAL.proxy.remove_proxy_directory, raise_on_non_zero_exit: false
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
196
236
|
private
|
197
237
|
def removal_allowed?(force)
|
198
238
|
on(KAMAL.proxy_hosts) do |host|
|
data/lib/kamal/commands/proxy.rb
CHANGED
@@ -7,9 +7,8 @@ class Kamal::Commands::Proxy < Kamal::Commands::Base
|
|
7
7
|
"--network", "kamal",
|
8
8
|
"--detach",
|
9
9
|
"--restart", "unless-stopped",
|
10
|
-
*config.proxy_publish_args,
|
11
10
|
"--volume", "kamal-proxy-config:/home/kamal-proxy/.config/kamal-proxy",
|
12
|
-
|
11
|
+
"\$\(#{get_boot_options.join(" ")}\)",
|
13
12
|
config.proxy_image
|
14
13
|
end
|
15
14
|
|
@@ -65,6 +64,22 @@ class Kamal::Commands::Proxy < Kamal::Commands::Base
|
|
65
64
|
)
|
66
65
|
end
|
67
66
|
|
67
|
+
def ensure_proxy_directory
|
68
|
+
make_directory config.proxy_directory
|
69
|
+
end
|
70
|
+
|
71
|
+
def remove_proxy_directory
|
72
|
+
remove_directory config.proxy_directory
|
73
|
+
end
|
74
|
+
|
75
|
+
def get_boot_options
|
76
|
+
combine [ :cat, config.proxy_options_file ], [ :echo, "\"#{config.proxy_options_default.join(" ")}\"" ], by: "||"
|
77
|
+
end
|
78
|
+
|
79
|
+
def reset_boot_options
|
80
|
+
remove_file config.proxy_options_file
|
81
|
+
end
|
82
|
+
|
68
83
|
private
|
69
84
|
def container_name
|
70
85
|
config.proxy_container_name
|
@@ -29,7 +29,7 @@ class Kamal::Configuration::Proxy
|
|
29
29
|
def deploy_options
|
30
30
|
{
|
31
31
|
host: proxy_config["host"],
|
32
|
-
tls: proxy_config["ssl"],
|
32
|
+
tls: proxy_config["ssl"] ? true : nil,
|
33
33
|
"deploy-timeout": seconds_duration(config.deploy_timeout),
|
34
34
|
"drain-timeout": seconds_duration(config.drain_timeout),
|
35
35
|
"health-check-interval": seconds_duration(proxy_config.dig("healthcheck", "interval")),
|
data/lib/kamal/configuration.rb
CHANGED
@@ -14,7 +14,7 @@ class Kamal::Configuration
|
|
14
14
|
|
15
15
|
include Validation
|
16
16
|
|
17
|
-
PROXY_MINIMUM_VERSION = "v0.
|
17
|
+
PROXY_MINIMUM_VERSION = "v0.6.0"
|
18
18
|
PROXY_HTTP_PORT = 80
|
19
19
|
PROXY_HTTPS_PORT = 443
|
20
20
|
|
@@ -246,8 +246,12 @@ class Kamal::Configuration
|
|
246
246
|
env_tags.detect { |t| t.name == name.to_s }
|
247
247
|
end
|
248
248
|
|
249
|
-
def proxy_publish_args
|
250
|
-
argumentize "--publish", [ "#{
|
249
|
+
def proxy_publish_args(http_port, https_port)
|
250
|
+
argumentize "--publish", [ "#{http_port}:#{PROXY_HTTP_PORT}", "#{https_port}:#{PROXY_HTTPS_PORT}" ]
|
251
|
+
end
|
252
|
+
|
253
|
+
def proxy_options_default
|
254
|
+
proxy_publish_args PROXY_HTTP_PORT, PROXY_HTTPS_PORT
|
251
255
|
end
|
252
256
|
|
253
257
|
def proxy_image
|
@@ -258,6 +262,14 @@ class Kamal::Configuration
|
|
258
262
|
"kamal-proxy"
|
259
263
|
end
|
260
264
|
|
265
|
+
def proxy_directory
|
266
|
+
File.join run_directory, "proxy"
|
267
|
+
end
|
268
|
+
|
269
|
+
def proxy_options_file
|
270
|
+
File.join proxy_directory, "options"
|
271
|
+
end
|
272
|
+
|
261
273
|
|
262
274
|
def to_h
|
263
275
|
{
|
@@ -3,7 +3,7 @@ class Kamal::Secrets::Adapters::LastPass < Kamal::Secrets::Adapters::Base
|
|
3
3
|
def login(account)
|
4
4
|
unless loggedin?(account)
|
5
5
|
`lpass login #{account.shellescape}`
|
6
|
-
raise RuntimeError, "Failed to login to
|
6
|
+
raise RuntimeError, "Failed to login to LastPass" unless $?.success?
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
@@ -13,7 +13,7 @@ class Kamal::Secrets::Adapters::LastPass < Kamal::Secrets::Adapters::Base
|
|
13
13
|
|
14
14
|
def fetch_secrets(secrets, account:, session:)
|
15
15
|
items = `lpass show #{secrets.map(&:shellescape).join(" ")} --json`
|
16
|
-
raise RuntimeError, "Could not read #{secrets} from
|
16
|
+
raise RuntimeError, "Could not read #{secrets} from LastPass" unless $?.success?
|
17
17
|
|
18
18
|
items = JSON.parse(items)
|
19
19
|
|
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: 2.0.0
|
4
|
+
version: 2.0.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-09-
|
11
|
+
date: 2024-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -336,7 +336,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
336
336
|
- !ruby/object:Gem::Version
|
337
337
|
version: '0'
|
338
338
|
requirements: []
|
339
|
-
rubygems_version: 3.
|
339
|
+
rubygems_version: 3.3.22
|
340
340
|
signing_key:
|
341
341
|
specification_version: 4
|
342
342
|
summary: Deploy web apps in containers to servers running Docker with zero downtime.
|