Sha256: fb272e86c07149363395f8667ee85c88bc0550a52e3eda5e7a9f3411c115e954
Contents?: true
Size: 1.61 KB
Versions: 22
Compression:
Stored size: 1.61 KB
Contents
class Kamal::Cli::Server < Kamal::Cli::Base desc "exec", "Run a custom command on the server (use --help to show options)" 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 case when options[: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 desc "bootstrap", "Set up Docker to run Kamal apps" 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 end
Version data entries
22 entries across 22 versions & 2 rubygems