Capistrano Recipes for (re)starting Mongrel (cluster)?

Here’s what I have in my deploy.rb:

desc “Restart the web server”
task :restart, :roles => :app do
run “cd #{current_path}; mongrel_rails cluster::stop -C
#{current_path}/config/mongrel_cluster.yml; cd -”
run “cd #{current_path}; mongrel_rails cluster::start -C
#{current_path}/config/mongrel_cluster.yml; cd -”
end

I’ve tried various other lines, but Mongrel and/or cluster couldn’t find
configs, or logs. And it also seems mongrel_cluster expects to find
configs in /etc/… even if the mongrel_config var is set. Is there a
way to clean up these command lines?

Thanks,
Joe

Oh, I also tried using just mongrel_rails cluster::restart, but files
seemed to keep getting served out of the PREVIOUSLY current folder (the
one in which Mongrel was initially started).

Joe

Hi !

2006/8/26, Joe R. [email protected]:

Oh, I also tried using just mongrel_rails cluster::restart, but files
seemed to keep getting served out of the PREVIOUSLY current folder (the
one in which Mongrel was initially started).

I can’t remember where I saw that, but Mongrel finds the real
directory from which it is started, and attaches there.

What you have to do is use the -c switch when you configure your
cluster:

mongrel_rails cluster::configure -c /var/www/mysite.com/current

When the other cluster tasks read the config file, the first thing
Mongrel will do is CD to the directory in question. So, the symlink
will be refreshed.

Hope that helps !

François Beausoleil
http://blog.teksol.info/