/capistrano-unicorn

Unicorn specific tasks for Capistrano

Primary LanguageRubyMIT LicenseMIT

Capistrano Unicorn

Gemnasium Status

Unicorn specific tasks for Capistrano

Installation

  1. Add Capistrano Unicorn to your Gemfile:

    group :deployment
      gem 'capistrano-unicorn', github: 'bitcoveries/capistrano-unicorn', require: false
    end
  2. Run bundle to install all dependencies with Bundler

Usage

Require Capistrano Unicorn to your Capfile:

require 'capistrano/unicorn'

Invoke Unicorn from your config/deploy.rb or config/deploy/<ENVIRONMENT>.rb:

If preload_app:true use:

after 'deploy:publishing', 'deploy:restart'
namespace :deploy do
  task :restart do
    invoke 'unicorn:restart'
  end
end

If preload_app:true and you need Capistrano to cleanup your *.oldbin PID use:

after 'deploy:publishing', 'deploy:restart'
namespace :deploy do
  task :restart do
    invoke 'unicorn:legacy_restart'
  end
end

Otherwise use:

after 'deploy:publishing', 'deploy:restart'
namespace :deploy do
  task :restart do
    invoke 'unicorn:reload'
  end
end

Note that presently you must put the invoke outside any on block since the task handles this for you; otherwise you will get an undefined method 'verbosity' error.*

Ensure that the unicorn_pid directory has been added to linked_dirs setting. Otherwise Unicorn workers will not be properly killed/restarted.

Development

Run specs with RSpec

Run rspec.

or via Guard:

$ guard -g spec

Run RuboCop

Run rubocop.

To run all specs and RuboCop altogether, run rake.

Bug Reports

Github Issues are used for managing bug reports and feature requests. If you run into issues, please search the issues and submit new problems here.

Credits

Capistrano Unicorn is heavily inspired by sosedoff/capistrano-unicorn.

License

Capistrano Unicorn is released under the MIT License (MIT), see LICENSE.