Class: Kamal::Cli::Doctor::HostChecks

Inherits:
Object
  • Object
show all
Defined in:
lib/kamal/cli/doctor/host_checks.rb

Overview

Remote readiness checks for a single host, run inside an SSHKit backend.

Every check rescues StandardError at its boundary: the doctor's contract is to report broken environments, not crash on them, and a failed connection can raise anything from Net::SSH errors to Errno and DNS resolution errors.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, sshkit, proxy_host:) ⇒ HostChecks

Returns a new instance of HostChecks.



10
11
12
13
14
# File 'lib/kamal/cli/doctor/host_checks.rb', line 10

def initialize(host, sshkit, proxy_host:)
  @host = host
  @sshkit = sshkit
  @proxy_host = proxy_host
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



7
8
9
# File 'lib/kamal/cli/doctor/host_checks.rb', line 7

def host
  @host
end

#proxy_hostObject (readonly)

Returns the value of attribute proxy_host.



7
8
9
# File 'lib/kamal/cli/doctor/host_checks.rb', line 7

def proxy_host
  @proxy_host
end

#sshkitObject (readonly)

Returns the value of attribute sshkit.



7
8
9
# File 'lib/kamal/cli/doctor/host_checks.rb', line 7

def sshkit
  @sshkit
end

Instance Method Details

#runObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/kamal/cli/doctor/host_checks.rb', line 16

def run
  checks = { ssh: ssh_check }

  if checks[:ssh].ok?
    checks[:docker] = docker_check
    checks[:registry] = registry_check
    checks.merge!(proxy_checks) if proxy_host
  end

  checks
end