Class: Kamal::Commands::Healthcheck
- Defined in:
- lib/kamal/commands/healthcheck.rb
Constant Summary
Constants inherited from Base
Base::DOCKER_HEALTH_LOG_FORMAT, Base::DOCKER_HEALTH_STATUS_FORMAT
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #container_health_log ⇒ Object
- #logs ⇒ Object
- #remove ⇒ Object
- #run ⇒ Object
- #status ⇒ Object
- #stop ⇒ Object
Methods inherited from Base
#container_id_for, #initialize, #make_directory, #make_directory_for, #remove_directory, #run_over_ssh
Constructor Details
This class inherits a constructor from Kamal::Commands::Base
Instance Method Details
#container_health_log ⇒ Object
24 25 26 |
# File 'lib/kamal/commands/healthcheck.rb', line 24 def container_health_log pipe container_id, xargs(docker(:inspect, "--format", DOCKER_HEALTH_LOG_FORMAT)) end |
#logs ⇒ Object
28 29 30 |
# File 'lib/kamal/commands/healthcheck.rb', line 28 def logs pipe container_id, xargs(docker(:logs, "--tail", log_lines, "2>&1")) end |
#remove ⇒ Object
36 37 38 |
# File 'lib/kamal/commands/healthcheck.rb', line 36 def remove pipe container_id, xargs(docker(:container, :rm)) end |
#run ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/kamal/commands/healthcheck.rb', line 3 def run web = config.role(:web) docker :run, "--detach", "--name", container_name_with_version, "--publish", "#{exposed_port}:#{config.healthcheck["port"]}", "--label", "service=#{config.healthcheck_service}", "-e", "KAMAL_CONTAINER_NAME=\"#{config.healthcheck_service}\"", *web.env_args, *web.health_check_args(cord: false), *config.volume_args, *web.option_args, config.absolute_image, web.cmd end |
#status ⇒ Object
20 21 22 |
# File 'lib/kamal/commands/healthcheck.rb', line 20 def status pipe container_id, xargs(docker(:inspect, "--format", DOCKER_HEALTH_STATUS_FORMAT)) end |
#stop ⇒ Object
32 33 34 |
# File 'lib/kamal/commands/healthcheck.rb', line 32 def stop pipe container_id, xargs(docker(:stop)) end |