Add KAMAL.app_hosts

KAMAL.hosts includes accessory and apps hosts. Add KAMAL.app_hosts which
does not include accessory only hosts and use it for app specific
commands.

Fixes:
- https://github.com/basecamp/kamal/issues/1059
- https://github.com/basecamp/kamal/issues/1148
This commit is contained in:
Donal McBreen
2025-04-18 11:52:55 +01:00
parent 5c71f2ba5a
commit e4e39c31e3
9 changed files with 54 additions and 39 deletions

View File

@@ -3,7 +3,7 @@ class Kamal::Cli::Server < Kamal::Cli::Base
option :interactive, type: :boolean, aliases: "-i", default: false, desc: "Run the command interactively (use for console/bash)"
def exec(*cmd)
cmd = Kamal::Utils.join_commands(cmd)
hosts = KAMAL.hosts | KAMAL.accessory_hosts
hosts = KAMAL.hosts
case
when options[:interactive]
@@ -27,7 +27,7 @@ class Kamal::Cli::Server < Kamal::Cli::Base
with_lock do
missing = []
on(KAMAL.hosts | KAMAL.accessory_hosts) do |host|
on(KAMAL.hosts) do |host|
unless execute(*KAMAL.docker.installed?, raise_on_non_zero_exit: false)
if execute(*KAMAL.docker.superuser?, raise_on_non_zero_exit: false)
info "Missing Docker on #{host}. Installing…"