Finally, Resque & Supervisor have learned to get along!

Truly, they have so much to teach us all

holy confetti!

Like I said in my short “Daemon-ize your processes on the cheap” series, Resque was the tool that had given me the most grief when using Supervisor. No more!

How did I work such sorcery, you ask? Follow my 3-step formula for guaranteed success:

  1. Use the Resque 2.0.0 prerelease or newer.
  2. Use Supervisor 3.0.0 or newer.
  3. In the Supervisor config for your Resque workers, make sure you set:
    • an environment variable for HOME
    • an environment variable for PATH
    • a directory for Supervisor to cd to and run your worker from

To illustrate my point, here’s a cut-down example of my WORKING RESQUE CONFIG FOR SUPERVISOR! YAY! HOORAY! HUZZAH!

; Save this into your /etc/supervisor.d directory, build an awesome-app
; and wire this up to your totally_awesome worker. Watch MAGIC happen.
command=/usr/bin/bundle exec resque work -q default -r ./app/workers/totally_awesome.rb
view raw

But seriously, all confetti aside, so, so many thanks to the Resque team. Their work picking up the code base and running with it has really, really paid off. A big round of applause to everyone who contributed to improving Resque.

Arkham Party!

, , ,

2 Responses to Finally, Resque & Supervisor have learned to get along!

  1. Nicolas February 11, 2014 at 10:14 am #

    Would you mind explaining what made Resque 2.0 compatible with supervisord ? A specific commit perhaps ? Or do you say that Resque 2.0 is compatible, while older versions are not, and you don’t know why ?

  2. Ryan February 12, 2014 at 4:10 am #

    I don’t know which commit specifically moved away from using rake to control resque and towards calling a resque executable script. But between that and changes me in how workers daemonize (or don’t), that’s the magic secret sauce that let supervisord start managing resque. If time permits, maybe I’ll start digging through the commit logs for resque or picking apart trying to get their new, improved 1-x-stable branch working with supervisord.