DZone 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
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 <a href="http://jchris.mfdz.com/articles/2006/05/09/deploying-with-capistrano-and-mongrel-on-planet-argon">on my blog.</a>





