Published on Rendered Text blog. Credit to thbar's original gist - GitHub prevented me of just forking it with 404s.
First, install god gem:
sudo gem install god
Create a master configuration file and prepare it for loading the instructions for Resque:
sudo mkdir /etc/god
sudo vim /etc/god/master.conf
Make god a service that runs on boot:
sudo cp god-service /etc/init.d
sudo chmod +x /etc/init.d/god-service
sudo update-rc.d god-service defaults
At this point you're able to do /etc/init.d/god-service start|stop|status
.
Prepare your app's resque-#{environment}.god (I haven't figured out how to have one file handle multiple environments).
Add the deploy task to your Capistrano file. It assumes that your deploy user has passwordless sudo permissions. To do that, run visudo
and enter
%deployuser ALL = (ALL) NOPASSWD: ALL
At this point cap deploy
should Just Work™.
great thanks