Class: Cany::Recipes::Sidekiq
- Inherits:
-
Cany::Recipe
- Object
- Cany::Recipe
- Cany::Recipes::Sidekiq
- Defined in:
- lib/cany/recipes/sidekiq.rb
Overview
The recipe relies that ‘sidekiq’ is listed inside your Gemfile and therefore installed via the ‘bundler’ recipe.
This recipes installs Sidekiq
"Simple, efficient, background processing in Ruby"
Sidekiq is registered as service and so automatically started.
Defined Under Namespace
Classes: DSL
Instance Attribute Summary collapse
-
#group ⇒ String?
The group name as which the sidekiq process should executed.
-
#queues ⇒ Array<String>?
An (optional) list of queue names sidekiq should listen on.
-
#user ⇒ String?
The user name as which the sidekiq process should executed.
Attributes inherited from Cany::Recipe
Instance Method Summary collapse
- #binary ⇒ Object
-
#initialize(*args) ⇒ Sidekiq
constructor
A new instance of Sidekiq.
- #sidekiq_args ⇒ Object
Methods inherited from Cany::Recipe
#build, #clean, #configure, #create, #depend, #exec, from_name, hook, #hook, #install, #install_content, #install_dir, #install_link, #install_service, option, #option, #prepare, #recipe, register_as, #rmtree, #ruby_bin, #run_hook
Methods included from Mixins::DependMixin
Constructor Details
#initialize(*args) ⇒ Sidekiq
Returns a new instance of Sidekiq.
24 25 26 27 28 29 |
# File 'lib/cany/recipes/sidekiq.rb', line 24 def initialize(*args) @queues = [] @user = 'www-data' @group = 'www-data' super end |
Instance Attribute Details
#group ⇒ String?
Returns The group name as which the sidekiq process should executed.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/cany/recipes/sidekiq.rb', line 18 class Sidekiq < Cany::Recipe register_as :sidekiq attr_accessor :queues attr_accessor :user, :group def initialize(*args) @queues = [] @user = 'www-data' @group = 'www-data' super end class DSL < Cany::Recipe::DSL def queue(name) @recipe.queues << name end delegate :user, :group end def binary install_service name, %W(/usr/bin/#{spec.name} sidekiq) + sidekiq_args, user: user, group: group inner.binary end def sidekiq_args args = %w(--environment production) queues.each do |queue| args << '--queue' args << queue.to_s end args end end |
#queues ⇒ Array<String>?
Returns An (optional) list of queue names sidekiq should listen on.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/cany/recipes/sidekiq.rb', line 18 class Sidekiq < Cany::Recipe register_as :sidekiq attr_accessor :queues attr_accessor :user, :group def initialize(*args) @queues = [] @user = 'www-data' @group = 'www-data' super end class DSL < Cany::Recipe::DSL def queue(name) @recipe.queues << name end delegate :user, :group end def binary install_service name, %W(/usr/bin/#{spec.name} sidekiq) + sidekiq_args, user: user, group: group inner.binary end def sidekiq_args args = %w(--environment production) queues.each do |queue| args << '--queue' args << queue.to_s end args end end |
#user ⇒ String?
Returns The user name as which the sidekiq process should executed.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/cany/recipes/sidekiq.rb', line 18 class Sidekiq < Cany::Recipe register_as :sidekiq attr_accessor :queues attr_accessor :user, :group def initialize(*args) @queues = [] @user = 'www-data' @group = 'www-data' super end class DSL < Cany::Recipe::DSL def queue(name) @recipe.queues << name end delegate :user, :group end def binary install_service name, %W(/usr/bin/#{spec.name} sidekiq) + sidekiq_args, user: user, group: group inner.binary end def sidekiq_args args = %w(--environment production) queues.each do |queue| args << '--queue' args << queue.to_s end args end end |
Instance Method Details
#binary ⇒ Object
38 39 40 41 |
# File 'lib/cany/recipes/sidekiq.rb', line 38 def binary install_service name, %W(/usr/bin/#{spec.name} sidekiq) + sidekiq_args, user: user, group: group inner.binary end |
#sidekiq_args ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/cany/recipes/sidekiq.rb', line 43 def sidekiq_args args = %w(--environment production) queues.each do |queue| args << '--queue' args << queue.to_s end args end |