Mongrel_cluster restart problem with capistrano

I’m having an issue every time I deploy where my mongrel_cluster isn’t
being restarted and I have to do the mongrel_cluster::restart command
myself manually through the terminal on my server.

I’ve pasted my config/deploy.rb file here for you to see:

http://pastie.caboo.se/36705

Here is my config/mongrel_cluster.yml file:


cwd: /var/www/rp-portal/current
port: “8000”
environment: production
pid_file: log/mongrel.pid
servers: 2

I am using a hardware load balancer, that is why I dont have the address
line in the mongrel config file.

any ideas why the deploy task won’t restart by cluster? I don’t receive
any errors in the output, in fact the output tells me

Stopping 2 Mongrel servers…
Starting 2 Mongrel servers…

which means to me it worked fine. but of course it didnt.

Hi Craig,
I’ve just started using Capistrano and am having the same problem.
When deploying or rolling back, the mongrel cluster (3 instances)
fails to restart nearly every time. The PID files are not being
deleted when the cluster is stopped and so when it tries to start the
cluster again it fails because the PIDs exist.

Other times it has started the cluster but spawned 6-9 mongrel
instances.

Like yourself I’ve had to resort to restarting the cluster manually
which isn’t ideal.

Did you find a solution to this problem? Or, would anybody else be
able to assist with this?

Thanks in advance for any help.

Regards,

Niall M.
http://www.4L.ie/

On Jan 30, 3:01 pm, Craig J. <ruby-forum-incom…@andreas-

Niall,

I still have not found a solution to this problem. Since you have
tracked it down to the fact that the PID files aren’t being deleted, I
may be able to work up a solution. I’ll take a look and see if I can
come up with anything

  • Craig

Niall M. wrote:

Hi Craig,
I’ve just started using Capistrano and am having the same problem.
When deploying or rolling back, the mongrel cluster (3 instances)
fails to restart nearly every time. The PID files are not being
deleted when the cluster is stopped and so when it tries to start the
cluster again it fails because the PIDs exist.

Other times it has started the cluster but spawned 6-9 mongrel
instances.

Like yourself I’ve had to resort to restarting the cluster manually
which isn’t ideal.

Did you find a solution to this problem? Or, would anybody else be
able to assist with this?

Thanks in advance for any help.

Regards,

Niall M.
http://www.4L.ie/

On Jan 30, 3:01 pm, Craig J. <ruby-forum-incom…@andreas-

I had same problem. Seems to be fixed after I changed the setting for
pid_file in in mongrel_cluster.yml to absolute path.

Ronald Sacher

Thanks for the reply Craig.

Capistrano was throwing the error about the PID files which is how I
found out about it. If you weren’t seeing an error in the Capistrano
log then you may be having a different problem.

The puzzling thing is, a direct command line call to ‘mongrel_rails
cluster::restart’ deletes the PID files correctly. But when
Capistrano calls that function it seems to have problems.

I’m wondering if it’s an issue with the location of the PID files -
perhaps they need to be in shared/pids and not log/? I’m going to
examine the mongrel_cluter/recipes file to see if I can track down the
problem and report back.

Please let me know if you make any progress.

Cheers,

Niall M.
http://www.4L.ie/

On Feb 11, 9:06 pm, Craig J. <ruby-forum-incom…@andreas-

Craig J. wrote:

Ronald Sacher wrote:

I had same problem. Seems to be fixed after I changed the setting for
pid_file in in mongrel_cluster.yml to absolute path.

Ronald Sacher

Ronald, you just did the absolute path to your
/app/current/log/mongrel.pid i assume, correct?

The problem with restarting is that capistrano has not linked the
tmp/pids directory back before it calls restart. So basically, unless
you’re passing hte path to your ‘shared’ pids directory it’ll always
fail miserably. :frowning:

my mongrel cluster.yml file looks like this
pid_file: /home/production/Sites/milestone/shared/pids/mongrel.pid

Where ‘current_path’ is normally
/home/production/Sites/milestone/current

Hope this helps.

Ronald Sacher wrote:

I had same problem. Seems to be fixed after I changed the setting for
pid_file in in mongrel_cluster.yml to absolute path.

Ronald Sacher

Ronald, you just did the absolute path to your
/app/current/log/mongrel.pid i assume, correct?