dash 3.2.0 → 3.2.1
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 +15 -15
- 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 +86 -86
- data/lib/{kamal → dash}/cli/base.rb +71 -47
- 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 +25 -7
- data/lib/{kamal → dash}/cli/doctor/host_checks.rb +18 -18
- 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 +77 -66
- data/lib/{kamal → dash}/cli/proxy/drift.rb +3 -3
- data/lib/{kamal → dash}/cli/proxy/loadbalancer_claim.rb +3 -3
- data/lib/{kamal → dash}/cli/proxy/loadbalancer_reboot.rb +22 -22
- data/lib/{kamal → dash}/cli/proxy/reboot.rb +15 -15
- data/lib/{kamal → dash}/cli/proxy.rb +166 -154
- 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 +31 -23
- data/lib/{kamal → dash}/commands/accessory/proxy.rb +1 -1
- 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 +1 -1
- 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 +1 -1
- data/lib/{kamal → dash}/commands/app.rb +1 -1
- 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/{kamal → dash}/commands/docker.rb +1 -1
- data/lib/{kamal → dash}/commands/hook.rb +1 -1
- data/lib/{kamal → dash}/commands/loadbalancer.rb +9 -8
- data/lib/{kamal → dash}/commands/lock.rb +2 -2
- data/lib/{kamal → dash}/commands/proxy/cert_transfer.rb +2 -2
- data/lib/{kamal → dash}/commands/proxy.rb +20 -10
- data/lib/{kamal → dash}/commands/prune.rb +1 -1
- 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 +11 -11
- 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/builder.yml +3 -3
- data/lib/{kamal → dash}/configuration/docs/configuration.yml +12 -5
- data/lib/{kamal → dash}/configuration/docs/env.yml +10 -10
- data/lib/{kamal → dash}/configuration/docs/proxy.yml +31 -8
- 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 +3 -3
- 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 +4 -3
- data/lib/{kamal → dash}/configuration/proxy/boot.rb +7 -7
- data/lib/{kamal → dash}/configuration/proxy/run.rb +11 -11
- data/lib/{kamal → dash}/configuration/proxy.rb +15 -15
- 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 +12 -12
- 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 +8 -8
- 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 +39 -29
- 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 +15 -5
- data/lib/dash/version.rb +3 -0
- data/lib/{kamal.rb → dash.rb} +4 -4
- metadata +156 -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/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/accessory.yml +0 -0
- /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,6 +1,6 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Dash::Commands::Auditor < Dash::Commands::Base
|
|
2
2
|
attr_reader :details
|
|
3
|
-
delegate :escape_shell_value, to:
|
|
3
|
+
delegate :escape_shell_value, to: Dash::Utils
|
|
4
4
|
|
|
5
5
|
def initialize(config, **details)
|
|
6
6
|
super(config)
|
|
@@ -10,7 +10,7 @@ class Kamal::Commands::Auditor < Kamal::Commands::Base
|
|
|
10
10
|
# Runs remotely
|
|
11
11
|
def record(line, **details)
|
|
12
12
|
combine \
|
|
13
|
-
|
|
13
|
+
ensure_run_directory,
|
|
14
14
|
append([ :echo, escape_shell_value(audit_line(line, **details)) ], audit_log_file)
|
|
15
15
|
end
|
|
16
16
|
|
|
@@ -29,10 +29,6 @@ class Kamal::Commands::Auditor < Kamal::Commands::Base
|
|
|
29
29
|
tags(**self.details, **details)
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
def make_run_directory
|
|
33
|
-
[ :mkdir, "-p", config.run_directory ]
|
|
34
|
-
end
|
|
35
|
-
|
|
36
32
|
def audit_line(line, **details)
|
|
37
33
|
"#{audit_tags(**details).except(:version, :service_version, :service)} #{line}"
|
|
38
34
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
module
|
|
1
|
+
module Dash::Commands
|
|
2
2
|
class Base
|
|
3
|
-
delegate :sensitive, :argumentize, to:
|
|
3
|
+
delegate :sensitive, :argumentize, to: Dash::Utils
|
|
4
4
|
|
|
5
5
|
# Prefixed onto the docker state when the container declares no healthcheck at all, so
|
|
6
6
|
# "nothing is probing this container" stays distinguishable from "the probe passed" —
|
|
@@ -32,6 +32,32 @@ module Kamal::Commands
|
|
|
32
32
|
[ :mkdir, "-p", path ]
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
+
# Creates the run directory, renaming a pre-3b `.kamal` into place first.
|
|
36
|
+
#
|
|
37
|
+
# Lives on Base because two unlocked paths reach the run directory before
|
|
38
|
+
# Dash::Cli::Base#ensure_run_directory does — the auditor records "Pulled
|
|
39
|
+
# image" during `build:pull`, and every `mkdir -p .dash/...` underneath it
|
|
40
|
+
# creates the parent. If any of them made the directory with a bare mkdir,
|
|
41
|
+
# `.dash` would exist by the time the guard ran and the legacy tree would be
|
|
42
|
+
# stranded. Everything that can be first must run the same command.
|
|
43
|
+
#
|
|
44
|
+
# The migration is safe to repeat on every command:
|
|
45
|
+
#
|
|
46
|
+
# - Idempotent - once `.dash` exists the second guard is false forever.
|
|
47
|
+
# - Atomic - the two are siblings in the SSH user's home, so this is a
|
|
48
|
+
# rename within one filesystem, never a copy.
|
|
49
|
+
# - Invisible to running containers - a bind mount resolves to an inode,
|
|
50
|
+
# so the live proxy keeps serving from the renamed directory and only
|
|
51
|
+
# picks up the new path when it is next recreated.
|
|
52
|
+
#
|
|
53
|
+
# `test` leads deliberately: SSHKit's command map passes `if`/`test`/`time`/
|
|
54
|
+
# `exec` through untouched and prefixes everything else with `/usr/bin/env`.
|
|
55
|
+
# The trailing `|| true` keeps the exit status zero when there is nothing to
|
|
56
|
+
# migrate, since callers execute this with raise_on_non_zero_exit on.
|
|
57
|
+
def ensure_run_directory
|
|
58
|
+
combine migrate_legacy_run_directory, make_directory(config.run_directory)
|
|
59
|
+
end
|
|
60
|
+
|
|
35
61
|
def remove_directory(path)
|
|
36
62
|
[ :rm, "-r", path ]
|
|
37
63
|
end
|
|
@@ -51,6 +77,16 @@ module Kamal::Commands
|
|
|
51
77
|
end
|
|
52
78
|
|
|
53
79
|
private
|
|
80
|
+
def migrate_legacy_run_directory
|
|
81
|
+
any \
|
|
82
|
+
combine(
|
|
83
|
+
[ :test, "-d", Dash::Configuration::LEGACY_RUN_DIRECTORY ],
|
|
84
|
+
[ :test, "!", "-e", config.run_directory ],
|
|
85
|
+
[ :mv, Dash::Configuration::LEGACY_RUN_DIRECTORY, config.run_directory ]
|
|
86
|
+
),
|
|
87
|
+
[ :true ]
|
|
88
|
+
end
|
|
89
|
+
|
|
54
90
|
def combine(*commands, by: "&&")
|
|
55
91
|
commands
|
|
56
92
|
.compact
|
|
@@ -107,7 +143,7 @@ module Kamal::Commands
|
|
|
107
143
|
end
|
|
108
144
|
|
|
109
145
|
def tags(**details)
|
|
110
|
-
|
|
146
|
+
Dash::Tags.from_config(config, **details)
|
|
111
147
|
end
|
|
112
148
|
|
|
113
149
|
def ssh_config_args
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Dash::Commands::Builder::Base < Dash::Commands::Base
|
|
2
2
|
class BuilderError < StandardError; end
|
|
3
3
|
|
|
4
4
|
ENDPOINT_DOCKER_HOST_INSPECT = "'{{.Endpoints.docker.Host}}'"
|
|
5
5
|
|
|
6
|
-
delegate :argumentize, to:
|
|
6
|
+
delegate :argumentize, to: Dash::Utils
|
|
7
7
|
delegate \
|
|
8
8
|
:args, :secrets, :dockerfile, :target, :arches, :local_arches, :remote_arches, :remote,
|
|
9
9
|
:pack?, :pack_builder, :pack_buildpacks,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module
|
|
1
|
+
module Dash::Commands::Builder::Clone
|
|
2
2
|
def clone
|
|
3
3
|
git :clone, escaped_root, "--recurse-submodules", path: config.builder.clone_directory.shellescape
|
|
4
4
|
end
|
|
@@ -7,7 +7,7 @@ module Kamal::Commands::Builder::Clone
|
|
|
7
7
|
[
|
|
8
8
|
git(:remote, "set-url", :origin, escaped_root, path: escaped_build_directory),
|
|
9
9
|
git(:fetch, :origin, path: escaped_build_directory),
|
|
10
|
-
git(:reset, "--hard",
|
|
10
|
+
git(:reset, "--hard", Dash::Git.revision, path: escaped_build_directory),
|
|
11
11
|
git(:clean, "-fdx", path: escaped_build_directory),
|
|
12
12
|
git(:submodule, :update, "--init", path: escaped_build_directory),
|
|
13
13
|
git(:gc, "--auto", "--quiet", path: escaped_build_directory)
|
|
@@ -23,7 +23,7 @@ module Kamal::Commands::Builder::Clone
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def escaped_root
|
|
26
|
-
|
|
26
|
+
Dash::Git.root.shellescape
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def escaped_build_directory
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Dash::Commands::Builder::Pack < Dash::Commands::Builder::Base
|
|
2
2
|
def push(export_action = "registry", tag_as_dirty: false, no_cache: false)
|
|
3
3
|
combine \
|
|
4
4
|
build(tag_as_dirty: tag_as_dirty, no_cache: no_cache),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require "active_support/core_ext/string/filters"
|
|
2
2
|
|
|
3
|
-
class
|
|
3
|
+
class Dash::Commands::Builder < Dash::Commands::Base
|
|
4
4
|
delegate \
|
|
5
5
|
:create, :remove, :dev, :push, :clean, :pull, :info, :inspect_builder,
|
|
6
6
|
:validate_image, :first_mirror, :login_to_registry_locally?, :push_env,
|
|
@@ -13,7 +13,7 @@ class Kamal::Commands::Builder < Kamal::Commands::Base
|
|
|
13
13
|
include Clone
|
|
14
14
|
|
|
15
15
|
def name
|
|
16
|
-
target.class.to_s.remove("
|
|
16
|
+
target.class.to_s.remove("Dash::Commands::Builder::").underscore.inquiry
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def target
|
|
@@ -33,22 +33,22 @@ class Kamal::Commands::Builder < Kamal::Commands::Base
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def remote
|
|
36
|
-
@remote ||=
|
|
36
|
+
@remote ||= Dash::Commands::Builder::Remote.new(config)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def local
|
|
40
|
-
@local ||=
|
|
40
|
+
@local ||= Dash::Commands::Builder::Local.new(config)
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
def hybrid
|
|
44
|
-
@hybrid ||=
|
|
44
|
+
@hybrid ||= Dash::Commands::Builder::Hybrid.new(config)
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def pack
|
|
48
|
-
@pack ||=
|
|
48
|
+
@pack ||= Dash::Commands::Builder::Pack.new(config)
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def cloud
|
|
52
|
-
@cloud ||=
|
|
52
|
+
@cloud ||= Dash::Commands::Builder::Cloud.new(config)
|
|
53
53
|
end
|
|
54
54
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
class
|
|
2
|
-
include
|
|
1
|
+
class Dash::Commands::Loadbalancer < Dash::Commands::Base
|
|
2
|
+
include Dash::Commands::Proxy::CertTransfer
|
|
3
3
|
|
|
4
|
-
delegate :argumentize, :optionize, to:
|
|
4
|
+
delegate :argumentize, :optionize, to: Dash::Utils
|
|
5
5
|
|
|
6
6
|
attr_reader :loadbalancer_config
|
|
7
7
|
|
|
@@ -18,7 +18,7 @@ class Kamal::Commands::Loadbalancer < Kamal::Commands::Base
|
|
|
18
18
|
"--detach",
|
|
19
19
|
"--restart", "unless-stopped",
|
|
20
20
|
"--label", label,
|
|
21
|
-
"--label", "#{
|
|
21
|
+
"--label", "#{Dash::Commands::Proxy::CONFIG_DIGEST_LABEL}=#{loadbalancer_config.run_config_digest}",
|
|
22
22
|
*config_volume,
|
|
23
23
|
*run_args,
|
|
24
24
|
*loadbalancer_config.run.image,
|
|
@@ -42,8 +42,9 @@ class Kamal::Commands::Loadbalancer < Kamal::Commands::Base
|
|
|
42
42
|
*loadbalancer_config.deploy_command_args(targets: targets)
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
# `retry` takes a host, or --all; the rest take no arguments.
|
|
46
|
+
def domains(subcommand, *args)
|
|
47
|
+
docker :exec, container_name, "kamal-proxy", "domains", subcommand, *args
|
|
47
48
|
end
|
|
48
49
|
|
|
49
50
|
def list(json: false)
|
|
@@ -62,7 +63,7 @@ class Kamal::Commands::Loadbalancer < Kamal::Commands::Base
|
|
|
62
63
|
end
|
|
63
64
|
|
|
64
65
|
def config_digest
|
|
65
|
-
docker :inspect, container_name, "--format",
|
|
66
|
+
docker :inspect, container_name, "--format", Dash::Commands::Proxy::CONFIG_DIGEST_FORMAT
|
|
66
67
|
end
|
|
67
68
|
|
|
68
69
|
def container_id(only_running: false)
|
|
@@ -110,7 +111,7 @@ class Kamal::Commands::Loadbalancer < Kamal::Commands::Base
|
|
|
110
111
|
end
|
|
111
112
|
|
|
112
113
|
# Where the proxy secrets env file lands (see Proxy::Run#secrets_path) -
|
|
113
|
-
# the same .
|
|
114
|
+
# the same .dash/proxy directory the per-app proxy hosts use.
|
|
114
115
|
def ensure_proxy_directory
|
|
115
116
|
make_directory loadbalancer_config.run.host_directory
|
|
116
117
|
end
|
|
@@ -2,7 +2,7 @@ require "active_support/duration"
|
|
|
2
2
|
require "time"
|
|
3
3
|
require "base64"
|
|
4
4
|
|
|
5
|
-
class
|
|
5
|
+
class Dash::Commands::Lock < Dash::Commands::Base
|
|
6
6
|
# The deploy lock is scoped to service+destination, so two destinations can
|
|
7
7
|
# deploy at once. Server-scoped resources — above all the single kamal-proxy
|
|
8
8
|
# container a host runs for every destination on it — need a lock that every
|
|
@@ -85,7 +85,7 @@ class Kamal::Commands::Lock < Kamal::Commands::Base
|
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
def locked_by
|
|
88
|
-
|
|
88
|
+
Dash::Git.user_name
|
|
89
89
|
rescue Errno::ENOENT
|
|
90
90
|
"Unknown"
|
|
91
91
|
end
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
# The including class provides `container_name`, `cert_store_volume_args` (the
|
|
11
11
|
# config volume mount) and `one_off_image` (the image tokens for a one-off
|
|
12
12
|
# container).
|
|
13
|
-
module
|
|
13
|
+
module Dash::Commands::Proxy::CertTransfer
|
|
14
14
|
CERT_ARCHIVE_FILENAME = "certs-export.tar.gz"
|
|
15
15
|
CERT_IMPORT_STAGING_FILENAME = "certs-import"
|
|
16
16
|
CONTAINER_IMPORT_PATH = "/tmp/kamal-cert-import"
|
|
@@ -22,7 +22,7 @@ module Kamal::Commands::Proxy::CertTransfer
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
# Reads the data directory offline over the config volume — only safe when
|
|
25
|
-
# the container is stopped, which
|
|
25
|
+
# the container is stopped, which Dash::Cli::Proxy guarantees.
|
|
26
26
|
def export_certs_offline
|
|
27
27
|
docker :run, "--rm",
|
|
28
28
|
*cert_store_volume_args,
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
class
|
|
2
|
-
include
|
|
1
|
+
class Dash::Commands::Proxy < Dash::Commands::Base
|
|
2
|
+
include Dash::Commands::Proxy::CertTransfer
|
|
3
3
|
|
|
4
|
-
delegate :argumentize, :optionize, to:
|
|
4
|
+
delegate :argumentize, :optionize, to: Dash::Utils
|
|
5
5
|
attr_reader :proxy_run_config
|
|
6
6
|
|
|
7
|
-
CONFIG_DIGEST_LABEL = "org.
|
|
7
|
+
CONFIG_DIGEST_LABEL = "org.dash.proxy-config-digest"
|
|
8
|
+
|
|
9
|
+
# Containers booted before the stage-3b rename carry the old key. New ones are
|
|
10
|
+
# labelled with CONFIG_DIGEST_LABEL only, but reads fall back to the legacy key
|
|
11
|
+
# so upgrading doesn't read as config drift and reboot every proxy for nothing.
|
|
12
|
+
# Both the legacy constant and the fallback go away in stage 3d.
|
|
13
|
+
LEGACY_CONFIG_DIGEST_LABEL = "org.kamal.proxy-config-digest"
|
|
14
|
+
|
|
15
|
+
CONFIG_DIGEST_FORMAT = "'{{ with index .Config.Labels \"#{CONFIG_DIGEST_LABEL}\" }}{{ . }}" \
|
|
16
|
+
"{{ else }}{{ index .Config.Labels \"#{LEGACY_CONFIG_DIGEST_LABEL}\" }}{{ end }}'"
|
|
8
17
|
|
|
9
18
|
def initialize(config, host:)
|
|
10
19
|
super(config)
|
|
@@ -52,7 +61,7 @@ class Kamal::Commands::Proxy < Kamal::Commands::Base
|
|
|
52
61
|
end
|
|
53
62
|
|
|
54
63
|
def config_digest
|
|
55
|
-
docker :inspect, container_name, "--format",
|
|
64
|
+
docker :inspect, container_name, "--format", CONFIG_DIGEST_FORMAT
|
|
56
65
|
end
|
|
57
66
|
|
|
58
67
|
def container_id(only_running: false)
|
|
@@ -150,8 +159,9 @@ class Kamal::Commands::Proxy < Kamal::Commands::Base
|
|
|
150
159
|
).join(" "), host: host
|
|
151
160
|
end
|
|
152
161
|
|
|
153
|
-
|
|
154
|
-
|
|
162
|
+
# `retry` takes a host, or --all; the rest take no arguments.
|
|
163
|
+
def domains(subcommand, *args)
|
|
164
|
+
docker :exec, container_name, "kamal-proxy", "domains", subcommand, *args
|
|
155
165
|
end
|
|
156
166
|
|
|
157
167
|
def remove_container
|
|
@@ -186,7 +196,7 @@ class Kamal::Commands::Proxy < Kamal::Commands::Base
|
|
|
186
196
|
# Static path rather than proxy_run_config.secrets_path: the file must be
|
|
187
197
|
# removable precisely when the run config (or its secrets) is gone.
|
|
188
198
|
def remove_proxy_secrets_file
|
|
189
|
-
remove_file File.join(config.proxy_boot.host_directory,
|
|
199
|
+
remove_file File.join(config.proxy_boot.host_directory, Dash::Configuration::Proxy::Run::SECRETS_FILENAME)
|
|
190
200
|
end
|
|
191
201
|
|
|
192
202
|
def boot_config
|
|
@@ -202,7 +212,7 @@ class Kamal::Commands::Proxy < Kamal::Commands::Base
|
|
|
202
212
|
end
|
|
203
213
|
|
|
204
214
|
def read_image_version
|
|
205
|
-
read_file(config.proxy_boot.image_version_file, default:
|
|
215
|
+
read_file(config.proxy_boot.image_version_file, default: Dash::Configuration::Proxy::Run::MINIMUM_VERSION)
|
|
206
216
|
end
|
|
207
217
|
|
|
208
218
|
def read_run_command
|
|
@@ -226,7 +236,7 @@ class Kamal::Commands::Proxy < Kamal::Commands::Base
|
|
|
226
236
|
end
|
|
227
237
|
|
|
228
238
|
def loadbalancer
|
|
229
|
-
@loadbalancer ||=
|
|
239
|
+
@loadbalancer ||= Dash::Commands::Loadbalancer.new(config, loadbalancer_config: DASH.loadbalancer_config)
|
|
230
240
|
end
|
|
231
241
|
|
|
232
242
|
private
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require "active_support/duration"
|
|
2
2
|
require "active_support/core_ext/numeric/time"
|
|
3
3
|
|
|
4
|
-
class
|
|
4
|
+
class Dash::Commands::Prune < Dash::Commands::Base
|
|
5
5
|
def dangling_images
|
|
6
6
|
docker :image, :prune, "--force", "--filter", "label=service=#{config.service}"
|
|
7
7
|
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
class Dash::Commands::Registry < Dash::Commands::Base
|
|
2
|
+
LOCAL_CONTAINER_NAME = "dash-docker-registry"
|
|
3
|
+
LEGACY_LOCAL_CONTAINER_NAME = "kamal-docker-registry"
|
|
4
|
+
|
|
5
|
+
def login(registry_config: nil)
|
|
6
|
+
registry_config ||= config.registry
|
|
7
|
+
|
|
8
|
+
return if registry_config.local?
|
|
9
|
+
|
|
10
|
+
docker :login,
|
|
11
|
+
registry_config.server,
|
|
12
|
+
"-u", sensitive(Dash::Utils.escape_shell_value(registry_config.username)),
|
|
13
|
+
"-p", sensitive(Dash::Utils.escape_shell_value(registry_config.password))
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def logout(registry_config: nil)
|
|
17
|
+
registry_config ||= config.registry
|
|
18
|
+
|
|
19
|
+
docker :logout, registry_config.server
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def setup(registry_config: nil)
|
|
23
|
+
registry_config ||= config.registry
|
|
24
|
+
|
|
25
|
+
combine \
|
|
26
|
+
docker(:start, LOCAL_CONTAINER_NAME),
|
|
27
|
+
docker(:run, "--detach", "-p", "127.0.0.1:#{registry_config.local_port}:5000", "--name", LOCAL_CONTAINER_NAME, "registry:3"),
|
|
28
|
+
by: "||"
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# The legacy container is torn down alongside the current one so an operator's
|
|
32
|
+
# laptop doesn't keep a stray kamal-docker-registry holding the local port
|
|
33
|
+
# after upgrading. Dash::Cli::Registry#remove already runs this with
|
|
34
|
+
# raise_on_non_zero_exit: false, so a missing container of either name is fine.
|
|
35
|
+
def remove
|
|
36
|
+
chain \
|
|
37
|
+
combine(docker(:stop, LOCAL_CONTAINER_NAME), docker(:rm, LOCAL_CONTAINER_NAME)),
|
|
38
|
+
combine(docker(:stop, LEGACY_LOCAL_CONTAINER_NAME), docker(:rm, LEGACY_LOCAL_CONTAINER_NAME))
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def local?
|
|
42
|
+
config.registry.local?
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
class
|
|
2
|
-
include
|
|
1
|
+
class Dash::Configuration::Accessory
|
|
2
|
+
include Dash::Configuration::Validation
|
|
3
3
|
|
|
4
4
|
DEFAULT_NETWORK = "kamal"
|
|
5
5
|
|
|
6
|
-
delegate :argumentize, :optionize, to:
|
|
6
|
+
delegate :argumentize, :optionize, to: Dash::Utils
|
|
7
7
|
|
|
8
8
|
attr_reader :name, :env, :proxy, :registry
|
|
9
9
|
|
|
@@ -14,7 +14,7 @@ class Kamal::Configuration::Accessory
|
|
|
14
14
|
accessory_config,
|
|
15
15
|
example: validation_yml["accessories"]["mysql"],
|
|
16
16
|
context: "accessories/#{name}",
|
|
17
|
-
with:
|
|
17
|
+
with: Dash::Configuration::Validator::Accessory
|
|
18
18
|
|
|
19
19
|
ensure_valid_roles
|
|
20
20
|
|
|
@@ -121,17 +121,17 @@ class Kamal::Configuration::Accessory
|
|
|
121
121
|
attr_reader :config, :accessory_config
|
|
122
122
|
|
|
123
123
|
def initialize_env
|
|
124
|
-
|
|
124
|
+
Dash::Configuration::Env.new \
|
|
125
125
|
config: accessory_config.fetch("env", {}),
|
|
126
126
|
secrets: config.secrets,
|
|
127
127
|
context: "accessories/#{name}/env"
|
|
128
128
|
end
|
|
129
129
|
|
|
130
130
|
# The load balancer fans the app's own service out to role targets only
|
|
131
|
-
# (see
|
|
131
|
+
# (see Dash::Cli::Proxy#loadbalancer), so an accessory is never behind it
|
|
132
132
|
# and must keep the host/TLS it registers with kamal-proxy directly.
|
|
133
133
|
def initialize_proxy
|
|
134
|
-
|
|
134
|
+
Dash::Configuration::Proxy.new \
|
|
135
135
|
config: config,
|
|
136
136
|
proxy_config: accessory_config["proxy"],
|
|
137
137
|
context: "accessories/#{name}/proxy",
|
|
@@ -140,7 +140,7 @@ class Kamal::Configuration::Accessory
|
|
|
140
140
|
end
|
|
141
141
|
|
|
142
142
|
def initialize_registry
|
|
143
|
-
|
|
143
|
+
Dash::Configuration::Registry.new \
|
|
144
144
|
config: accessory_config,
|
|
145
145
|
secrets: config.secrets,
|
|
146
146
|
context: "accessories/#{name}/registry"
|
|
@@ -187,7 +187,7 @@ class Kamal::Configuration::Accessory
|
|
|
187
187
|
|
|
188
188
|
def path_volumes(paths)
|
|
189
189
|
paths.map do |local, config|
|
|
190
|
-
|
|
190
|
+
Dash::Configuration::Volume.new \
|
|
191
191
|
host_path: config[:host_path],
|
|
192
192
|
container_path: config[:container_path],
|
|
193
193
|
options: config[:options]
|
|
@@ -273,9 +273,9 @@ class Kamal::Configuration::Accessory
|
|
|
273
273
|
|
|
274
274
|
def ensure_valid_roles
|
|
275
275
|
if accessory_config["roles"] && (missing_roles = accessory_config["roles"] - config.roles.map(&:name)).any?
|
|
276
|
-
raise
|
|
276
|
+
raise Dash::ConfigurationError, "accessories/#{name}: unknown roles #{missing_roles.join(", ")}"
|
|
277
277
|
elsif accessory_config["role"] && !config.role(accessory_config["role"])
|
|
278
|
-
raise
|
|
278
|
+
raise Dash::ConfigurationError, "accessories/#{name}: unknown role #{accessory_config["role"]}"
|
|
279
279
|
end
|
|
280
280
|
end
|
|
281
281
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
class
|
|
2
|
-
include
|
|
1
|
+
class Dash::Configuration::Alias
|
|
2
|
+
include Dash::Configuration::Validation
|
|
3
3
|
|
|
4
4
|
attr_reader :name, :command
|
|
5
5
|
|
|
@@ -10,6 +10,6 @@ class Kamal::Configuration::Alias
|
|
|
10
10
|
command,
|
|
11
11
|
example: validation_yml["aliases"]["uname"],
|
|
12
12
|
context: "aliases/#{name}",
|
|
13
|
-
with:
|
|
13
|
+
with: Dash::Configuration::Validator::Alias
|
|
14
14
|
end
|
|
15
15
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
class
|
|
2
|
-
include
|
|
1
|
+
class Dash::Configuration::Builder
|
|
2
|
+
include Dash::Configuration::Validation
|
|
3
3
|
|
|
4
4
|
attr_reader :config, :builder_config
|
|
5
5
|
delegate :image, :service, to: :config
|
|
@@ -12,7 +12,7 @@ class Kamal::Configuration::Builder
|
|
|
12
12
|
@server = config.registry.server
|
|
13
13
|
@service = config.service
|
|
14
14
|
|
|
15
|
-
validate! builder_config, with:
|
|
15
|
+
validate! builder_config, with: Dash::Configuration::Validator::Builder
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def to_h
|
|
@@ -31,7 +31,7 @@ class Kamal::Configuration::Builder
|
|
|
31
31
|
@local_arches ||= if local_disabled?
|
|
32
32
|
[]
|
|
33
33
|
elsif remote
|
|
34
|
-
arches & [
|
|
34
|
+
arches & [ Dash::Utils.docker_arch ]
|
|
35
35
|
else
|
|
36
36
|
arches
|
|
37
37
|
end
|
|
@@ -136,7 +136,7 @@ class Kamal::Configuration::Builder
|
|
|
136
136
|
end
|
|
137
137
|
|
|
138
138
|
def git_clone?
|
|
139
|
-
|
|
139
|
+
Dash::Git.used? && builder_config["context"].nil?
|
|
140
140
|
end
|
|
141
141
|
|
|
142
142
|
def clone_directory
|
|
@@ -201,11 +201,11 @@ class Kamal::Configuration::Builder
|
|
|
201
201
|
end
|
|
202
202
|
|
|
203
203
|
def repo_basename
|
|
204
|
-
File.basename(
|
|
204
|
+
File.basename(Dash::Git.root)
|
|
205
205
|
end
|
|
206
206
|
|
|
207
207
|
def repo_relative_pwd
|
|
208
|
-
Dir.pwd.delete_prefix(
|
|
208
|
+
Dir.pwd.delete_prefix(Dash::Git.root)
|
|
209
209
|
end
|
|
210
210
|
|
|
211
211
|
def pwd_sha
|
|
@@ -19,13 +19,13 @@ builder:
|
|
|
19
19
|
|
|
20
20
|
# Remote
|
|
21
21
|
#
|
|
22
|
-
# The connection string for a remote builder. If supplied,
|
|
22
|
+
# The connection string for a remote builder. If supplied, dash will use this
|
|
23
23
|
# for builds that do not match the local architecture of the deployment host.
|
|
24
24
|
remote: ssh://docker@docker-builder
|
|
25
25
|
|
|
26
26
|
# Local
|
|
27
27
|
#
|
|
28
|
-
# If set to false,
|
|
28
|
+
# If set to false, dash will always use the remote builder even when building
|
|
29
29
|
# the local architecture.
|
|
30
30
|
#
|
|
31
31
|
# Defaults to true:
|
|
@@ -87,7 +87,7 @@ builder:
|
|
|
87
87
|
|
|
88
88
|
# Build secrets
|
|
89
89
|
#
|
|
90
|
-
# Values are read from `.
|
|
90
|
+
# Values are read from `.dash/secrets`:
|
|
91
91
|
secrets:
|
|
92
92
|
- SECRET1
|
|
93
93
|
- SECRET2
|