Capistrano 2.0 and Mongrel Recipies

Posted by Michael Tue, 27 Nov 2007 20:15:00 GMT

Capistrano 2.0 doesn’t work with those mongrel recipes we all have nowadays. We scratched our head at some hacks before finding a good solution via the blog world.

Thanks to Megablaix, Inc for posting this code. Works great for us, just tack it onto the end of your deploy.rb and go:

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 
        # the mongrel_rails command
        invoke_command "mongrel_rails cluster::#{t.to_s} -C #{mongrel_conf}", :via => run_method
      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 start task for mongrel cluster" 
  task :start, :roles => :app do
    deploy.mongrel.start
  end

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

Posted in , , ,  | no comments | no trackbacks

Comments

Trackbacks

Use the following link to trackback from your own site:
http://weblog.imapenguin.com/trackbacks?article_id=capistrano-2-0-and-mongrel-recipies&day=27&month=11&year=2007

Comments are disabled