Class: Minke::Docker::HealthCheck
- Inherits:
-
Object
- Object
- Minke::Docker::HealthCheck
- Defined in:
- lib/minke/docker/health_check.rb
Overview
HealthCheck checks health of a running container
Instance Method Summary collapse
-
#initialize(count = nil, pause = nil) ⇒ HealthCheck
constructor
A new instance of HealthCheck.
-
#wait_for_HTTPOK(url) ⇒ Object
waits until a 200 response is received from the given url.
Constructor Details
#initialize(count = nil, pause = nil) ⇒ HealthCheck
Returns a new instance of HealthCheck.
7 8 9 10 11 |
# File 'lib/minke/docker/health_check.rb', line 7 def initialize count=nil, pause=nil @count = count ||= 180 @pause = pause ||= 1 @successes = 2 end |
Instance Method Details
#wait_for_HTTPOK(url) ⇒ Object
waits until a 200 response is received from the given url
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/minke/docker/health_check.rb', line 15 def wait_for_HTTPOK url puts "Waiting for server #{url} to start #{@count} attempts left" begin response = RestClient.send('get', url) rescue puts 'Invalid response from server' end check_response response, url end |