Git Product home page Git Product logo

capistrano3-unicorn's Introduction

Capistrano3 Unicorn

This is a capistrano v3 plugin that integrates Unicorn tasks into capistrano deployment scripts; it was heavily inspired by sosedoff/capistrano-unicorn but written from scratch to use the capistrano 3 syntax.

Gotchas

  • The unicorn:start task invokes unicorn as bundle exec unicorn.

  • When running tasks not during a full deployment, you may need to run the rvm:hook:

    cap production rvm:hook unicorn:start

Conventions

You can override the defaults by set :unicorn_example, value in the config/deploy.rb or config/deploy/ENVIRONMENT.rb capistrano deployment files.

Example Unicorn config examples/unicorn.rb

  • :unicorn_pid

    Default assumes your pid file will be located in CURRENT_PATH/tmp/pids/unicorn.pid. The unicorn_pid should be defined with an absolute path.

  • :unicorn_config_path

    Default assumes that your Unicorn configuration will be located in CURRENT_PATH/config/unicorn/RAILS_ENV.rb

  • :unicorn_roles

    Roles to run unicorn commands on. Defaults to :app

  • :unicorn_options

    Set any additional options to be passed to unicorn on startup. Defaults to none

  • :unicorn_rack_env

    Set the RACK_ENV. Defaults to deployment unless the RAILS_ENV is development. Valid options are "development", "deployment", or "none". See the RACK ENVIRONMENT section of the unicorn documentation for more information.

  • :unicorn_bundle_gemfile

    REMOVED in v0.2.0

    Set the BUNDLE_GEMFILE in a before_exec block in your unicorn.rb. See sandbox and unicorn-restart-issue-with-capistrano

  • :unicorn_restart_sleep_time

    In unicorn:legacy_restart send the USR2 signal, sleep for this many seconds (defaults to 3), then send the QUIT signal

Setup

Add the library to your Gemfile:

group :development do
  gem 'capistrano3-unicorn'
end

Add the library to your Capfile:

require 'capistrano3/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.

capistrano3-unicorn's People

Contributors

ahorner avatar davidbennettpio avatar lxxdn avatar mlineen avatar paulca avatar soulcutter avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.