gdogaru
gdogaru

Reputation: 521

Chef sanity check on deployed app

I am using AWS Opsworks that uses Chef to deploy a java application (war file)

The problem is that the chef recipe completes but when that happens tomcat is set to restart.

So, there is a period between when the deployment appears successful and the app is actually available.

And the tomcat restart may also fail in that period.

Is there a cookbook to ping a specific url with a timeout and consider the chef run successful only if the ping is successful?

Upvotes: 0

Views: 164

Answers (1)

coderanger
coderanger

Reputation: 54181

You could add this to your recipe code:

ruby_block 'wait for tomcat' do
  block do
    until (Chef::HTTP.new('http://localhost').get('/') rescue false)
      sleep(1)
    end
  end
end

Or something like that.

Upvotes: 1

Related Questions