Skip to content
Moonshine plugin for basic Sidekiq configuration and deployment
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Moonshine Sidekiq

For deploying sidekiq with moonshine. It replaces the built-in capistrano management of sidekiq with god.


# Rails 2
script/plugin install git:// --force
script/plugin install git:// --force
# Rails 3
script/rails plugin install git:// --force
script/rails plugin install git:// --force

Make sure you place custom Sidekiq configuration options into a config/sidekiq.yml (example)

Configure as necessary in your moonshine.yml (or stage-specific moonshine yml):

  :workers: 2

Next, add the recipe to the manifests in question:

# app/manifests/application_manifest.rb
recipe :god
recipe :sidekiq

Add the :sidekiq and :god roles to any servers that run sidekiq:

# config/deploy/production.rb
server '', :web, :sidekiq, :god, :db, :primary => true

And make sure to remove sidekiq/capistrano related settings from config/deploy.rb, such as:

require 'sidekiq/capistrano'
set :sidekiq_cmd, "#{bundle_cmd} exec sidekiq"
set :sidekiqctl_cmd, "#{bundle_cmd} exec sidekiqctl"
set :sidekiq_timeout, 10
set :sidekiq_role, :app
set :sidekiq_pid, "#{current_path}/tmp/pids/"
set :sidekiq_processes, 1

Managing Sidekiq with God

This plugin also provides the following Capistrano tasks:

cap god:sidekiq:stop
cap god:sidekiq:start
cap god:sidekiq:restart
cap god:sidekiq:status

We recommend having Sidekiq restart on deploy to reload code changes:

# config/deploy.rb
after 'god:restart', 'god:sidekiq:restart'


That's it. Deploy and done!

Unless otherwise specified, all content copyright © 2014, Rails Machine, LLC

Something went wrong with that request. Please try again.