kamal 1.0.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7a1eccb289724a2ca99c9c5e8ffd23749a859f7080606206efec05c417fc751
4
- data.tar.gz: 8a0d9143b580ff01d820746675a98954fe75d6c5a21abcb80ed2b5a5ec0ae657
3
+ metadata.gz: 2470f58e93ad7f181c9a422a0eef08c741190cb897c962b83aeda9effd4862f5
4
+ data.tar.gz: df8ddd4bf5dcf6687fab747bcfb11689dbe58b846ab6e392e99694ce8bfdff88
5
5
  SHA512:
6
- metadata.gz: 153117a03e1fc92c96b6d8140096233afb792cfb9e227ace80cad5507df38969d5ef66d1342ed1ea838f43e7cef691f200b417c59a92419a9ac00c0cca4b3b6a
7
- data.tar.gz: 0fa78b7cec73a786e4e225e68cfb04a932a893ac8e7698c7361a9600b753564317089f5202ede5c83c2c7063a75d6ea1bd741b02181bf25f0f18833d561b21cd
6
+ metadata.gz: 7cef4c1ea22ffe3a0f80dbd2985cb3f3941e70dfcb35509a4ec7210124e517b0b7336ddd571370c32868d9d99442b9cc1186eb6a0cdefaa5db1b0475f117faae
7
+ data.tar.gz: 1f6d43624775bb9f1320692c3b4e5d061528b92763886f963cf184978e2405e478c5c6a55347316c69416f512bb5f70c970999d56e2e5c6937b6b83613338106
data/lib/kamal/cli/app.rb CHANGED
@@ -147,8 +147,12 @@ class Kamal::Cli::App < Kamal::Cli::Base
147
147
  using_version(version_or_latest) do |version|
148
148
  say "Launching command with version #{version} from new container...", :magenta
149
149
  on(KAMAL.hosts) do |host|
150
- execute *KAMAL.auditor.record("Executed cmd '#{cmd}' on app version #{version}"), verbosity: :debug
151
- puts_by_host host, capture_with_info(*KAMAL.app.execute_in_new_container(cmd))
150
+ roles = KAMAL.roles_on(host)
151
+
152
+ roles.each do |role|
153
+ execute *KAMAL.auditor.record("Executed cmd '#{cmd}' on app version #{version}"), verbosity: :debug
154
+ puts_by_host host, capture_with_info(*KAMAL.app(role: role).execute_in_new_container(cmd))
155
+ end
152
156
  end
153
157
  end
154
158
  end
@@ -24,6 +24,7 @@ module Kamal::Cli
24
24
 
25
25
  def initialize(*)
26
26
  super
27
+ @original_env = ENV.to_h.dup
27
28
  load_envs
28
29
  initialize_commander(options_with_subcommand_class_options)
29
30
  end
@@ -37,6 +38,12 @@ module Kamal::Cli
37
38
  end
38
39
  end
39
40
 
41
+ def reload_envs
42
+ ENV.clear
43
+ ENV.update(@original_env)
44
+ load_envs
45
+ end
46
+
40
47
  def options_with_subcommand_class_options
41
48
  options.merge(@_initializer.last[:class_options] || {})
42
49
  end
@@ -75,8 +82,6 @@ module Kamal::Cli
75
82
  def mutating
76
83
  return yield if KAMAL.holding_lock?
77
84
 
78
- KAMAL.config.ensure_env_available
79
-
80
85
  run_hook "pre-connect"
81
86
 
82
87
  ensure_run_directory
@@ -170,6 +170,7 @@ class Kamal::Cli::Main < Kamal::Cli::Base
170
170
  end
171
171
 
172
172
  desc "envify", "Create .env by evaluating .env.erb (or .env.staging.erb -> .env.staging when using -d staging)"
173
+ option :skip_push, aliases: "-P", type: :boolean, default: false, desc: "Skip .env file push"
173
174
  def envify
174
175
  if destination = options[:destination]
175
176
  env_template_path = ".env.#{destination}.erb"
@@ -179,10 +180,12 @@ class Kamal::Cli::Main < Kamal::Cli::Base
179
180
  env_path = ".env"
180
181
  end
181
182
 
182
- File.write(env_path, ERB.new(File.read(env_template_path)).result, perm: 0600)
183
+ File.write(env_path, ERB.new(File.read(env_template_path), trim_mode: "-").result, perm: 0600)
183
184
 
184
- load_envs # reload new file
185
- invoke "kamal:cli:env:push", options
185
+ unless options[:skip_push]
186
+ reload_envs
187
+ invoke "kamal:cli:env:push", options
188
+ end
186
189
  end
187
190
 
188
191
  desc "remove", "Remove Traefik, app, accessories, and registry session from servers"
@@ -18,6 +18,7 @@ class Kamal::Commands::App < Kamal::Commands::Base
18
18
  "--name", container_name,
19
19
  *(["--hostname", hostname] if hostname),
20
20
  "-e", "KAMAL_CONTAINER_NAME=\"#{container_name}\"",
21
+ "-e", "KAMAL_VERSION=\"#{config.version}\"",
21
22
  *role_config.env_args,
22
23
  *role_config.health_check_args,
23
24
  *config.logging_args,
@@ -16,6 +16,6 @@ class Kamal::Commands::Docker < Kamal::Commands::Base
16
16
 
17
17
  # Do we have superuser access to install Docker and start system services?
18
18
  def superuser?
19
- [ '[ "${EUID:-$(id -u)}" -eq 0 ]' ]
19
+ [ '[ "${EUID:-$(id -u)}" -eq 0 ] || command -v sudo >/dev/null || command -v su >/dev/null' ]
20
20
  end
21
21
  end
@@ -204,13 +204,6 @@ class Kamal::Configuration
204
204
  ensure_destination_if_required && ensure_required_keys_present && ensure_valid_kamal_version
205
205
  end
206
206
 
207
- # Will raise KeyError if any secret ENVs are missing
208
- def ensure_env_available
209
- roles.collect(&:env_file).each(&:to_s)
210
-
211
- true
212
- end
213
-
214
207
  def to_h
215
208
  {
216
209
  roles: role_names,
@@ -1,4 +1,5 @@
1
1
  require "active_support/core_ext/module/delegation"
2
+ require "sshkit"
2
3
 
3
4
  class Kamal::Utils::Sensitive
4
5
  # So SSHKit knows to redact these values.
data/lib/kamal/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kamal
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
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.0.0
4
+ version: 1.1.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: 2023-09-19 00:00:00.000000000 Z
11
+ date: 2023-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -270,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
270
  - !ruby/object:Gem::Version
271
271
  version: '0'
272
272
  requirements: []
273
- rubygems_version: 3.4.19
273
+ rubygems_version: 3.4.21
274
274
  signing_key:
275
275
  specification_version: 4
276
276
  summary: Deploy web apps in containers to servers running Docker with zero downtime.