Tom Copeland's Recent Posts

RSS Feeds

« mod_rails for your staging environment | Main | Capistrano, local_repository, and deploy_via :copy »

mod_rails and Capistrano

Here's the Capistrano code I've been using with mod_rails:

namespace :deploy do
  desc "Restarting mod_rails with restart.txt"
  task :restart, :roles => :app, :except => { :no_release => true } do
    run "touch #{current_path}/tmp/restart.txt"
  end

  [:start, :stop].each do |t|
    desc "#{t} task is a no-op with mod_rails"
    task t, :roles => :app do ; end
  end
end

I think that's all there is to it... as far as I can tell, start and stop don't make much sense in a mod_rails context.  I suppose you could use them to disable the app altogether somehow, although that kind of relates to this issue about maintenance.html.

Credit for the restart task goes to Jim Neath; the change I made was just to put it in the deploy namespace.  Works either way, though.

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d83451d3c069e200e5522505af8833

Listed below are links to weblogs that reference mod_rails and Capistrano:

Comments

Right on. Good stuff. I can't wait to reconfigure all my Dreamhost FastCGI sites to mod_rails. And this task gives me the goods for restarting.

Thanks!

Thanks so much for this. I now have a very clean deployment setup with Passenger.

Nice! The second task is key (or was for me anyways) b/c :start and :stop will fail otherwise. Thanks!

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Comments are moderated, and will not appear until the author has approved them.