Resque is a background jobs queue that’s highly recommended over Delayed::Job if you are processing a lot of jobs. It uses Redis as the backend which doesn’t suffer from db related bottlenecks under high load.
Resque comes with a built-in admin interface that’s Rack compatible. In Rails 3, you can mount the Resque server admin directly in your routes.rb file.
1
|
|
But you’ll definitely want to add password protection. Ryan Bates in his Resque RailsCast covers the basics of using Devise and HTTP auth. However, you’ll probably want to hook into your existing ACL system. In my case, I’m using CanCan.
CanCan is not available in the routes.rb by default, but it’s pretty easy to manually load the user and check permissions.
1 2 3 4 5 6 |
|
1 2 3 4 5 6 7 8 |
|
1 2 3 4 5 6 7 8 9 10 |
|
You’ll need User.is_admin? method or change the logic in Ability to suit your project.
Now an authenticated user with is_admin? == true will be able to access Resque admin. Other users will get a 404 since no route matches.
Thanks to Arcath’s blog post for initially pointing me in the right direction.