Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Mongrel Spinner and Restart tasks for Capistrano (See related posts)

These tasks should work with the default deploy.rb file. I assume you've at least read the Capistrano manual at rubyonrails.com, also, you should get your app running on mongrel first with manual booting and restarting before you try to automate.

h2. Spinner

desc <<-DESC
Spinner is run by the default cold_deploy task. Instead of using script/spinner, we're just gonna rely on Mongrel to keep itself up.
DESC
task :spinner, :roles => :app do
  application_port = xxxx #get this from your friendly sysadmin
  run "mongrel_rails start -e production -p #{application_port} -d -c #{current_path}"
end


h2. Restart

desc "Restart the web server"
task :restart, :roles => :app do
  begin
    run "cd #{current_path} && mongrel_rails restart"
  rescue RuntimeError => e
    puts e
    puts "Probably not a big deal, so I'll just keep trucking..."
  end
end


There's a more complete article on my blog.

You need to create an account or log in to post comments to this site.


Click here to browse all 4861 code snippets

Related Posts