Class: Mrsk::Commands::Healthcheck
- Defined in:
- lib/mrsk/commands/healthcheck.rb
Constant Summary collapse
- EXPOSED_PORT =
3999
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, #run_over_ssh
Constructor Details
This class inherits a constructor from Mrsk::Commands::Base
Instance Method Details
#container_health_log ⇒ Object
25 26 27 |
# File 'lib/mrsk/commands/healthcheck.rb', line 25 def container_health_log pipe container_id, xargs(docker(:inspect, "--format", DOCKER_HEALTH_LOG_FORMAT)) end |
#logs ⇒ Object
29 30 31 |
# File 'lib/mrsk/commands/healthcheck.rb', line 29 def logs pipe container_id, xargs(docker(:logs, "--tail", 50, "2>&1")) end |
#remove ⇒ Object
37 38 39 |
# File 'lib/mrsk/commands/healthcheck.rb', line 37 def remove pipe container_id, xargs(docker(:container, :rm)) end |
#run ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/mrsk/commands/healthcheck.rb', line 4 def run web = config.role(:web) docker :run, "--detach", "--name", container_name_with_version, "--publish", "#{EXPOSED_PORT}:#{config.healthcheck["port"]}", "--label", "service=#{container_name}", "-e", "MRSK_CONTAINER_NAME=\"#{container_name}\"", *web.env_args, *web.health_check_args, *config.volume_args, *web.option_args, config.absolute_image, web.cmd end |
#status ⇒ Object
21 22 23 |
# File 'lib/mrsk/commands/healthcheck.rb', line 21 def status pipe container_id, xargs(docker(:inspect, "--format", DOCKER_HEALTH_STATUS_FORMAT)) end |
#stop ⇒ Object
33 34 35 |
# File 'lib/mrsk/commands/healthcheck.rb', line 33 def stop pipe container_id, xargs(docker(:stop)) end |