Class: Mrsk::Commands::Healthcheck
- Defined in:
- lib/mrsk/commands/healthcheck.rb
Constant Summary collapse
- EXPOSED_PORT =
3999
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
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
#curl ⇒ Object
20 21 22 |
# File 'lib/mrsk/commands/healthcheck.rb', line 20 def curl [ :curl, "--silent", "--output", "/dev/null", "--write-out", "'%{http_code}'", "--max-time", "2", health_url ] end |
#logs ⇒ Object
24 25 26 |
# File 'lib/mrsk/commands/healthcheck.rb', line 24 def logs pipe container_id, xargs(docker(:logs, "--tail", 50, "2>&1")) end |
#remove ⇒ Object
32 33 34 |
# File 'lib/mrsk/commands/healthcheck.rb', line 32 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 |
# 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, *config.volume_args, *web.option_args, config.absolute_image, web.cmd end |
#stop ⇒ Object
28 29 30 |
# File 'lib/mrsk/commands/healthcheck.rb', line 28 def stop pipe container_id, xargs(docker(:stop)) end |