Creating background jobs

383 views
Skip to first unread message

elfo

unread,
May 17, 2012, 10:35:39 AM5/17/12
to rubbe...@googlegroups.com
Hello,
I'm wondering if anyone can point me in the right direction. I'm trying to setup background job queue. Initially i was thinking of using queue_classic gem with foreman to start the rake task. For some reason the CPU goes to 100% and my app crashes when i do this even though there are no jobs in the queue. I'm using the Capistrano recipe found here http://blog.sosedoff.com/2011/07/24/foreman-capistrano-for-rails-3-applications/ .

The second option i was thinking about is the resque gem. I noticed there's a recipe for rubber already so i tried to do vulcanize resque but then I'm not sure what to do next.

Thanks for the help!

Matthew Conway

unread,
May 18, 2012, 9:50:58 AM5/18/12
to rubbe...@googlegroups.com
Yes, the resque recipe for rubber works well.

For a new project:
rubber vulcanize complete_passenger_postgresql resque

Or if you already setup rubber for your project:
rubber vulcanize resque monit collectd

The monit/collectd are needed because they are crosscutting templates that only apply themselves for the templates already in your project.
Then "cap rubber:create_staging" will setup the resque infrastructure on a new instance.

If you need to add to an existing instance, you'll need to add the resque related roles (resque_worker, resque_web) with "cap rubber:add_role", then "cap rubber:bootstrap", "cap deploy"

elfo

unread,
May 18, 2012, 11:18:43 AM5/18/12
to rubbe...@googlegroups.com

When you say "If you need to add to an existing instance, you'll need to add the resque related roles", to which instance should i be adding these roles (app web)? Or should i just be creating a new instance with just these roles? Also how does it work with the redis database? Is it installed automatically on that instance?
Thanks!

Matthew Conway

unread,
May 18, 2012, 11:26:42 AM5/18/12
to rubbe...@googlegroups.com

On May 18, 2012, at 11:18 AM, elfo wrote:

>
> When you say "If you need to add to an existing instance, you'll need to add the resque related roles", to which instance should i be adding these roles (app web)? Or should i just be creating a new instance with just these roles? Also how does it work with the redis database? Is it installed automatically on that instance?

Its up to how you want things architected. If you only have a single instance, its fine putting them on there, if you have broken up your architecture into multiple instances, then add resque_web to whichever instance has your web_tools role, and and resque_worker to whichever instance you want to perform jobs on (its own dedicated instance(s) is fine too)

Matt

Reply all
Reply to author
Forward
0 new messages