# Fwd: mongrel cluster restart with capistrano fails but manua

**URL:** <https://www.ruby-forum.com/t/fwd-mongrel-cluster-restart-with-capistrano-fails-but-manua/91273>\
**Category:** Rails\
**Created:** [April 6, 2007, 5:10am UTC](https://www.ruby-forum.com/t/fwd-mongrel-cluster-restart-with-capistrano-fails-but-manua/91273 "2007-04-06T05:10:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [April 6, 2007, 5:10am UTC](https://www.ruby-forum.com/t/fwd-mongrel-cluster-restart-with-capistrano-fails-but-manua/91273/1 "2007-04-06T05:10:18Z")

</div>

---------- Forwarded message ----------  
From: Michael S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: Apr 3, 2007 12:23 PM  
Subject: mongrel cluster restart with capistrano fails but manually  
works  
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  
/etc/mongrel\_cluster/mongrel\_cluster.yml

cwd: /home/app/current  
port: “8000”  
address: 127.0.0.1  
pid\_file: log/mongrel.pid  
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  
begin  
run “sudo /etc/init.d/mongrel\_cluster stop”  
run “sleep 5”  
run “sudo /etc/init.d/mongrel\_cluster start”  
end

…

# 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/”  
end

desc “Apache restarter”  
task :kick\_apache, :roles=\>:web do  
sudo “/usr/local/apache/bin/apachectl restart”  
end

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  
begin  
run “sudo kill -9 `ps -ef | grep mongrel | egrep -v grep | awk '{print $2}'`”  
run “cd /home/user/app/log && sudo rm -rf \*.pid”  
end

task :after\_after\_deploy, roles =\> :app do  
begin  
" sudo /etc/init.d/mongrel\_cluster start"  
end

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

–  
-mike

–  
-mike

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [April 6, 2007, 6:03pm UTC](https://www.ruby-forum.com/t/fwd-mongrel-cluster-restart-with-capistrano-fails-but-manua/91273/2 "2007-04-06T18:03:49Z")

</div>

try sudo /etc/init.d/mongrel\_cluster restart instead.
