Forum: Ruby on Rails Fwd: mongrel cluster restart with capistrano fails but manua

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Michael S. (Guest)
on 2007-04-06 07:10
(Received via mailing list)
---------- Forwarded message ----------
From: Michael S. <removed_email_address@domain.invalid>
Date: Apr 3, 2007 12:23 PM
Subject: mongrel cluster restart with capistrano fails but manually
To: removed_email_address@domain.invalid

Hi all,

I am out of my head here...

I have a 3 node cluster with 10 mongrels running on each. When I
deploy, I break all the mongrels every time. I have tried just about
everything. I can restart my mongrels without a hitch manually, it's
only when I use cap deploy. Maybe I am missing something here... so if
I can get some help it would be appreciated. The errors are the
typical mongrel pid errors, I can paste them if need be.

I have mongrel_cluster.yml sym linked from
/{current_path}/config/mongrel_cluster.yml to

cwd: /home/app/current
port: "8000"
pid_file: log/
environment: production
servers: 10

here is a snippet of  my deploy.rb


require 'mongrel_cluster/recipes'
require 'capistrano'

# below snipped for brevity
role :web
role :app


# restart mongrel with /etc/init.d/mongrel_cluster restart
desc "Restart the web server"
task :restart, :roles => :app do
    run "sudo /etc/init.d/mongrel_cluster stop"
    run "sleep 5"
    run "sudo /etc/init.d/mongrel_cluster start"

# couple of tasks to chown some files and directories
desc "Only app servers get this applied to them post-deployment"
task :after_app_deploy, :roles=>:app do
  sudo "chown -PRf foo:foo       #{deploy_to}/current/"
  sudo "chown -PRf foo:foo       #{deploy_to}/releases/"
  sudo "chmod -Rf 755                     #{deploy_to}/releases/"
  sudo "chmod -Rf 750                     #{deploy_to}/current/public/"

desc "Apache restarter"
task :kick_apache, :roles=>:web do
  sudo "/usr/local/apache/bin/apachectl restart"

Now, mongrel gets restarted even if I don't use the above when I
restart when I run deploy.. but I don't see where I can change that or
if that is in fact causing the problem.

for whatever reason, mongrels never start on 8000 - 8004, but do start
from 8005 - 8009, so I am thinking something in the cap script. I did
migrate recently from lighty+fastcgi to apache+mongrel
and I have 10 mongrels per machine on ports 8000 - 8009. I was
thinking that dispatch was screwing up ports 8000-04 somehow.. (
totally guessing )

I was thinking about writing a task similar to below... but I think it
is overkill.

desc "Kill all the pids in case there are some zombies and remove the
.pid files"
task :before_before_deploy, roles => :app do
    run "sudo kill -9 `ps -ef | grep mongrel | egrep -v grep | awk
'{print $2}'`"
    run "cd /home/user/app/log && sudo rm -rf *.pid"

task :after_after_deploy, roles => :app do
    " sudo /etc/init.d/mongrel_cluster start"


Hopefully someone can see something that I don't.
Thanks for your time


Justin M. (Guest)
on 2007-04-06 20:03
try sudo /etc/init.d/mongrel_cluster restart instead.
This topic is locked and can not be replied to.