Heroku's background job mechanism is built to work out of the box with Delayed Job. This is great until you need a little more flexibility and want to harness the power of Redis. 

In order to use Redis on Heroku you need to install the plugin "Redis To Go" This will allow you to use a redis server. Put the following in an initializer and be sure to restart your app before trying.

Once that is complete you will need to setup a resque rake task. What this does is aliases jobs:work to resque:work. You also need to setup what queues the background worker will take take charge of. In my case i just set it to watch all queues. Copy and paste the following into /lib/tasks/resque.rake

Now just deploy to heroku and run: 

And this will start your background job. It is worth noting that for every extra dyno you use on heroku you will be charged accordingly.


comments powered by Disqus

Mike Silvis

Mikesilvis