Class: Kamal::Cli::Doctor
- Inherits:
-
Object
- Object
- Kamal::Cli::Doctor
- Includes:
- SSHKit::DSL
- Defined in:
- lib/kamal/cli/doctor.rb
Overview
Runs read-only deploy readiness checks and collects the results, without ever raising on a broken environment - failures become failing results instead.
Defined Under Namespace
Classes: ConfigChecks, EndpointChecks, HostChecks, Result
Constant Summary collapse
- HOST_CHECKS =
%i[ ssh docker registry proxy_image proxy_version proxy_socket ports ]
- CHECK_TITLES =
{ ssh: "SSH", docker: "Docker", registry: "Registry", proxy_image: "Proxy image", proxy_version: "Proxy version", proxy_socket: "Proxy docker socket", ports: "Ports", dns: "DNS", certificate: "Certificates", readiness: "Readiness" }.freeze
- STATUS_COLORS =
{ ok: :green, warn: :yellow, fail: :red }.freeze
Instance Attribute Summary collapse
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
- #failures ⇒ Object
-
#initialize ⇒ Doctor
constructor
A new instance of Doctor.
- #run ⇒ Object
- #successful? ⇒ Boolean
- #warnings ⇒ Object
Constructor Details
#initialize ⇒ Doctor
Returns a new instance of Doctor.
49 50 51 |
# File 'lib/kamal/cli/doctor.rb', line 49 def initialize @results = [] end |
Instance Attribute Details
#results ⇒ Object (readonly)
Returns the value of attribute results.
47 48 49 |
# File 'lib/kamal/cli/doctor.rb', line 47 def results @results end |
Instance Method Details
#failures ⇒ Object
57 58 59 |
# File 'lib/kamal/cli/doctor.rb', line 57 def failures results.select(&:fail?) end |
#run ⇒ Object
53 54 55 |
# File 'lib/kamal/cli/doctor.rb', line 53 def run @results = host_check_results + endpoint_check_results + config_check_results end |
#successful? ⇒ Boolean
65 66 67 |
# File 'lib/kamal/cli/doctor.rb', line 65 def successful? failures.none? end |
#warnings ⇒ Object
61 62 63 |
# File 'lib/kamal/cli/doctor.rb', line 61 def warnings results.select(&:warn?) end |