Capistrano deployment for Rails

I think I have found my all time favorite gem; capistrano-unicorn

Simply put, if you use Capistrano and Unicorn, you have to use this gem.  I have messed around with setting up init.d scripts for starting and stopping Unicorn and they have all been more trouble than help.

All I had to do was add a couple of lines to my deploy.rb file:

# Unicorn tasks
require 'capistrano-unicorn'
after 'deploy:restart', 'unicorn:reload'
after 'deploy:restart', 'unicorn:restart'

I think that the best thing about this gem is the added cap tasks that can be run from your machine:

cap unicorn:add_worker               # Add a new worker
cap unicorn:remove_worker            # Remove amount of workers
cap unicorn:reload                   # Reload Unicorn
cap unicorn:restart                  # Restart Unicorn
cap unicorn:show_vars                # Debug Unicorn variables
cap unicorn:shutdown                 # Immediately shutdown Unicorn
cap unicorn:start                    # Start Unicorn master process
cap unicorn:stop                     # Stop Unicorn
comments powered by Disqus