Skip to Content

Finally, Resque & Supervisor have learned to get along!

Truly, they have so much to teach us all

Posted on One min read

This post should be treated as an historical artifact. It probably contain broken external links and it may no longer reflect my views or opinions.

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 Super­visor. No more!

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

  1. Use the Resque 2.0.0 prere­lease or newer.
  2. Use Super­visor 3.0.0 or newer.
  3. In the Super­visor config for your Resque workers, make sure you set:
    • an envi­ronment variable for HOME
    • an envi­ronment variable for PATH
    • a directory for Super­visor to cd to and run your worker from

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
; Save this into your /etc/supervisor.d directory, build an awesome-app
; and wire this up to your totally_awesome worker. Watch MAGIC happen.
[program:awesome-worker]
command=/usr/bin/bundle exec resque work -q default -r ./app/workers/totally_awesome.rb
autostart=true
autorestart=true
stopsignal=QUIT
stdout_logfile=/var/log/supervisor/awesome-worker_stdout.log
stderr_logfile=/var/log/supervisor/awesome-worker_stderr.log
user=awesome
directory=/srv/applications/awesome-app
environment=PATH='/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin',HOME='/home/awesome'

But seri­ously, 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!