mongrel_cluster capistrano recipe


/ Published in: Rails
Save to your folder(s)

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`


Copy this code and paste it in your HTML
  1. namespace :deploy do
  2. namespace :mongrel do
  3. [ :stop, :start, :restart ].each do |t|
  4. desc "#{t.to_s.capitalize} the mongrel appserver"
  5. task t, :roles => :app do
  6. #invoke_command checks the use_sudo variable to determine how to run the mongrel_rails command
  7. invoke_command "mongrel_rails cluster::#{t.to_s} -C #{mongrel_conf}", :via => run_method
  8. end
  9. end
  10. end
  11.  
  12. desc "Custom restart task for mongrel cluster"
  13. task :restart, :roles => :app, :except => { :no_release => true } do
  14. deploy.mongrel.restart
  15. end
  16.  
  17. desc "Custom start task for mongrel cluster"
  18. task :start, :roles => :app do
  19. deploy.mongrel.start
  20. end
  21.  
  22. desc "Custom stop task for mongrel cluster"
  23. task :stop, :roles => :app do
  24. deploy.mongrel.stop
  25. end
  26.  
  27. end

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.