No commit activity in last 3 years
No release in over 3 years
Capistrano plugin that integrates Unicorn server tasks.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

>= 0

Runtime

 Project Readme

Capistrano Unicorn

Capistrano plugin that integrates Unicorn tasks into capistrano deployment script.

Installation

Install library from rubygems:

gem install capistrano-unicorn

Usage

Setup

Add the library to your Gemfile:

group :development do
  gem 'capistrano-unicorn', :require => false
end

And load it into your deployment script config/deploy.rb:

require 'capistrano-unicorn'

Add unicorn restart task hook:

after 'deploy:restart', 'unicorn:restart' # app IS NOT preloaded
after 'deploy:restart', 'unicorn:reload'  # app preloaded

Create a new configuration file config/unicorn/unicorn.rb or config/unicorn/STAGE.rb, where stage is your deployment environment.

Example config - examples/rails3.rb. Please refer to unicorn documentation for more examples and configuration options.

Test

First, make sure you're running the latest release:

cap deploy

Then you can test each individual task:

cap unicorn:start
cap unicorn:stop
cap unicorn:reload

Configuration

You can modify any of the following options in your deploy.rb config.

  • unicorn_env - Set unicorn environment. Default to rails_env variable.
  • unicorn_pid - Set unicorn PID file path. Default to current_path/tmp/pids/unicorn.pid
  • unicorn_bin - Set unicorn executable file. Default to unicorn.
  • unicorn_bundle - Set bundler command for unicorn. Default to bundle.

Available Tasks

To get a list of all capistrano tasks, run cap -T:

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:shutdown                  # Immediately shutdown Unicorn
cap unicorn:start                     # Start Unicorn master process
cap unicorn:stop                      # Stop Unicorn

License

See LICENSE file for details.