kamal 2.0.0.beta1 → 2.0.0.beta2
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/base.rb +13 -2
- data/lib/kamal/cli/build.rb +20 -18
- data/lib/kamal/cli/main.rb +3 -3
- data/lib/kamal/cli/proxy.rb +0 -11
- data/lib/kamal/commands/app/execution.rb +1 -0
- data/lib/kamal/commands/hook.rb +7 -4
- data/lib/kamal/commands/proxy.rb +1 -6
- data/lib/kamal/configuration.rb +1 -11
- data/lib/kamal/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ecbda147c5d6acff593f449f0ba0aa0f721bbbe56fbe2718819a55539ff5a66
|
4
|
+
data.tar.gz: 5d83d711f125217fd1d0d1f1ef82807d8fe1e7a04bdb0bb73c22a2614037720b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '049f3a8e91a724d1d43d9cea996231b362fd0f3bb325c3488827c1d83aec07c6f50a6cf5f4206ea80632d8901438c20b731f3170be665a5026081d7417f099a1'
|
7
|
+
data.tar.gz: fc061ceab3bff080b5f24f3206df556c756c9122be125eccd85591bf36a7740c957df77244af1ee72d7770ed7052895e59336d6cb5f794abb300437ba2e057b7
|
data/lib/kamal/cli/base.rb
CHANGED
@@ -135,8 +135,10 @@ module Kamal::Cli
|
|
135
135
|
details = { hosts: KAMAL.hosts.join(","), command: command, subcommand: subcommand }
|
136
136
|
|
137
137
|
say "Running the #{hook} hook...", :magenta
|
138
|
-
|
139
|
-
|
138
|
+
with_env KAMAL.hook.env(**details, **extra_details) do
|
139
|
+
run_locally do
|
140
|
+
execute *KAMAL.hook.run(hook)
|
141
|
+
end
|
140
142
|
rescue SSHKit::Command::Failed => e
|
141
143
|
raise HookError.new("Hook `#{hook}` failed:\n#{e.message}")
|
142
144
|
end
|
@@ -183,5 +185,14 @@ module Kamal::Cli
|
|
183
185
|
execute(*KAMAL.server.ensure_run_directory)
|
184
186
|
end
|
185
187
|
end
|
188
|
+
|
189
|
+
def with_env(env)
|
190
|
+
current_env = ENV.to_h.dup
|
191
|
+
ENV.update(env)
|
192
|
+
yield
|
193
|
+
ensure
|
194
|
+
ENV.clear
|
195
|
+
ENV.update(current_env)
|
196
|
+
end
|
186
197
|
end
|
187
198
|
end
|
data/lib/kamal/cli/build.rb
CHANGED
@@ -30,28 +30,30 @@ class Kamal::Cli::Build < Kamal::Cli::Base
|
|
30
30
|
say "Building with uncommitted changes:\n #{uncommitted_changes}", :yellow
|
31
31
|
end
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
33
|
+
with_env(KAMAL.config.builder.secrets) do
|
34
|
+
run_locally do
|
35
|
+
begin
|
36
|
+
execute *KAMAL.builder.inspect_builder
|
37
|
+
rescue SSHKit::Command::Failed => e
|
38
|
+
if e.message =~ /(context not found|no builder|no compatible builder|does not exist)/
|
39
|
+
warn "Missing compatible builder, so creating a new one first"
|
40
|
+
begin
|
41
|
+
cli.remove
|
42
|
+
rescue SSHKit::Command::Failed
|
43
|
+
raise unless e.message =~ /(context not found|no builder|does not exist)/
|
44
|
+
end
|
45
|
+
cli.create
|
46
|
+
else
|
47
|
+
raise
|
43
48
|
end
|
44
|
-
cli.create
|
45
|
-
else
|
46
|
-
raise
|
47
49
|
end
|
48
|
-
end
|
49
50
|
|
50
|
-
|
51
|
-
|
51
|
+
# Get the command here to ensure the Dir.chdir doesn't interfere with it
|
52
|
+
push = KAMAL.builder.push
|
52
53
|
|
53
|
-
|
54
|
-
|
54
|
+
KAMAL.with_verbosity(:debug) do
|
55
|
+
Dir.chdir(KAMAL.config.builder.build_directory) { execute *push }
|
56
|
+
end
|
55
57
|
end
|
56
58
|
end
|
57
59
|
end
|
data/lib/kamal/cli/main.rb
CHANGED
@@ -48,7 +48,7 @@ class Kamal::Cli::Main < Kamal::Cli::Base
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
run_hook "post-deploy", secrets: true, runtime: runtime.round
|
51
|
+
run_hook "post-deploy", secrets: true, runtime: runtime.round.to_s
|
52
52
|
end
|
53
53
|
|
54
54
|
desc "redeploy", "Deploy app to servers without bootstrapping servers, starting kamal-proxy, pruning, and registry login"
|
@@ -75,7 +75,7 @@ class Kamal::Cli::Main < Kamal::Cli::Base
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
run_hook "post-deploy", secrets: true, runtime: runtime.round
|
78
|
+
run_hook "post-deploy", secrets: true, runtime: runtime.round.to_s
|
79
79
|
end
|
80
80
|
|
81
81
|
desc "rollback [VERSION]", "Rollback app to VERSION"
|
@@ -99,7 +99,7 @@ class Kamal::Cli::Main < Kamal::Cli::Base
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
-
run_hook "post-deploy", secrets: true, runtime: runtime.round if rolled_back
|
102
|
+
run_hook "post-deploy", secrets: true, runtime: runtime.round.to_s if rolled_back
|
103
103
|
end
|
104
104
|
|
105
105
|
desc "details", "Show details about all containers"
|
data/lib/kamal/cli/proxy.rb
CHANGED
@@ -167,7 +167,6 @@ class Kamal::Cli::Proxy < Kamal::Cli::Base
|
|
167
167
|
stop
|
168
168
|
remove_container
|
169
169
|
remove_image
|
170
|
-
remove_host_directory
|
171
170
|
end
|
172
171
|
end
|
173
172
|
end
|
@@ -192,16 +191,6 @@ class Kamal::Cli::Proxy < Kamal::Cli::Base
|
|
192
191
|
end
|
193
192
|
end
|
194
193
|
|
195
|
-
desc "remove_host_directory", "Remove proxy directory from servers", hide: true
|
196
|
-
def remove_host_directory
|
197
|
-
with_lock do
|
198
|
-
on(KAMAL.proxy_hosts) do
|
199
|
-
execute *KAMAL.auditor.record("Removed #{KAMAL.config.proxy_directory}"), verbosity: :debug
|
200
|
-
execute *KAMAL.proxy.remove_host_directory, raise_on_non_zero_exit: false
|
201
|
-
end
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
194
|
private
|
206
195
|
def removal_allowed?(force)
|
207
196
|
on(KAMAL.proxy_hosts) do |host|
|
data/lib/kamal/commands/hook.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
class Kamal::Commands::Hook < Kamal::Commands::Base
|
2
|
-
def run(hook
|
3
|
-
|
4
|
-
|
2
|
+
def run(hook)
|
3
|
+
[ hook_file(hook) ]
|
4
|
+
end
|
5
5
|
|
6
|
-
|
6
|
+
def env(secrets: false, **details)
|
7
|
+
tags(**details).env.tap do |env|
|
8
|
+
env.merge!(config.secrets.to_h) if secrets
|
9
|
+
end
|
7
10
|
end
|
8
11
|
|
9
12
|
def hook_exists?(hook)
|
data/lib/kamal/commands/proxy.rb
CHANGED
@@ -8,8 +8,7 @@ class Kamal::Commands::Proxy < Kamal::Commands::Base
|
|
8
8
|
"--detach",
|
9
9
|
"--restart", "unless-stopped",
|
10
10
|
*config.proxy_publish_args,
|
11
|
-
"--volume", "
|
12
|
-
*config.proxy_config_volume.docker_args,
|
11
|
+
"--volume", "kamal-proxy-config:/home/kamal-proxy/.config/kamal-proxy",
|
13
12
|
*config.logging_args,
|
14
13
|
config.proxy_image
|
15
14
|
end
|
@@ -57,10 +56,6 @@ class Kamal::Commands::Proxy < Kamal::Commands::Base
|
|
57
56
|
docker :image, :prune, "--all", "--force", "--filter", "label=org.opencontainers.image.title=kamal-proxy"
|
58
57
|
end
|
59
58
|
|
60
|
-
def remove_host_directory
|
61
|
-
remove_directory config.proxy_directory
|
62
|
-
end
|
63
|
-
|
64
59
|
def cleanup_traefik
|
65
60
|
chain \
|
66
61
|
docker(:container, :stop, "traefik"),
|
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.4.0"
|
18
18
|
PROXY_HTTP_PORT = 80
|
19
19
|
PROXY_HTTPS_PORT = 443
|
20
20
|
|
@@ -216,10 +216,6 @@ class Kamal::Configuration
|
|
216
216
|
File.join apps_directory, [ service, destination ].compact.join("-")
|
217
217
|
end
|
218
218
|
|
219
|
-
def proxy_directory
|
220
|
-
File.join run_directory, "proxy"
|
221
|
-
end
|
222
|
-
|
223
219
|
def env_directory
|
224
220
|
File.join app_directory, "env"
|
225
221
|
end
|
@@ -262,12 +258,6 @@ class Kamal::Configuration
|
|
262
258
|
"kamal-proxy"
|
263
259
|
end
|
264
260
|
|
265
|
-
def proxy_config_volume
|
266
|
-
Kamal::Configuration::Volume.new \
|
267
|
-
host_path: File.join(proxy_directory, "config"),
|
268
|
-
container_path: "/home/kamal-proxy/.config/kamal-proxy"
|
269
|
-
end
|
270
|
-
|
271
261
|
|
272
262
|
def to_h
|
273
263
|
{
|
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.beta2
|
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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|