Resque with Redis To Go
blog.redistogo.com
blog.redistogo.com
2 questions:
1. Do jobs (in app/jobs/whatever.rb) have full access to your Rails models (so you can pass it an ID and it can do whatever)?
2. How does the rake task/worker best work in a production environment (other than Heroku)? Use monit to keep the worker(s) up?
Thanks
2. Just use the "rake resque:work" task and I recommend using something like upstart that works awesome, but I have also done it with monit and both work great
"rake environment resque:work" will give you access to the whole rails environment, so you can write normal rails code. But it of course uses a bunch of memory.
If you're doing something quick and dirty and don't need the rails model (sending out a password email or whatever), you can just run "rake resque:work" and avoid the overhead of the whole rails environment.
I'm not seeing an obvious benefit for people self-hosting though.
Also, for the extremely anal, uri-redis is aware of the database number:
require 'uri-redis'
conf = URI.parse 'redis://localhost:6379/1'
conf.host # => localhost
conf.port # => 6379
conf.db # => 1require 'resque'
MyApp::Application.routes.draw do
mount Resque::Server.new, :at => "/resque"
endRequires Rails 3.
Resque.redis = Redis.connect(ENV["REDISTOGO_URL"])