How to pause between mongrel stop and start in "cap deploy"

Hi!

Sometimes when doing “cap deploy”, the process finishes by:

** [out :: unebo] stopping port 6500
** [out :: unebo] already started port 6500
command finished

It seems that mongrel didn’t have the time to stop before capistrano
tried to start it again. I suspect this is the cause, because something
like 50% it is working no problem.

When it happens though, I just issue “cap deploy:start” and everything
is ok.

I wonder if it is possible to include some little delay (1 or 2 seconds)
between stopping and starting mongrels…

thank you very much!

david

forgot to mention: I use this in my deploy.rb file:

set :mongrel_conf,
“/var/www/#{application}/current/config/mongrel_cluster.yml”

namespace :deploy do
namespace :mongrel do
[ :stop, :start, :restart ].each do |t|
desc “#{t.to_s.capitalize} the mongrel appserver”
task t, :roles => :app do
#invoke_command checks the use_sudo variable to determine how to
run th$
invoke_command “mongrel_rails cluster::#{t.to_s} -C
#{mongrel_conf}”, :blush:
end
end
end

desc “Custom restart task for mongrel cluster”
task :restart, :roles => :app, :except => { :no_release => true } do
deploy.mongrel.restart
end

desc “Custom stop task for mongrel cluster”
task :stop, :roles => :app do
deploy.mongrel.stop
end

end

D. Krmpotic wrote:

I wonder if it is possible to include some little delay (1 or 2 seconds)
between stopping and starting mongrels…

We rewrote the deploy:restart task, making it manually stop and start
mongrel, along with a 2.5 sec ‘nap’ in between. For us, mongrel_rails
cluster::restart doesn’t work reliably, especially with many mongrels
running.

namespace(:deploy) do

(…)

desc “Restart the Mongrel processes on the app server by calling
restart_mongrel_cluster.”
task :restart, :roles => :app do
#mongrel.cluster.restart
mongrel.cluster.stop
sleep 2.5
mongrel.cluster.start
apache.restart
end

(…)
end

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs