A Rails-based frontend to the Resque job queue system. This provides a similar interface to the existing Sinatra application that comes bundled with Resque, but deploys like a Rails application and leverages Rails conventions for factoring things like controllers, helpers, and views.
More documentation coming soon!
Resque web is built as a rails engine.
Add it to your gemfile.
gem 'resque-web', require: 'resque_web'
Mount it in your config/routes.rb.
require "resque_web"
MyApp::Application.routes.draw do
mount ResqueWeb::Engine => "/resque_web"
end
If you need a non-default resque server, use this environment variable.
RAILS_RESQUE_REDIS=123.x.0.456:6712
You almost certainly want to limit access when using resque-web in production. Using routes constraints is one way to achieve this:
# config/routes.rb
resque_web_constraint = lambda { |request| request.remote_ip == '127.0.0.1' }
constraints resque_web_constraint do
mount ResqueWeb::Engine => "/resque_web"
end
Another example of a route constraint using the current user when using Devise or another warden based authentication system:
# config/routes.rb
resque_web_constraint = lambda do |request|
current_user = request.env['warden'].user
current_user.present? && current_user.respond_to?(:is_admin?) && current_user.is_admin?
end
constraints resque_web_constraint do
mount ResqueWeb::Engine => "/resque_web"
end
HTTP Basic Authentication is supported out of the box. Simply set the environment variables RESQUE_WEB_HTTP_BASIC_AUTH_USER
and RESQUE_WEB_HTTP_BASIC_AUTH_PASSWORD
to turn it on. If you're using Resque with Heroku run heroku config:set RESQUE_WEB_HTTP_BASIC_AUTH_USER=user RESQUE_WEB_HTTP_BASIC_AUTH_PASSWORD=secret
to get ResqueWeb secured.