dash 3.2.0 → 4.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/README.md +1 -1
- data/bin/dash +2 -2
- data/lib/{kamal → dash}/cli/accessory.rb +24 -24
- data/lib/dash/cli/alias/command.rb +10 -0
- data/lib/{kamal → dash}/cli/app/assets.rb +2 -2
- data/lib/{kamal → dash}/cli/app/boot.rb +16 -16
- data/lib/{kamal → dash}/cli/app/error_pages.rb +6 -6
- data/lib/{kamal → dash}/cli/app/rollout_boot.rb +6 -6
- data/lib/{kamal → dash}/cli/app/ssl_certificates.rb +3 -3
- data/lib/{kamal → dash}/cli/app.rb +87 -87
- data/lib/{kamal → dash}/cli/base.rb +72 -48
- data/lib/dash/cli/build/clone.rb +59 -0
- data/lib/{kamal → dash}/cli/build/port_forwarding.rb +1 -1
- data/lib/{kamal → dash}/cli/build.rb +45 -45
- data/lib/{kamal → dash}/cli/doctor/config_checks.rb +3 -3
- data/lib/{kamal → dash}/cli/doctor/endpoint_checks.rb +26 -8
- data/lib/{kamal → dash}/cli/doctor/host_checks.rb +22 -22
- data/lib/{kamal → dash}/cli/doctor.rb +9 -9
- data/lib/{kamal → dash}/cli/healthcheck/barrier.rb +2 -2
- data/lib/{kamal → dash}/cli/healthcheck/drift_error.rb +2 -2
- data/lib/dash/cli/healthcheck/error.rb +2 -0
- data/lib/{kamal → dash}/cli/healthcheck/poller.rb +7 -7
- data/lib/{kamal → dash}/cli/lock.rb +1 -1
- data/lib/dash/cli/main/migrate.rb +77 -0
- data/lib/{kamal → dash}/cli/main.rb +82 -71
- data/lib/{kamal → dash}/cli/proxy/drift.rb +3 -3
- data/lib/dash/cli/proxy/legacy_rename.rb +58 -0
- data/lib/{kamal → dash}/cli/proxy/loadbalancer_claim.rb +3 -3
- data/lib/{kamal → dash}/cli/proxy/loadbalancer_reboot.rb +23 -23
- data/lib/{kamal → dash}/cli/proxy/reboot.rb +21 -21
- data/lib/{kamal → dash}/cli/proxy.rb +178 -162
- data/lib/{kamal → dash}/cli/prune.rb +10 -10
- data/lib/{kamal → dash}/cli/registry.rb +11 -11
- data/lib/{kamal → dash}/cli/secrets.rb +3 -3
- data/lib/{kamal → dash}/cli/server.rb +14 -14
- data/lib/{kamal → dash}/cli/templates/deploy.yml +4 -4
- data/lib/dash/cli/templates/sample_hooks/docker-setup.sample +3 -0
- data/lib/dash/cli/templates/sample_hooks/post-app-boot.sample +3 -0
- data/lib/dash/cli/templates/sample_hooks/post-app-stop.sample +9 -0
- data/lib/dash/cli/templates/sample_hooks/post-deploy.sample +14 -0
- data/lib/dash/cli/templates/sample_hooks/post-proxy-deploy.sample +3 -0
- data/lib/dash/cli/templates/sample_hooks/post-proxy-reboot.sample +3 -0
- data/lib/dash/cli/templates/sample_hooks/pre-app-boot.sample +3 -0
- data/lib/{kamal → dash}/cli/templates/sample_hooks/pre-app-stop.sample +2 -2
- data/lib/{kamal → dash}/cli/templates/sample_hooks/pre-build.sample +8 -8
- data/lib/{kamal → dash}/cli/templates/sample_hooks/pre-connect.sample +8 -8
- data/lib/{kamal → dash}/cli/templates/sample_hooks/pre-deploy.sample +9 -9
- data/lib/dash/cli/templates/sample_hooks/pre-proxy-deploy.sample +3 -0
- data/lib/dash/cli/templates/sample_hooks/pre-proxy-reboot.sample +3 -0
- data/lib/{kamal → dash}/cli/templates/secrets +6 -6
- data/lib/{kamal → dash}/cli.rb +2 -2
- data/lib/{kamal → dash}/commander/specifics.rb +2 -2
- data/lib/{kamal → dash}/commander.rb +32 -24
- data/lib/{kamal → dash}/commands/accessory/proxy.rb +2 -2
- data/lib/{kamal → dash}/commands/accessory.rb +2 -2
- data/lib/{kamal → dash}/commands/app/assets.rb +1 -1
- data/lib/{kamal → dash}/commands/app/containers.rb +1 -1
- data/lib/{kamal → dash}/commands/app/error_pages.rb +2 -2
- data/lib/{kamal → dash}/commands/app/execution.rb +2 -2
- data/lib/{kamal → dash}/commands/app/images.rb +1 -1
- data/lib/{kamal → dash}/commands/app/logging.rb +1 -1
- data/lib/{kamal → dash}/commands/app/proxy.rb +2 -2
- data/lib/{kamal → dash}/commands/app.rb +2 -2
- data/lib/{kamal → dash}/commands/auditor.rb +3 -7
- data/lib/{kamal → dash}/commands/base.rb +39 -3
- data/lib/{kamal → dash}/commands/builder/base.rb +2 -2
- data/lib/{kamal → dash}/commands/builder/clone.rb +3 -3
- data/lib/{kamal → dash}/commands/builder/cloud.rb +1 -1
- data/lib/{kamal → dash}/commands/builder/hybrid.rb +1 -1
- data/lib/{kamal → dash}/commands/builder/local.rb +1 -1
- data/lib/{kamal → dash}/commands/builder/pack.rb +1 -1
- data/lib/{kamal → dash}/commands/builder/remote.rb +1 -1
- data/lib/{kamal → dash}/commands/builder.rb +7 -7
- data/lib/dash/commands/docker.rb +89 -0
- data/lib/{kamal → dash}/commands/hook.rb +1 -1
- data/lib/{kamal → dash}/commands/loadbalancer.rb +55 -24
- data/lib/{kamal → dash}/commands/lock.rb +3 -3
- data/lib/{kamal → dash}/commands/proxy/cert_transfer.rb +6 -6
- data/lib/dash/commands/proxy.rb +375 -0
- data/lib/{kamal → dash}/commands/prune.rb +2 -2
- data/lib/dash/commands/registry.rb +44 -0
- data/lib/{kamal → dash}/commands/server.rb +1 -5
- data/lib/dash/commands.rb +2 -0
- data/lib/{kamal → dash}/configuration/accessory.rb +13 -13
- data/lib/{kamal → dash}/configuration/alias.rb +3 -3
- data/lib/{kamal → dash}/configuration/boot.rb +2 -2
- data/lib/{kamal → dash}/configuration/builder.rb +7 -7
- data/lib/{kamal → dash}/configuration/docs/accessory.yml +3 -3
- data/lib/{kamal → dash}/configuration/docs/builder.yml +3 -3
- data/lib/{kamal → dash}/configuration/docs/configuration.yml +13 -6
- data/lib/{kamal → dash}/configuration/docs/env.yml +10 -10
- data/lib/{kamal → dash}/configuration/docs/proxy.yml +68 -45
- data/lib/{kamal → dash}/configuration/docs/registry.yml +5 -5
- data/lib/{kamal → dash}/configuration/env/tag.rb +2 -2
- data/lib/{kamal → dash}/configuration/env.rb +5 -5
- data/lib/{kamal → dash}/configuration/loadbalancer.rb +5 -5
- data/lib/{kamal → dash}/configuration/logging.rb +3 -3
- data/lib/{kamal → dash}/configuration/output.rb +4 -4
- data/lib/{kamal → dash}/configuration/proxy/acme.rb +9 -8
- data/lib/{kamal → dash}/configuration/proxy/boot.rb +9 -11
- data/lib/{kamal → dash}/configuration/proxy/run.rb +20 -20
- data/lib/{kamal → dash}/configuration/proxy.rb +51 -29
- data/lib/{kamal → dash}/configuration/registry.rb +3 -3
- data/lib/{kamal → dash}/configuration/role/healthcheck.rb +3 -3
- data/lib/{kamal → dash}/configuration/role.rb +14 -14
- data/lib/{kamal → dash}/configuration/servers.rb +4 -4
- data/lib/{kamal → dash}/configuration/ssh.rb +2 -2
- data/lib/{kamal → dash}/configuration/sshkit.rb +2 -2
- data/lib/{kamal → dash}/configuration/validation.rb +2 -2
- data/lib/{kamal → dash}/configuration/validator/accessory.rb +1 -1
- data/lib/{kamal → dash}/configuration/validator/alias.rb +2 -2
- data/lib/{kamal → dash}/configuration/validator/builder.rb +1 -1
- data/lib/dash/configuration/validator/configuration.rb +6 -0
- data/lib/{kamal → dash}/configuration/validator/env.rb +2 -2
- data/lib/{kamal → dash}/configuration/validator/proxy.rb +31 -31
- data/lib/{kamal → dash}/configuration/validator/registry.rb +1 -1
- data/lib/{kamal → dash}/configuration/validator/role.rb +1 -1
- data/lib/{kamal → dash}/configuration/validator/servers.rb +1 -1
- data/lib/{kamal → dash}/configuration/validator.rb +4 -4
- data/lib/{kamal → dash}/configuration/volume.rb +2 -2
- data/lib/{kamal → dash}/configuration.rb +47 -37
- data/lib/{kamal → dash}/docker.rb +1 -1
- data/lib/{kamal → dash}/env_file.rb +1 -1
- data/lib/{kamal → dash}/git.rb +1 -1
- data/lib/{kamal → dash}/otel_shipper.rb +3 -3
- data/lib/{kamal → dash}/output/base_logger.rb +1 -1
- data/lib/{kamal → dash}/output/file_logger.rb +1 -1
- data/lib/{kamal → dash}/output/formatter.rb +1 -1
- data/lib/{kamal → dash}/output/otel_logger.rb +3 -3
- data/lib/dash/project_directory.rb +28 -0
- data/lib/{kamal → dash}/secrets/adapters/aws_secrets_manager.rb +1 -1
- data/lib/{kamal → dash}/secrets/adapters/base.rb +2 -2
- data/lib/{kamal → dash}/secrets/adapters/bitwarden.rb +1 -1
- data/lib/{kamal → dash}/secrets/adapters/bitwarden_secrets_manager.rb +1 -1
- data/lib/{kamal → dash}/secrets/adapters/doppler.rb +1 -1
- data/lib/{kamal → dash}/secrets/adapters/enpass.rb +1 -1
- data/lib/{kamal → dash}/secrets/adapters/gcp_secret_manager.rb +1 -1
- data/lib/{kamal → dash}/secrets/adapters/last_pass.rb +1 -1
- data/lib/{kamal → dash}/secrets/adapters/one_password.rb +2 -2
- data/lib/{kamal → dash}/secrets/adapters/passbolt.rb +1 -1
- data/lib/{kamal → dash}/secrets/adapters/test.rb +1 -1
- data/lib/{kamal → dash}/secrets/adapters.rb +2 -2
- data/lib/{kamal → dash}/secrets/dotenv/inline_command_substitution.rb +2 -2
- data/lib/{kamal → dash}/secrets.rb +6 -6
- data/lib/{kamal → dash}/tags.rb +8 -3
- data/lib/{kamal → dash}/utils/sensitive.rb +1 -1
- data/lib/{kamal → dash}/utils.rb +16 -6
- data/lib/dash/version.rb +3 -0
- data/lib/{kamal.rb → dash.rb} +4 -4
- metadata +157 -154
- data/lib/kamal/cli/alias/command.rb +0 -10
- data/lib/kamal/cli/build/clone.rb +0 -59
- data/lib/kamal/cli/healthcheck/error.rb +0 -2
- data/lib/kamal/cli/templates/sample_hooks/docker-setup.sample +0 -3
- data/lib/kamal/cli/templates/sample_hooks/post-app-boot.sample +0 -3
- data/lib/kamal/cli/templates/sample_hooks/post-app-stop.sample +0 -9
- data/lib/kamal/cli/templates/sample_hooks/post-deploy.sample +0 -14
- data/lib/kamal/cli/templates/sample_hooks/post-proxy-deploy.sample +0 -3
- data/lib/kamal/cli/templates/sample_hooks/post-proxy-reboot.sample +0 -3
- data/lib/kamal/cli/templates/sample_hooks/pre-app-boot.sample +0 -3
- data/lib/kamal/cli/templates/sample_hooks/pre-proxy-deploy.sample +0 -3
- data/lib/kamal/cli/templates/sample_hooks/pre-proxy-reboot.sample +0 -3
- data/lib/kamal/commands/docker.rb +0 -55
- data/lib/kamal/commands/proxy.rb +0 -266
- data/lib/kamal/commands/registry.rb +0 -38
- data/lib/kamal/commands.rb +0 -2
- data/lib/kamal/configuration/validator/configuration.rb +0 -6
- data/lib/kamal/version.rb +0 -3
- /data/lib/{kamal → dash}/configuration/docs/alias.yml +0 -0
- /data/lib/{kamal → dash}/configuration/docs/boot.yml +0 -0
- /data/lib/{kamal → dash}/configuration/docs/logging.yml +0 -0
- /data/lib/{kamal → dash}/configuration/docs/output.yml +0 -0
- /data/lib/{kamal → dash}/configuration/docs/role.yml +0 -0
- /data/lib/{kamal → dash}/configuration/docs/servers.yml +0 -0
- /data/lib/{kamal → dash}/configuration/docs/ssh.yml +0 -0
- /data/lib/{kamal → dash}/configuration/docs/sshkit.yml +0 -0
- /data/lib/{kamal → dash}/sshkit_with_ext.rb +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Dash::Cli::App < Dash::Cli::Base
|
|
2
2
|
desc "boot", "Boot app on servers (or reboot app if already running)"
|
|
3
3
|
def boot
|
|
4
4
|
modify(lock: true) do
|
|
@@ -7,17 +7,17 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
7
7
|
say "Start container with version #{version} (or reboot if already running)...", :magenta
|
|
8
8
|
|
|
9
9
|
# Assets are prepared in a separate step to ensure they are on all hosts before booting
|
|
10
|
-
on(
|
|
11
|
-
|
|
10
|
+
on(DASH.app_hosts) do
|
|
11
|
+
Dash::Cli::App::ErrorPages.new(host, self).run
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
DASH.roles_on(host).each do |role|
|
|
14
|
+
Dash::Cli::App::Assets.new(host, role, self).run
|
|
15
|
+
Dash::Cli::App::SslCertificates.new(host, role, self).run
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
# Primary hosts and roles are returned first, so they can open the barrier
|
|
20
|
-
barrier =
|
|
20
|
+
barrier = Dash::Cli::Healthcheck::Barrier.new
|
|
21
21
|
cli = self
|
|
22
22
|
|
|
23
23
|
boot_groups = host_boot_groups
|
|
@@ -26,8 +26,8 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
26
26
|
host_list = Array(hosts).join(",")
|
|
27
27
|
run_hook "pre-app-boot", hosts: host_list
|
|
28
28
|
|
|
29
|
-
on_roles(
|
|
30
|
-
|
|
29
|
+
on_roles(DASH.roles, hosts: hosts, parallel: DASH.config.parallel_roles?, rolling: true) do |host, role|
|
|
30
|
+
Dash::Cli::App::Boot.new(host, role, self, version, barrier, cli).run
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
run_hook "post-app-boot", hosts: host_list
|
|
@@ -35,13 +35,13 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
35
35
|
# `wait` paces one group against the next, so the last group has nothing to pace
|
|
36
36
|
# against. Without a `limit` there is only ever one group, and waiting at all
|
|
37
37
|
# would be a fixed delay on every deploy buying no staggering.
|
|
38
|
-
sleep
|
|
38
|
+
sleep DASH.config.boot.wait if DASH.config.boot.wait && index < boot_groups.size - 1
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
# Tag once the app booted on all hosts
|
|
42
|
-
on(
|
|
43
|
-
execute *
|
|
44
|
-
execute *
|
|
42
|
+
on(DASH.app_hosts) do |host|
|
|
43
|
+
execute *DASH.auditor.record("Tagging #{DASH.config.absolute_image} as the latest image"), verbosity: :debug
|
|
44
|
+
execute *DASH.app.tag_latest_image
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
end
|
|
@@ -52,15 +52,15 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
52
52
|
modify(lock: true) do
|
|
53
53
|
cli = self
|
|
54
54
|
|
|
55
|
-
on_roles(
|
|
56
|
-
app =
|
|
57
|
-
execute *
|
|
55
|
+
on_roles(DASH.roles, hosts: DASH.app_hosts, parallel: DASH.config.parallel_roles?, rolling: true) do |host, role|
|
|
56
|
+
app = DASH.app(role: role, host: host)
|
|
57
|
+
execute *DASH.auditor.record("Started app version #{DASH.config.version}"), verbosity: :debug
|
|
58
58
|
execute *app.start, raise_on_non_zero_exit: false
|
|
59
59
|
|
|
60
60
|
if role.running_proxy?
|
|
61
61
|
version = capture_with_info(*app.current_running_version, raise_on_non_zero_exit: false).strip
|
|
62
62
|
endpoint = capture_with_info(*app.container_id_for_version(version)).strip
|
|
63
|
-
raise
|
|
63
|
+
raise Dash::Cli::BootError, "Failed to get endpoint for #{role} on #{host}, did the container boot?" if endpoint.empty?
|
|
64
64
|
|
|
65
65
|
cli.run_hook "pre-proxy-deploy", hosts: host.to_s, role: role.name
|
|
66
66
|
execute *app.deploy(target: endpoint)
|
|
@@ -73,9 +73,9 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
73
73
|
desc "stop", "Stop app container on servers"
|
|
74
74
|
def stop
|
|
75
75
|
modify(lock: true) do
|
|
76
|
-
on_roles(
|
|
77
|
-
app =
|
|
78
|
-
execute *
|
|
76
|
+
on_roles(DASH.roles, hosts: DASH.app_hosts, parallel: DASH.config.parallel_roles?) do |host, role|
|
|
77
|
+
app = DASH.app(role: role, host: host)
|
|
78
|
+
execute *DASH.auditor.record("Stopped app", role: role), verbosity: :debug
|
|
79
79
|
|
|
80
80
|
if role.running_proxy?
|
|
81
81
|
version = capture_with_info(*app.current_running_version, raise_on_non_zero_exit: false).strip
|
|
@@ -94,8 +94,8 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
94
94
|
desc "details", "Show details about app containers"
|
|
95
95
|
def details
|
|
96
96
|
quiet = options[:quiet]
|
|
97
|
-
on_roles(
|
|
98
|
-
puts_by_host host, capture_with_info(*
|
|
97
|
+
on_roles(DASH.roles, hosts: DASH.app_hosts) do |host, role|
|
|
98
|
+
puts_by_host host, capture_with_info(*DASH.app(role: role, host: host).info), quiet: quiet
|
|
99
99
|
end
|
|
100
100
|
end
|
|
101
101
|
|
|
@@ -123,7 +123,7 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
123
123
|
with_raw_output(raw) do
|
|
124
124
|
pre_connect_if_required
|
|
125
125
|
|
|
126
|
-
cmd =
|
|
126
|
+
cmd = Dash::Utils.join_commands(cmd)
|
|
127
127
|
env = options[:env]
|
|
128
128
|
detach = options[:detach]
|
|
129
129
|
quiet = options[:quiet]
|
|
@@ -131,17 +131,17 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
131
131
|
when options[:interactive] && options[:reuse]
|
|
132
132
|
say "Get current version of running container...", :magenta unless options[:version]
|
|
133
133
|
using_version(options[:version] || current_running_version) do |version|
|
|
134
|
-
say "Launching interactive command with version #{version} via SSH from existing container on #{
|
|
135
|
-
run_locally { exec
|
|
134
|
+
say "Launching interactive command with version #{version} via SSH from existing container on #{DASH.primary_host}...", :magenta
|
|
135
|
+
run_locally { exec DASH.app(role: DASH.primary_role, host: DASH.primary_host).execute_in_existing_container_over_ssh(cmd, env: env) }
|
|
136
136
|
end
|
|
137
137
|
|
|
138
138
|
when options[:interactive]
|
|
139
139
|
say "Get most recent version available as an image...", :magenta unless options[:version]
|
|
140
140
|
using_version(version_or_latest) do |version|
|
|
141
|
-
say "Launching interactive command with version #{version} via SSH from new container on #{
|
|
142
|
-
on(
|
|
141
|
+
say "Launching interactive command with version #{version} via SSH from new container on #{DASH.primary_host}...", :magenta
|
|
142
|
+
on(DASH.primary_host) { execute *DASH.registry.login }
|
|
143
143
|
run_locally do
|
|
144
|
-
exec
|
|
144
|
+
exec DASH.app(role: DASH.primary_role, host: DASH.primary_host).execute_in_new_container_over_ssh(cmd, env: env)
|
|
145
145
|
end
|
|
146
146
|
end
|
|
147
147
|
|
|
@@ -150,9 +150,9 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
150
150
|
using_version(options[:version] || current_running_version) do |version|
|
|
151
151
|
say "Launching command with version #{version} from existing container...", :magenta
|
|
152
152
|
|
|
153
|
-
on_roles(
|
|
154
|
-
execute *
|
|
155
|
-
puts_by_host host, capture_with_info(*
|
|
153
|
+
on_roles(DASH.roles, hosts: DASH.app_hosts) do |host, role|
|
|
154
|
+
execute *DASH.auditor.record("Executed cmd '#{cmd}' on app version #{version}", role: role), verbosity: :debug
|
|
155
|
+
puts_by_host host, capture_with_info(*DASH.app(role: role, host: host).execute_in_existing_container(cmd, env: env), strip: !raw), quiet: quiet, raw: raw
|
|
156
156
|
end
|
|
157
157
|
end
|
|
158
158
|
|
|
@@ -160,11 +160,11 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
160
160
|
say "Get most recent version available as an image...", :magenta unless options[:version]
|
|
161
161
|
using_version(version_or_latest) do |version|
|
|
162
162
|
say "Launching command with version #{version} from new container...", :magenta
|
|
163
|
-
on(
|
|
163
|
+
on(DASH.app_hosts) { execute *DASH.registry.login }
|
|
164
164
|
|
|
165
|
-
on_roles(
|
|
166
|
-
execute *
|
|
167
|
-
puts_by_host host, capture_with_info(*
|
|
165
|
+
on_roles(DASH.roles, hosts: DASH.app_hosts) do |host, role|
|
|
166
|
+
execute *DASH.auditor.record("Executed cmd '#{cmd}' on app version #{version}"), verbosity: :debug
|
|
167
|
+
puts_by_host host, capture_with_info(*DASH.app(role: role, host: host).execute_in_new_container(cmd, env: env, detach: detach), strip: !raw), quiet: quiet, raw: raw
|
|
168
168
|
end
|
|
169
169
|
end
|
|
170
170
|
end
|
|
@@ -174,7 +174,7 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
174
174
|
desc "containers", "Show app containers on servers"
|
|
175
175
|
def containers
|
|
176
176
|
quiet = options[:quiet]
|
|
177
|
-
on(
|
|
177
|
+
on(DASH.app_hosts) { |host| puts_by_host host, capture_with_info(*DASH.app.list_containers), quiet: quiet }
|
|
178
178
|
end
|
|
179
179
|
|
|
180
180
|
desc "stale_containers", "Detect app stale containers"
|
|
@@ -184,8 +184,8 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
184
184
|
stop = options[:stop]
|
|
185
185
|
|
|
186
186
|
with_lock_if_stopping do
|
|
187
|
-
on_roles(
|
|
188
|
-
app =
|
|
187
|
+
on_roles(DASH.roles, hosts: DASH.app_hosts) do |host, role|
|
|
188
|
+
app = DASH.app(role: role, host: host)
|
|
189
189
|
versions = capture_with_info(*app.list_versions, raise_on_non_zero_exit: false).split("\n")
|
|
190
190
|
versions -= [ capture_with_info(*app.current_running_version, raise_on_non_zero_exit: false).strip ]
|
|
191
191
|
|
|
@@ -204,7 +204,7 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
204
204
|
desc "images", "Show app images on servers"
|
|
205
205
|
def images
|
|
206
206
|
quiet = options[:quiet]
|
|
207
|
-
on(
|
|
207
|
+
on(DASH.app_hosts) { |host| puts_by_host host, capture_with_info(*DASH.app.list_images), quiet: quiet }
|
|
208
208
|
end
|
|
209
209
|
|
|
210
210
|
desc "logs", "Show log lines from app on servers (use --help to show options)"
|
|
@@ -229,21 +229,21 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
229
229
|
lines = options[:lines].presence || ((since || grep) ? nil : 10) # Default to 10 lines if since or grep isn't set
|
|
230
230
|
|
|
231
231
|
run_locally do
|
|
232
|
-
info "Following logs on #{
|
|
232
|
+
info "Following logs on #{DASH.primary_host}..."
|
|
233
233
|
|
|
234
|
-
|
|
235
|
-
role =
|
|
234
|
+
DASH.specific_roles ||= [ DASH.primary_role.name ]
|
|
235
|
+
role = DASH.roles_on(DASH.primary_host).first
|
|
236
236
|
|
|
237
|
-
app =
|
|
238
|
-
info app.follow_logs(host:
|
|
239
|
-
exec app.follow_logs(host:
|
|
237
|
+
app = DASH.app(role: role, host: host)
|
|
238
|
+
info app.follow_logs(host: DASH.primary_host, container_id: container_id, timestamps: timestamps, lines: lines, grep: grep, grep_options: grep_options)
|
|
239
|
+
exec app.follow_logs(host: DASH.primary_host, container_id: container_id, timestamps: timestamps, lines: lines, grep: grep, grep_options: grep_options)
|
|
240
240
|
end
|
|
241
241
|
else
|
|
242
242
|
lines = options[:lines].presence || ((since || grep) ? nil : 100) # Default to 100 lines if since or grep isn't set
|
|
243
243
|
|
|
244
|
-
on_roles(
|
|
244
|
+
on_roles(DASH.roles, hosts: DASH.app_hosts) do |host, role|
|
|
245
245
|
begin
|
|
246
|
-
puts_by_host host, capture_with_info(*
|
|
246
|
+
puts_by_host host, capture_with_info(*DASH.app(role: role, host: host).logs(container_id: container_id, timestamps: timestamps, since: since, lines: lines, grep: grep, grep_options: grep_options)), quiet: quiet
|
|
247
247
|
rescue SSHKit::Command::Failed
|
|
248
248
|
puts_by_host host, "Nothing found", quiet: quiet
|
|
249
249
|
end
|
|
@@ -264,8 +264,8 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
264
264
|
desc "live", "Set the app to live mode"
|
|
265
265
|
def live
|
|
266
266
|
modify(lock: true) do
|
|
267
|
-
on_roles(
|
|
268
|
-
execute *
|
|
267
|
+
on_roles(DASH.roles, hosts: DASH.proxy_hosts) do |host, role|
|
|
268
|
+
execute *DASH.app(role: role, host: host).live if role.running_proxy?
|
|
269
269
|
end
|
|
270
270
|
end
|
|
271
271
|
end
|
|
@@ -274,16 +274,16 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
274
274
|
option :drain_timeout, type: :numeric, desc: "How long to allow in-flight requests to complete (defaults to drain_timeout from config)"
|
|
275
275
|
option :message, type: :string, desc: "Message to display to clients while stopped"
|
|
276
276
|
def maintenance
|
|
277
|
-
maintenance_options = { drain_timeout: options[:drain_timeout] ||
|
|
277
|
+
maintenance_options = { drain_timeout: options[:drain_timeout] || DASH.config.drain_timeout, message: options[:message] }
|
|
278
278
|
|
|
279
279
|
modify(lock: true) do
|
|
280
|
-
on_roles(
|
|
281
|
-
execute *
|
|
280
|
+
on_roles(DASH.roles, hosts: DASH.proxy_hosts) do |host, role|
|
|
281
|
+
execute *DASH.app(role: role, host: host).maintenance(**maintenance_options) if role.running_proxy?
|
|
282
282
|
end
|
|
283
283
|
end
|
|
284
284
|
end
|
|
285
285
|
|
|
286
|
-
desc "rollout <deploy|set|stop>", "Manage a canary rollout of a new version through
|
|
286
|
+
desc "rollout <deploy|set|stop>", "Manage a canary rollout of a new version through dash-proxy"
|
|
287
287
|
option :percent, type: :numeric, desc: "Percentage of traffic to send to the rollout target"
|
|
288
288
|
option :list, type: :array, desc: "Send requests whose kamal-rollout cookie matches these values to the rollout target"
|
|
289
289
|
def rollout(action)
|
|
@@ -298,9 +298,9 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
298
298
|
desc "remove_container [VERSION]", "Remove app container with given version from servers", hide: true
|
|
299
299
|
def remove_container(version)
|
|
300
300
|
modify(lock: true) do
|
|
301
|
-
on_roles(
|
|
302
|
-
execute *
|
|
303
|
-
execute *
|
|
301
|
+
on_roles(DASH.roles, hosts: DASH.app_hosts) do |host, role|
|
|
302
|
+
execute *DASH.auditor.record("Removed app container with version #{version}", role: role), verbosity: :debug
|
|
303
|
+
execute *DASH.app(role: role, host: host).remove_container(version: version)
|
|
304
304
|
end
|
|
305
305
|
end
|
|
306
306
|
end
|
|
@@ -308,9 +308,9 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
308
308
|
desc "remove_containers", "Remove all app containers from servers", hide: true
|
|
309
309
|
def remove_containers
|
|
310
310
|
modify(lock: true) do
|
|
311
|
-
on_roles(
|
|
312
|
-
execute *
|
|
313
|
-
execute *
|
|
311
|
+
on_roles(DASH.roles, hosts: DASH.app_hosts) do |host, role|
|
|
312
|
+
execute *DASH.auditor.record("Removed all app containers", role: role), verbosity: :debug
|
|
313
|
+
execute *DASH.app(role: role, host: host).remove_containers
|
|
314
314
|
end
|
|
315
315
|
end
|
|
316
316
|
end
|
|
@@ -319,8 +319,8 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
319
319
|
def remove_images
|
|
320
320
|
modify(lock: true) do
|
|
321
321
|
on(hosts_removing_all_roles) do
|
|
322
|
-
execute *
|
|
323
|
-
execute *
|
|
322
|
+
execute *DASH.auditor.record("Removed all app images"), verbosity: :debug
|
|
323
|
+
execute *DASH.app.remove_images
|
|
324
324
|
end
|
|
325
325
|
end
|
|
326
326
|
end
|
|
@@ -329,9 +329,9 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
329
329
|
def remove_app_directories
|
|
330
330
|
modify(lock: true) do
|
|
331
331
|
on(hosts_removing_all_roles) do |host|
|
|
332
|
-
execute *
|
|
333
|
-
execute *
|
|
334
|
-
execute *
|
|
332
|
+
execute *DASH.server.remove_app_directory, raise_on_non_zero_exit: false
|
|
333
|
+
execute *DASH.auditor.record("Removed #{DASH.config.app_directory}"), verbosity: :debug
|
|
334
|
+
execute *DASH.app.remove_proxy_app_directory, raise_on_non_zero_exit: false
|
|
335
335
|
end
|
|
336
336
|
end
|
|
337
337
|
end
|
|
@@ -339,9 +339,9 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
339
339
|
desc "version", "Show app version currently running on servers"
|
|
340
340
|
def version
|
|
341
341
|
quiet = options[:quiet]
|
|
342
|
-
on(
|
|
343
|
-
role =
|
|
344
|
-
puts_by_host host, capture_with_info(*
|
|
342
|
+
on(DASH.app_hosts) do |host|
|
|
343
|
+
role = DASH.roles_on(host).first
|
|
344
|
+
puts_by_host host, capture_with_info(*DASH.app(role: role, host: host).current_running_version).strip, quiet: quiet
|
|
345
345
|
end
|
|
346
346
|
end
|
|
347
347
|
|
|
@@ -352,14 +352,14 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
352
352
|
using_version(version_or_latest) do |version|
|
|
353
353
|
say "Start rollout target with version #{version} alongside the live version...", :magenta
|
|
354
354
|
|
|
355
|
-
on(
|
|
356
|
-
|
|
357
|
-
|
|
355
|
+
on(DASH.proxy_hosts) do
|
|
356
|
+
DASH.roles_on(host).each do |role|
|
|
357
|
+
Dash::Cli::App::Assets.new(host, role, self).run if role.running_proxy?
|
|
358
358
|
end
|
|
359
359
|
end
|
|
360
360
|
|
|
361
|
-
on_roles(
|
|
362
|
-
|
|
361
|
+
on_roles(DASH.roles, hosts: DASH.proxy_hosts, parallel: DASH.config.parallel_roles?, rolling: true) do |host, role|
|
|
362
|
+
Dash::Cli::App::RolloutBoot.new(host, role, self, version).run if role.running_proxy?
|
|
363
363
|
end
|
|
364
364
|
end
|
|
365
365
|
end
|
|
@@ -373,49 +373,49 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
373
373
|
end
|
|
374
374
|
|
|
375
375
|
modify(lock: true) do
|
|
376
|
-
on_roles(
|
|
377
|
-
execute *
|
|
376
|
+
on_roles(DASH.roles, hosts: DASH.proxy_hosts) do |host, role|
|
|
377
|
+
execute *DASH.app(role: role, host: host).rollout_set(percent: percent, list: list) if role.running_proxy?
|
|
378
378
|
end
|
|
379
379
|
end
|
|
380
380
|
end
|
|
381
381
|
|
|
382
382
|
def stop_rollout
|
|
383
383
|
modify(lock: true) do
|
|
384
|
-
on_roles(
|
|
385
|
-
execute *
|
|
384
|
+
on_roles(DASH.roles, hosts: DASH.proxy_hosts) do |host, role|
|
|
385
|
+
execute *DASH.app(role: role, host: host).rollout_stop if role.running_proxy?
|
|
386
386
|
end
|
|
387
387
|
end
|
|
388
388
|
end
|
|
389
389
|
|
|
390
390
|
def hosts_removing_all_roles
|
|
391
|
-
|
|
391
|
+
DASH.app_hosts.select { |host| DASH.roles_on(host).map(&:name).sort == DASH.config.host_roles(host.to_s).map(&:name).sort }
|
|
392
392
|
end
|
|
393
393
|
|
|
394
394
|
def using_version(new_version)
|
|
395
395
|
if new_version
|
|
396
396
|
begin
|
|
397
|
-
old_version =
|
|
398
|
-
|
|
397
|
+
old_version = DASH.config.version
|
|
398
|
+
DASH.config.version = new_version
|
|
399
399
|
yield new_version
|
|
400
400
|
ensure
|
|
401
|
-
|
|
401
|
+
DASH.config.version = old_version
|
|
402
402
|
end
|
|
403
403
|
else
|
|
404
|
-
yield
|
|
404
|
+
yield DASH.config.version
|
|
405
405
|
end
|
|
406
406
|
end
|
|
407
407
|
|
|
408
|
-
def current_running_version(host:
|
|
408
|
+
def current_running_version(host: DASH.primary_host)
|
|
409
409
|
version = nil
|
|
410
410
|
on(host) do
|
|
411
|
-
role =
|
|
412
|
-
version = capture_with_info(*
|
|
411
|
+
role = DASH.roles_on(host).first
|
|
412
|
+
version = capture_with_info(*DASH.app(role: role, host: host).current_running_version).strip
|
|
413
413
|
end
|
|
414
414
|
version.presence
|
|
415
415
|
end
|
|
416
416
|
|
|
417
417
|
def version_or_latest
|
|
418
|
-
options[:version] ||
|
|
418
|
+
options[:version] || DASH.config.latest_tag
|
|
419
419
|
end
|
|
420
420
|
|
|
421
421
|
def with_lock_if_stopping
|
|
@@ -427,8 +427,8 @@ class Kamal::Cli::App < Kamal::Cli::Base
|
|
|
427
427
|
end
|
|
428
428
|
|
|
429
429
|
def host_boot_groups
|
|
430
|
-
hosts =
|
|
431
|
-
limit =
|
|
430
|
+
hosts = DASH.app_hosts
|
|
431
|
+
limit = DASH.config.boot.limit_for(hosts)
|
|
432
432
|
|
|
433
433
|
limit ? hosts.each_slice(limit).to_a : [ hosts ]
|
|
434
434
|
end
|