Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A plugin for moonshine (see railsmachine/moonshine) to install/run Resque (defunkt/resque)
Ruby

This branch is 45 commits ahead of pushcx:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
generators
lib
moonshine
recipes
spec
templates
.gitignore
LICENSE
README.rdoc

README.rdoc

Moonshine_Resque

A Moonshine plugin for installing and managing resque.

Rails 2 Installation

script/plugin install git://github.com/railsmachine/moonshine_redis.git
script/plugin install git://github.com/railsmachine/moonshine_resque.git
script/generate moonshine_resque

Rails 3 Installation

script/rails plugin install git://github.com/railsmachine/moonshine_resque.git
script/rails g moonshine_resque --with-god

Configuration

  • Configure settings in your moonshine.yml (Or use configure() in manifest as usual)

  • Add this to the end of your Rakefile:

    # Rails 2 only, Rails 3 does it for you in lib/tasks/resque_tasks.rake
    require 'resque/tasks'
  • Include the recipes in your Moonshine manifest

    recipe :redis           # requires moonshine_redis
    recipe :resque
    recipe :resque_web      # optional
    recipe :god             # optional, requires moonshine_god to monitor Resque with god

Resque Web Interface

Resque Web Interface can be configured with the following options in your moonshine.yml:

:resque:
  :web:
    :username: resque     # default none
    :password: sekrit     # default none
    :port: 5678           # default 8282

The web interface settings will be used to create the VirtualHost and config.ru for the Sinatra application included with Resque. You can access the web interface from your domain and the port, example.com:5678

Monitor Resque with God

Generate the configuration file and install the Moonshine_God plugin:

# Rails 2
script/generate moonshine_resque_god
script/plugin install git://github.com/railsmachine/moonshine_god.git
# Rails 3
script/rails g moonshine_resque --with-god

Modify the configuration file (config/god/resque.god) as needed.

You'll also want to add the `:resque` role to all servers using it. For example:

# config/deploy/production.rb
server 'worker1.myapp.com', :app, :resque

If you're using Resque with God this way, you also have access to some Capistrano tasks:

cap god:resque:restart # restart resque
cap god:resque:start   # start resque
cap god:resque:stop    # stop resque
cap god:resque:status  # show status of resque

We also strongly recommend having Moonshine automatically restart Resque on deploys:

# config/deploy.rb
before 'god:restart', 'god:resque:stop'

This is a great way to handle automatically reloading new app code into your workers on deploy, as well as increasing or decreasing the number of Resque workers.

Something went wrong with that request. Please try again.