harvesthq/capistrano-sidekiq

Name: capistrano-sidekiq

Owner: Harvest

Description: Sidekiq integration for Capistrano

Created: 2015-09-15 17:17:45.0

Updated: 2015-09-15 17:17:46.0

Pushed: 2015-09-15 17:22:03.0

Homepage: null

Size: 190

Language: Ruby

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Gem Version Dependency Status

Capistrano::Sidekiq

Sidekiq integration for Capistrano

Installation

Add this line to your application's Gemfile:

gem 'capistrano-sidekiq', github: 'seuros/capistrano-sidekiq'

or:

gem 'capistrano-sidekiq', group: :development

And then execute:

$ bundle
Usage
# Capfile

require 'capistrano/sidekiq'
require 'capistrano/sidekiq/monit' #to require monit tasks # Only for capistrano3

Configurable options, shown here with defaults:

:sidekiq_default_hooks => true
:sidekiq_pid => File.join(shared_path, 'tmp', 'pids', 'sidekiq.pid')
:sidekiq_env => fetch(:rack_env, fetch(:rails_env, fetch(:stage)))
:sidekiq_log => File.join(shared_path, 'log', 'sidekiq.log')
:sidekiq_options => nil
:sidekiq_require => nil
:sidekiq_tag => nil
:sidekiq_config => nil
:sidekiq_queue => nil
:sidekiq_timeout => 10
:sidekiq_role => :app
:sidekiq_processes => 1
:sidekiq_options_per_process => nil
:sidekiq_concurrency => nil
:sidekiq_monit_templates_path => 'config/deploy/templates'
:sidekiq_monit_use_sudo => true
:sidekiq_cmd => "#{fetch(:bundle_cmd, "bundle")} exec sidekiq" # Only for capistrano2.5
:sidekiqctl_cmd => "#{fetch(:bundle_cmd, "bundle")} exec sidekiqctl" # Only for capistrano2.5

There is a known bug that prevents sidekiq from starting when pty is true on Capistrano 3.

:pty,  false
Multiple processes

You can configure sidekiq to start with multiple processes. Just set the proper amount in sidekiq_processes.

You can also customize the configuration for every process. If you want to do that, just set sidekiq_options_per_process with an array of the configuration options that you want in string format. This example should boot the first process with the queue high and the second one with the queues default and low:

:sidekiq_options_per_process, ["--queue high", "--queue default --queue low"]
Different number of processes per host

You can configure how many processes you want to run on each host next way:

:sidekiq_role, [:sidekiq_small, :sidekiq_big]
:sidekiq_small_processes, 1
:sidekiq_big_processes, 4
er 'example-small.com', roles: [:sidekiq_small]
er 'example-big.com', roles: [:sidekiq_big]
Customizing the monit sidekiq templates

If you need change some config in redactor, you can

bundle exec rails generate capistrano:sidekiq:monit:template

If your deploy user has no need in sudo for using monit, you can disable it as follows:

:sidekiq_monit_use_sudo, false
Changelog
Contributors
Contributing
  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.