Return to Snippet

Revision: 8230
at September 10, 2008 01:09 by jimmyebaker


Initial Code
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

Initial URL

                                

Initial Description
I normally paste this into config/mongrel.rb, then add "require 'mongrel'" in my config/deploy.rb

Once that's done, you'll be able to start, stop, and restart your mongrels like so:
`cap deploy:mongrel:start/stop/restart`

Initial Title
mongrel_cluster capistrano recipe

Initial Tags
rails, ruby

Initial Language
Rails