Capistrano Unicorn
Unicorn specific tasks for Capistrano
Installation
-
Add Capistrano Unicorn to your Gemfile:
group :deployment gem 'capistrano-unicorn', github: 'bitcoveries/capistrano-unicorn', require: false end
-
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 anyon
block since the task handles this for you; otherwise you will get anundefined 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
RSpec
Run specs withRun rspec
.
or via Guard:
$ guard -g spec
RuboCop
RunRun 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.