vlad-unicorn

DESCRIPTION:

Unicorn app server support for Vlad. Adds support for vlad:start_app and vlad:stop_app using Unicorn.

FEATURES/PROBLEMS:

SYNOPSIS:

# lib/tasks/vlad.rake
begin
  require 'vlad'
  Vlad.load(:app => :unicorn)
rescue LoadError
end

or for legacy Rails (1.2.x thru 2.2.x) apps

# lib/tasks/vlad.rake
begin
  require 'vlad'
  Vlad.load(:app => :unicorn_rails)
rescue LoadError
end

For more on specific issues when deploying Rails applications, see rails-configuration.txt.

REQUIREMENTS:

INSTALL:

$ sudo gem install vlad-unicorn

VARIABLES:

unicorn_command

Defaults to ‘unicorn’ when using :app => :unicorn, and ‘unicorn_rails’ with :app => :unicorn_rails.

unicorn_config

The location of the Unicorn config file. Defaults to “#{current_path}/config/unicorn.rb”.

unicorn_pid

The location of the Unicorn pid file. Must be the same as in unicorn.rb file. Currently needed for the stop_app task, but hopefully won’t be necessary in a future version.

unicorn_rackup

The location of the rackup file unicorn should load. Defaults to “#{current_path}/config.ru”. Not set nor used for unicorn_rails.

unicorn_use_sudo

Whether to use sudo to run the ‘unicorn’ command on the remote host. Probably necessary if you specify a user and group in unicorn.rb.

unicorn_env

Environment to be given to unicorn (value for -E). Default value is based on vlad/rails‘s rails_env. If rails_env is not defined, production is used as default value. To disable passing an environment, set to nil.

unicorn_use_bundler

Whether to use bundle exec to run the ‘unicorn’ command on the remote host. Defaults to false.

unicorn_bundle_cmd

How to invoke bundle exec. Defaults to cd #{current_path} && bundle exec. If you have defined bundle_cmd for Bundler’s built-in deployment tasks, vlad-unicorn will use that in place of bundle in the above default.

For more on specific issues when deploying Rails applications, see rails-configuration.txt.

TASKS:

start_app, stop_app

Vlad’s built-in tasks to start and stop the application processes, adapted for Unicorn.

reload_app

Reload unicorn (in case preload_app == true). If this is the case, you have to adapt your before_fork hook so it kills the old unicorn master and workers. Cf. “Getting started with unicorn”.

LICENSE:

(The MIT License)

Copyright © 2012 Kevin Bullock and the rest of the Ruby Hit Squad

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.