Class: Kamal::Cli::Server
Instance Method Summary collapse
Methods inherited from Base
dynamic_command_class, exit_on_failure?, #initialize
Constructor Details
This class inherits a constructor from Kamal::Cli::Base
Instance Method Details
#bootstrap ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/kamal/cli/server.rb', line 26 def bootstrap with_lock do missing = [] on(KAMAL.hosts | KAMAL.accessory_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…" execute *KAMAL.docker.install else missing << host end end end if missing.any? raise "Docker is not installed on #{missing.join(", ")} and can't be automatically installed without having root access and either `wget` or `curl`. Install Docker manually: https://docs.docker.com/engine/install/" end run_hook "docker-setup" end end |
#exec(*cmd) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/kamal/cli/server.rb', line 4 def exec(*cmd) cmd = Kamal::Utils.join_commands(cmd) hosts = KAMAL.hosts | KAMAL.accessory_hosts case when [:interactive] host = KAMAL.primary_host say "Running '#{cmd}' on #{host} interactively...", :magenta run_locally { exec KAMAL.server.run_over_ssh(cmd, host: host) } else say "Running '#{cmd}' on #{hosts.join(', ')}...", :magenta on(hosts) do |host| execute *KAMAL.auditor.record("Executed cmd '#{cmd}' on #{host}"), verbosity: :debug puts_by_host host, capture_with_info(cmd) end end end |