Class: Kamal::Commands::Healthcheck
- Inherits:
-
Base
- Object
- Base
- Kamal::Commands::Healthcheck
show all
- 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
#config
Instance Method Summary
collapse
Methods inherited from Base
#container_id_for, #initialize, #make_directory, #make_directory_for, #remove_directory, #run_over_ssh
Instance Method Details
#container_health_log ⇒ Object
23
24
25
|
# File 'lib/kamal/commands/healthcheck.rb', line 23
def container_health_log
pipe container_id, xargs(docker(:inspect, "--format", DOCKER_HEALTH_LOG_FORMAT))
end
|
#logs ⇒ Object
27
28
29
|
# File 'lib/kamal/commands/healthcheck.rb', line 27
def logs
pipe container_id, xargs(docker(:logs, "--tail", log_lines, "2>&1"))
end
|
#remove ⇒ Object
35
36
37
|
# File 'lib/kamal/commands/healthcheck.rb', line 35
def remove
pipe container_id, xargs(docker(:container, :rm))
end
|
#run ⇒ Object
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/kamal/commands/healthcheck.rb', line 2
def run
primary = config.role(config.primary_role)
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}\"",
*primary.env_args,
*primary.health_check_args(cord: false),
*config.volume_args,
*primary.option_args,
config.absolute_image,
primary.cmd
end
|
#status ⇒ Object
19
20
21
|
# File 'lib/kamal/commands/healthcheck.rb', line 19
def status
pipe container_id, xargs(docker(:inspect, "--format", DOCKER_HEALTH_STATUS_FORMAT))
end
|
#stop ⇒ Object
31
32
33
|
# File 'lib/kamal/commands/healthcheck.rb', line 31
def stop
pipe container_id, xargs(docker(:stop))
end
|