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::Prune < Dash::Cli::Base
|
|
2
2
|
desc "all", "Prune unused images and stopped containers"
|
|
3
3
|
def all
|
|
4
4
|
modify(lock: true, server_lock: true) do
|
|
@@ -10,10 +10,10 @@ class Kamal::Cli::Prune < Kamal::Cli::Base
|
|
|
10
10
|
desc "images", "Prune unused images"
|
|
11
11
|
def images
|
|
12
12
|
modify(lock: true, server_lock: true) do
|
|
13
|
-
on(
|
|
14
|
-
execute *
|
|
15
|
-
execute *
|
|
16
|
-
execute *
|
|
13
|
+
on(DASH.hosts) do
|
|
14
|
+
execute *DASH.auditor.record("Pruned images"), verbosity: :debug
|
|
15
|
+
execute *DASH.prune.dangling_images
|
|
16
|
+
execute *DASH.prune.tagged_images
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
end
|
|
@@ -21,15 +21,15 @@ class Kamal::Cli::Prune < Kamal::Cli::Base
|
|
|
21
21
|
desc "containers", "Prune all stopped containers, except the last n per role (default 5)"
|
|
22
22
|
option :retain, type: :numeric, default: nil, desc: "Number of containers to retain per role"
|
|
23
23
|
def containers
|
|
24
|
-
retain = options.fetch(:retain,
|
|
24
|
+
retain = options.fetch(:retain, DASH.config.retain_containers)
|
|
25
25
|
raise "retain must be at least 1" if retain < 1
|
|
26
26
|
|
|
27
27
|
modify(lock: true, server_lock: true) do
|
|
28
|
-
on(
|
|
29
|
-
execute *
|
|
28
|
+
on(DASH.hosts) do |host|
|
|
29
|
+
execute *DASH.auditor.record("Pruned containers"), verbosity: :debug
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
execute *
|
|
31
|
+
DASH.roles_on(host).each do |role|
|
|
32
|
+
execute *DASH.prune.app_containers(retain: retain, role: role)
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
end
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Dash::Cli::Registry < Dash::Cli::Base
|
|
2
2
|
desc "setup", "Setup local registry or log in to remote registry locally and remotely"
|
|
3
3
|
option :skip_local, aliases: "-L", type: :boolean, default: false, desc: "Skip local login"
|
|
4
4
|
option :skip_remote, aliases: "-R", type: :boolean, default: false, desc: "Skip remote login"
|
|
5
5
|
def setup
|
|
6
6
|
ensure_docker_installed unless options[:skip_local]
|
|
7
7
|
|
|
8
|
-
if
|
|
9
|
-
run_locally { execute *
|
|
8
|
+
if DASH.registry.local?
|
|
9
|
+
run_locally { execute *DASH.registry.setup } unless options[:skip_local]
|
|
10
10
|
else
|
|
11
|
-
run_locally { execute *
|
|
12
|
-
on(
|
|
11
|
+
run_locally { execute *DASH.registry.login } unless options[:skip_local]
|
|
12
|
+
on(DASH.hosts) { execute *DASH.registry.login } unless options[:skip_remote]
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
|
@@ -17,11 +17,11 @@ class Kamal::Cli::Registry < Kamal::Cli::Base
|
|
|
17
17
|
option :skip_local, aliases: "-L", type: :boolean, default: false, desc: "Skip local login"
|
|
18
18
|
option :skip_remote, aliases: "-R", type: :boolean, default: false, desc: "Skip remote login"
|
|
19
19
|
def remove
|
|
20
|
-
if
|
|
21
|
-
run_locally { execute *
|
|
20
|
+
if DASH.registry.local?
|
|
21
|
+
run_locally { execute *DASH.registry.remove, raise_on_non_zero_exit: false } unless options[:skip_local]
|
|
22
22
|
else
|
|
23
|
-
run_locally { execute *
|
|
24
|
-
on(
|
|
23
|
+
run_locally { execute *DASH.registry.logout } unless options[:skip_local]
|
|
24
|
+
on(DASH.hosts) { execute *DASH.registry.logout } unless options[:skip_remote]
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
@@ -29,7 +29,7 @@ class Kamal::Cli::Registry < Kamal::Cli::Base
|
|
|
29
29
|
option :skip_local, aliases: "-L", type: :boolean, default: false, desc: "Skip local login"
|
|
30
30
|
option :skip_remote, aliases: "-R", type: :boolean, default: false, desc: "Skip remote login"
|
|
31
31
|
def login
|
|
32
|
-
if
|
|
32
|
+
if DASH.registry.local?
|
|
33
33
|
raise "Cannot use login command with a local registry. Use `dash registry setup` instead."
|
|
34
34
|
end
|
|
35
35
|
|
|
@@ -40,7 +40,7 @@ class Kamal::Cli::Registry < Kamal::Cli::Base
|
|
|
40
40
|
option :skip_local, aliases: "-L", type: :boolean, default: false, desc: "Skip local login"
|
|
41
41
|
option :skip_remote, aliases: "-R", type: :boolean, default: false, desc: "Skip remote login"
|
|
42
42
|
def logout
|
|
43
|
-
if
|
|
43
|
+
if DASH.registry.local?
|
|
44
44
|
raise "Cannot use logout command with a local registry. Use `dash registry remove` instead."
|
|
45
45
|
end
|
|
46
46
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Dash::Cli::Secrets < Dash::Cli::Base
|
|
2
2
|
desc "fetch [SECRETS...]", "Fetch secrets from a vault"
|
|
3
3
|
option :adapter, type: :string, aliases: "-a", required: true, desc: "Which vault adapter to use"
|
|
4
4
|
option :account, type: :string, required: false, desc: "The account identifier or username"
|
|
@@ -30,14 +30,14 @@ class Kamal::Cli::Secrets < Kamal::Cli::Base
|
|
|
30
30
|
|
|
31
31
|
desc "print", "Print the secrets (for debugging)"
|
|
32
32
|
def print
|
|
33
|
-
|
|
33
|
+
DASH.config.secrets.to_h.each do |key, value|
|
|
34
34
|
puts "#{key}=#{value}"
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
private
|
|
39
39
|
def initialize_adapter(adapter)
|
|
40
|
-
|
|
40
|
+
Dash::Secrets::Adapters.lookup(adapter)
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
def return_or_puts(value, inline: nil)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Dash::Cli::Server < Dash::Cli::Base
|
|
2
2
|
desc "exec", "Run a custom command on the server (use --help to show options)"
|
|
3
3
|
option :interactive, type: :boolean, aliases: "-i", default: false, desc: "Run the command interactively (use for console/bash)"
|
|
4
4
|
option :raw, type: :boolean, default: false, desc: "Output raw, unmodified stdout"
|
|
@@ -12,22 +12,22 @@ class Kamal::Cli::Server < Kamal::Cli::Base
|
|
|
12
12
|
with_raw_output(raw) do
|
|
13
13
|
pre_connect_if_required
|
|
14
14
|
|
|
15
|
-
cmd =
|
|
16
|
-
hosts =
|
|
15
|
+
cmd = Dash::Utils.join_commands(cmd)
|
|
16
|
+
hosts = DASH.hosts
|
|
17
17
|
quiet = options[:quiet]
|
|
18
18
|
|
|
19
19
|
case
|
|
20
20
|
when options[:interactive]
|
|
21
|
-
host =
|
|
21
|
+
host = DASH.primary_host
|
|
22
22
|
|
|
23
23
|
say "Running '#{cmd}' on #{host} interactively...", :magenta
|
|
24
24
|
|
|
25
|
-
run_locally { exec
|
|
25
|
+
run_locally { exec DASH.server.run_over_ssh(cmd, host: host) }
|
|
26
26
|
else
|
|
27
27
|
say "Running '#{cmd}' on #{hosts.join(', ')}...", :magenta
|
|
28
28
|
|
|
29
29
|
on(hosts) do |host|
|
|
30
|
-
execute *
|
|
30
|
+
execute *DASH.auditor.record("Executed cmd '#{cmd}' on #{host}"), verbosity: :debug
|
|
31
31
|
puts_by_host host, capture_with_info(cmd, strip: !raw), quiet: quiet, raw: raw
|
|
32
32
|
end
|
|
33
33
|
end
|
|
@@ -39,17 +39,17 @@ class Kamal::Cli::Server < Kamal::Cli::Base
|
|
|
39
39
|
modify(lock: true) do
|
|
40
40
|
missing = []
|
|
41
41
|
|
|
42
|
-
on(
|
|
43
|
-
unless execute(*
|
|
44
|
-
if execute(*
|
|
42
|
+
on(DASH.hosts) do |host|
|
|
43
|
+
unless execute(*DASH.docker.installed?, raise_on_non_zero_exit: false)
|
|
44
|
+
if execute(*DASH.docker.superuser?, raise_on_non_zero_exit: false)
|
|
45
45
|
info "Missing Docker on #{host}. Installing…"
|
|
46
|
-
execute *
|
|
46
|
+
execute *DASH.docker.install
|
|
47
47
|
|
|
48
|
-
unless execute(*
|
|
49
|
-
execute(*
|
|
50
|
-
execute *
|
|
48
|
+
unless execute(*DASH.docker.root?, raise_on_non_zero_exit: false) ||
|
|
49
|
+
execute(*DASH.docker.in_docker_group?, raise_on_non_zero_exit: false)
|
|
50
|
+
execute *DASH.docker.add_to_docker_group
|
|
51
51
|
begin
|
|
52
|
-
execute *
|
|
52
|
+
execute *DASH.docker.refresh_session
|
|
53
53
|
rescue IOError
|
|
54
54
|
info "Session refreshed due to group change."
|
|
55
55
|
end
|
|
@@ -30,9 +30,9 @@ registry:
|
|
|
30
30
|
# server: registry.digitalocean.com / ghcr.io / ...
|
|
31
31
|
# username: my-user
|
|
32
32
|
|
|
33
|
-
# Always use an access token rather than real password (pulled from .
|
|
33
|
+
# Always use an access token rather than real password (pulled from .dash/secrets).
|
|
34
34
|
# password:
|
|
35
|
-
# -
|
|
35
|
+
# - DASH_REGISTRY_PASSWORD
|
|
36
36
|
|
|
37
37
|
# Configure builder setup.
|
|
38
38
|
builder:
|
|
@@ -41,7 +41,7 @@ builder:
|
|
|
41
41
|
# args:
|
|
42
42
|
# RUBY_VERSION: <%= ENV["RBENV_VERSION"] || ENV["rvm_ruby_string"] || "#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION}" %>
|
|
43
43
|
|
|
44
|
-
# Inject ENV variables into containers (secrets come from .
|
|
44
|
+
# Inject ENV variables into containers (secrets come from .dash/secrets).
|
|
45
45
|
#
|
|
46
46
|
# env:
|
|
47
47
|
# clear:
|
|
@@ -77,7 +77,7 @@ builder:
|
|
|
77
77
|
# limit: 10 # Can also specify as a percentage of total hosts, such as "25%"
|
|
78
78
|
# wait: 2
|
|
79
79
|
|
|
80
|
-
# Use accessory services (secrets come from .
|
|
80
|
+
# Use accessory services (secrets come from .dash/secrets).
|
|
81
81
|
#
|
|
82
82
|
# accessories:
|
|
83
83
|
# db:
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
# Runs on each host just after the previous container has been stopped.
|
|
4
|
+
#
|
|
5
|
+
# NOTE: $DASH_VERSION is the version that was STOPPED, not the one being deployed.
|
|
6
|
+
#
|
|
7
|
+
# A failure here is logged and the deploy continues.
|
|
8
|
+
|
|
9
|
+
echo "Stopped $DASH_ROLE version $DASH_VERSION on $DASH_HOSTS"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
# A sample post-deploy hook
|
|
4
|
+
#
|
|
5
|
+
# These environment variables are available:
|
|
6
|
+
# DASH_RECORDED_AT
|
|
7
|
+
# DASH_PERFORMER
|
|
8
|
+
# DASH_VERSION
|
|
9
|
+
# DASH_HOSTS
|
|
10
|
+
# DASH_ROLES (if set)
|
|
11
|
+
# DASH_DESTINATION (if set)
|
|
12
|
+
# DASH_RUNTIME
|
|
13
|
+
|
|
14
|
+
echo "$DASH_PERFORMER deployed $DASH_VERSION to $DASH_DESTINATION in $DASH_RUNTIME seconds"
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
# version is already live. Use it to drain the old container: unsubscribe a queue
|
|
5
5
|
# group, deregister from service discovery, wait for in-flight jobs.
|
|
6
6
|
#
|
|
7
|
-
# NOTE: $
|
|
7
|
+
# NOTE: $DASH_VERSION is the version being STOPPED, not the one being deployed.
|
|
8
8
|
#
|
|
9
9
|
# A failure here is logged and the deploy continues -- the old container is
|
|
10
10
|
# stopped either way.
|
|
11
11
|
|
|
12
|
-
echo "Draining $
|
|
12
|
+
echo "Draining $DASH_ROLE version $DASH_VERSION on $DASH_HOSTS..."
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
# 4. The version we are deploying matches the remote
|
|
10
10
|
#
|
|
11
11
|
# These environment variables are available:
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
12
|
+
# DASH_RECORDED_AT
|
|
13
|
+
# DASH_PERFORMER
|
|
14
|
+
# DASH_VERSION
|
|
15
|
+
# DASH_HOSTS
|
|
16
|
+
# DASH_ROLES (if set)
|
|
17
|
+
# DASH_DESTINATION (if set)
|
|
18
18
|
|
|
19
19
|
if [ -n "$(git status --porcelain)" ]; then
|
|
20
20
|
echo "Git checkout is not clean, aborting..." >&2
|
|
@@ -43,8 +43,8 @@ if [ -z "$remote_head" ]; then
|
|
|
43
43
|
exit 1
|
|
44
44
|
fi
|
|
45
45
|
|
|
46
|
-
if [ "$
|
|
47
|
-
echo "Version ($
|
|
46
|
+
if [ "$DASH_VERSION" != "$remote_head" ]; then
|
|
47
|
+
echo "Version ($DASH_VERSION) does not match remote HEAD ($remote_head), aborting..." >&2
|
|
48
48
|
exit 1
|
|
49
49
|
fi
|
|
50
50
|
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
# Warms DNS before connecting to hosts in parallel
|
|
6
6
|
#
|
|
7
7
|
# These environment variables are available:
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
8
|
+
# DASH_RECORDED_AT
|
|
9
|
+
# DASH_PERFORMER
|
|
10
|
+
# DASH_VERSION
|
|
11
|
+
# DASH_HOSTS
|
|
12
|
+
# DASH_ROLES (if set)
|
|
13
|
+
# DASH_DESTINATION (if set)
|
|
14
|
+
# DASH_RUNTIME
|
|
15
15
|
|
|
16
|
-
hosts = ENV["
|
|
16
|
+
hosts = ENV["DASH_HOSTS"].split(",")
|
|
17
17
|
results = nil
|
|
18
18
|
max = 3
|
|
19
19
|
|
|
@@ -7,17 +7,17 @@
|
|
|
7
7
|
# Fails unless the combined status is "success"
|
|
8
8
|
#
|
|
9
9
|
# These environment variables are available:
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
10
|
+
# DASH_RECORDED_AT
|
|
11
|
+
# DASH_PERFORMER
|
|
12
|
+
# DASH_VERSION
|
|
13
|
+
# DASH_HOSTS
|
|
14
|
+
# DASH_COMMAND
|
|
15
|
+
# DASH_SUBCOMMAND
|
|
16
|
+
# DASH_ROLES (if set)
|
|
17
|
+
# DASH_DESTINATION (if set)
|
|
18
18
|
|
|
19
19
|
# Only check the build status for production deployments
|
|
20
|
-
if ENV["
|
|
20
|
+
if ENV["DASH_COMMAND"] == "rollback" || ENV["DASH_DESTINATION"] != "production"
|
|
21
21
|
exit 0
|
|
22
22
|
end
|
|
23
23
|
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
# and accessories/*/env/secret in config/deploy.yml. All secrets should be pulled from either
|
|
3
3
|
# password manager, ENV, or a file. DO NOT ENTER RAW CREDENTIALS HERE! This file needs to be safe for git.
|
|
4
4
|
#
|
|
5
|
-
# When deploying with destinations, shared secrets can go in .
|
|
6
|
-
# destination-specific secrets in .
|
|
5
|
+
# When deploying with destinations, shared secrets can go in .dash/secrets-common and
|
|
6
|
+
# destination-specific secrets in .dash/secrets.<destination>. This .dash/secrets file is used
|
|
7
7
|
# only when no destination is selected.
|
|
8
8
|
|
|
9
9
|
# Option 1: Read secrets from the environment
|
|
10
|
-
#
|
|
10
|
+
# DASH_REGISTRY_PASSWORD=$DASH_REGISTRY_PASSWORD
|
|
11
11
|
|
|
12
12
|
# Option 2: Read secrets via a command
|
|
13
13
|
# RAILS_MASTER_KEY=$(cat config/master.key)
|
|
14
|
-
#
|
|
14
|
+
# DASH_REGISTRY_PASSWORD=$(rails credentials:fetch dash.registry_password)
|
|
15
15
|
|
|
16
16
|
# Option 3: Read secrets via dash secrets helpers
|
|
17
17
|
# These will handle logging in and fetching the secrets in as few calls as possible
|
|
18
18
|
# There are adapters for 1Password, LastPass + Bitwarden
|
|
19
19
|
#
|
|
20
|
-
# SECRETS=$(dash secrets fetch --adapter 1password --account my-account --from MyVault/MyItem
|
|
21
|
-
#
|
|
20
|
+
# SECRETS=$(dash secrets fetch --adapter 1password --account my-account --from MyVault/MyItem DASH_REGISTRY_PASSWORD RAILS_MASTER_KEY)
|
|
21
|
+
# DASH_REGISTRY_PASSWORD=$(dash secrets extract DASH_REGISTRY_PASSWORD $SECRETS)
|
|
22
22
|
# RAILS_MASTER_KEY=$(dash secrets extract RAILS_MASTER_KEY $SECRETS)
|
data/lib/{kamal → dash}/cli.rb
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module
|
|
1
|
+
module Dash::Cli
|
|
2
2
|
class BootError < StandardError; end
|
|
3
3
|
class HookError < StandardError; end
|
|
4
4
|
class LockError < StandardError; end
|
|
@@ -7,4 +7,4 @@ module Kamal::Cli
|
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
# SSHKit uses instance eval, so we need a global const for ergonomics
|
|
10
|
-
|
|
10
|
+
DASH = Dash::Commander.new
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Dash::Commander::Specifics
|
|
2
2
|
attr_reader :primary_host, :primary_role, :hosts, :roles
|
|
3
|
-
delegate :stable_sort!, to:
|
|
3
|
+
delegate :stable_sort!, to: Dash::Utils
|
|
4
4
|
|
|
5
5
|
def initialize(config, specific_hosts, specific_roles)
|
|
6
6
|
@config, @specific_hosts, @specific_roles = config, specific_hosts, specific_roles
|
|
@@ -4,7 +4,7 @@ require "active_support/core_ext/object/blank"
|
|
|
4
4
|
require "active_support/broadcast_logger"
|
|
5
5
|
require "active_support/notifications"
|
|
6
6
|
|
|
7
|
-
class
|
|
7
|
+
class Dash::Commander
|
|
8
8
|
attr_accessor :verbosity, :holding_lock, :holding_server_lock, :connected, :logging, :lock_wait, :lock_wait_timeout, :lock_wait_interval
|
|
9
9
|
attr_reader :specific_roles, :specific_hosts
|
|
10
10
|
delegate :hosts, :roles, :primary_host, :primary_role, :roles_on, :app_hosts, :proxy_hosts, :accessory_hosts, to: :specifics
|
|
@@ -15,8 +15,8 @@ class Kamal::Commander
|
|
|
15
15
|
|
|
16
16
|
def reset
|
|
17
17
|
self.verbosity = :info
|
|
18
|
-
self.holding_lock =
|
|
19
|
-
self.holding_server_lock =
|
|
18
|
+
self.holding_lock = env_flag("DASH_LOCK", "KAMAL_LOCK")
|
|
19
|
+
self.holding_server_lock = env_flag("DASH_SERVER_LOCK", "KAMAL_SERVER_LOCK")
|
|
20
20
|
self.connected = false
|
|
21
21
|
self.logging = false
|
|
22
22
|
self.lock_wait = false
|
|
@@ -30,7 +30,7 @@ class Kamal::Commander
|
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def config
|
|
33
|
-
@config ||=
|
|
33
|
+
@config ||= Dash::Configuration.create_from(**@config_kwargs.to_h).tap do |config|
|
|
34
34
|
@config_kwargs = nil
|
|
35
35
|
configure_sshkit_with(config)
|
|
36
36
|
end
|
|
@@ -56,7 +56,7 @@ class Kamal::Commander
|
|
|
56
56
|
def specific_roles=(role_names)
|
|
57
57
|
@specifics = nil
|
|
58
58
|
@specific_roles = if role_names.present?
|
|
59
|
-
filtered =
|
|
59
|
+
filtered = Dash::Utils.filter_specific_items(role_names, config.roles)
|
|
60
60
|
raise ArgumentError, "No --roles match for #{role_names.join(',')}" if filtered.empty?
|
|
61
61
|
filtered
|
|
62
62
|
end
|
|
@@ -65,7 +65,7 @@ class Kamal::Commander
|
|
|
65
65
|
def specific_hosts=(hosts)
|
|
66
66
|
@specifics = nil
|
|
67
67
|
@specific_hosts = if hosts.present?
|
|
68
|
-
filtered =
|
|
68
|
+
filtered = Dash::Utils.filter_specific_items(hosts, config.all_hosts)
|
|
69
69
|
raise ArgumentError, "No --hosts match for #{hosts.join(',')}" if filtered.empty?
|
|
70
70
|
filtered
|
|
71
71
|
end
|
|
@@ -83,61 +83,61 @@ class Kamal::Commander
|
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
def app(role: nil, host: nil)
|
|
86
|
-
|
|
86
|
+
Dash::Commands::App.new(config, role: role, host: host)
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
def accessory(name)
|
|
90
|
-
|
|
90
|
+
Dash::Commands::Accessory.new(config, name: name)
|
|
91
91
|
end
|
|
92
92
|
|
|
93
93
|
def auditor(**details)
|
|
94
|
-
|
|
94
|
+
Dash::Commands::Auditor.new(config, **details)
|
|
95
95
|
end
|
|
96
96
|
|
|
97
97
|
def builder
|
|
98
|
-
@commands[:builder] ||=
|
|
98
|
+
@commands[:builder] ||= Dash::Commands::Builder.new(config)
|
|
99
99
|
end
|
|
100
100
|
|
|
101
101
|
def docker
|
|
102
|
-
@commands[:docker] ||=
|
|
102
|
+
@commands[:docker] ||= Dash::Commands::Docker.new(config)
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
def hook
|
|
106
|
-
@commands[:hook] ||=
|
|
106
|
+
@commands[:hook] ||= Dash::Commands::Hook.new(config)
|
|
107
107
|
end
|
|
108
108
|
|
|
109
109
|
def lock
|
|
110
|
-
@commands[:lock] ||=
|
|
110
|
+
@commands[:lock] ||= Dash::Commands::Lock.new(config)
|
|
111
111
|
end
|
|
112
112
|
|
|
113
|
-
# Guards the
|
|
113
|
+
# Guards the dash-proxy container, which a host runs once for every
|
|
114
114
|
# destination deployed onto it. Every destination contends for this one.
|
|
115
115
|
def server_lock
|
|
116
|
-
@commands[:server_lock] ||=
|
|
116
|
+
@commands[:server_lock] ||= Dash::Commands::Lock.new(config, scope: :server)
|
|
117
117
|
end
|
|
118
118
|
|
|
119
119
|
def proxy(host)
|
|
120
|
-
|
|
120
|
+
Dash::Commands::Proxy.new(config, host: host)
|
|
121
121
|
end
|
|
122
122
|
|
|
123
123
|
def loadbalancer_config
|
|
124
|
-
@loadbalancer_config ||=
|
|
124
|
+
@loadbalancer_config ||= Dash::Configuration::Loadbalancer.new(config: config, proxy_config: config.proxy.proxy_config, secrets: config.secrets)
|
|
125
125
|
end
|
|
126
126
|
|
|
127
127
|
def loadbalancer
|
|
128
|
-
@commands[:loadbalancer] ||=
|
|
128
|
+
@commands[:loadbalancer] ||= Dash::Commands::Loadbalancer.new(config, loadbalancer_config: loadbalancer_config)
|
|
129
129
|
end
|
|
130
130
|
|
|
131
131
|
def prune
|
|
132
|
-
@commands[:prune] ||=
|
|
132
|
+
@commands[:prune] ||= Dash::Commands::Prune.new(config)
|
|
133
133
|
end
|
|
134
134
|
|
|
135
135
|
def registry
|
|
136
|
-
@commands[:registry] ||=
|
|
136
|
+
@commands[:registry] ||= Dash::Commands::Registry.new(config)
|
|
137
137
|
end
|
|
138
138
|
|
|
139
139
|
def server
|
|
140
|
-
@commands[:server] ||=
|
|
140
|
+
@commands[:server] ||= Dash::Commands::Server.new(config)
|
|
141
141
|
end
|
|
142
142
|
|
|
143
143
|
def alias(name)
|
|
@@ -148,7 +148,7 @@ class Kamal::Commander
|
|
|
148
148
|
if @config
|
|
149
149
|
@config.aliases[name]&.command
|
|
150
150
|
else
|
|
151
|
-
raw_config =
|
|
151
|
+
raw_config = Dash::Configuration.load_raw_config(**@config_kwargs.to_h.slice(:config_file, :destination))
|
|
152
152
|
raw_config[:aliases]&.dig(name)
|
|
153
153
|
end
|
|
154
154
|
end
|
|
@@ -227,7 +227,7 @@ class Kamal::Commander
|
|
|
227
227
|
|
|
228
228
|
config.output.loggers.each { |logger| output_logger.broadcast_to(logger) }
|
|
229
229
|
|
|
230
|
-
SSHKit.config.output =
|
|
230
|
+
SSHKit.config.output = Dash::Output::Formatter.new($stdout, output_logger)
|
|
231
231
|
|
|
232
232
|
at_exit { @output_logger&.close }
|
|
233
233
|
rescue => e
|
|
@@ -236,6 +236,14 @@ class Kamal::Commander
|
|
|
236
236
|
end
|
|
237
237
|
|
|
238
238
|
def specifics
|
|
239
|
-
@specifics ||=
|
|
239
|
+
@specifics ||= Dash::Commander::Specifics.new(config, specific_hosts, specific_roles)
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
# First name that is set wins, so DASH_* takes precedence over the legacy
|
|
243
|
+
# KAMAL_* twin rather than either one merely being truthy. Dash::Tags#env
|
|
244
|
+
# writes both with the same value, so they only disagree when an operator
|
|
245
|
+
# sets one by hand.
|
|
246
|
+
def env_flag(*names)
|
|
247
|
+
names.filter_map { |name| ENV[name] }.first == "true"
|
|
240
248
|
end
|
|
241
249
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module
|
|
1
|
+
module Dash::Commands::Accessory::Proxy
|
|
2
2
|
delegate :container_name, to: :"config.proxy_boot", prefix: :proxy
|
|
3
3
|
|
|
4
4
|
def deploy(target:)
|
|
@@ -11,6 +11,6 @@ module Kamal::Commands::Accessory::Proxy
|
|
|
11
11
|
|
|
12
12
|
private
|
|
13
13
|
def proxy_exec(*command)
|
|
14
|
-
docker :exec, proxy_container_name, "
|
|
14
|
+
docker :exec, proxy_container_name, "dash-proxy", *command
|
|
15
15
|
end
|
|
16
16
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Dash::Commands::Accessory < Dash::Commands::Base
|
|
2
2
|
include Proxy
|
|
3
3
|
|
|
4
4
|
attr_reader :accessory_config
|
|
@@ -20,7 +20,7 @@ class Kamal::Commands::Accessory < Kamal::Commands::Base
|
|
|
20
20
|
*network_args,
|
|
21
21
|
*config.logging_args,
|
|
22
22
|
*publish_args,
|
|
23
|
-
*([ "--env", "KAMAL_HOST=\"#{host}\"" ] if host),
|
|
23
|
+
*([ "--env", "DASH_HOST=\"#{host}\"", "--env", "KAMAL_HOST=\"#{host}\"" ] if host),
|
|
24
24
|
*env_args,
|
|
25
25
|
*volume_args,
|
|
26
26
|
*label_args,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
module
|
|
1
|
+
module Dash::Commands::App::ErrorPages
|
|
2
2
|
def create_error_pages_directory
|
|
3
3
|
make_directory(config.proxy_boot.error_pages_directory)
|
|
4
4
|
end
|
|
5
5
|
|
|
6
6
|
def clean_up_error_pages
|
|
7
|
-
[ :find, config.proxy_boot.error_pages_directory, "-mindepth", "1", "-maxdepth", "1", "!", "-name",
|
|
7
|
+
[ :find, config.proxy_boot.error_pages_directory, "-mindepth", "1", "-maxdepth", "1", "!", "-name", DASH.config.version, "-exec", "rm", "-rf", "{} +" ]
|
|
8
8
|
end
|
|
9
9
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module
|
|
1
|
+
module Dash::Commands::App::Execution
|
|
2
2
|
def execute_in_existing_container(*command, interactive: false, env:)
|
|
3
3
|
docker :exec,
|
|
4
4
|
(docker_interactive_args if interactive),
|
|
@@ -13,7 +13,7 @@ module Kamal::Commands::App::Execution
|
|
|
13
13
|
("--detach" if detach),
|
|
14
14
|
("--rm" unless detach),
|
|
15
15
|
"--name", container_name_for_exec,
|
|
16
|
-
"--network", "
|
|
16
|
+
"--network", "dash",
|
|
17
17
|
*role&.env_args(host),
|
|
18
18
|
*argumentize("--env", env),
|
|
19
19
|
*role.logging_args,
|