Upstart Boilerplate for Background Workers
I use foreman to run background work process when developing.
After writing the
Procfile, we can export it to many process management through
foreman export command.
The generated files never worked well for me (when exporting to Upstart). Very likely because rbenv or RVM is not loaded.
Here is the boilerplate I've used:
ironmanby the name of your application
deployby your server's user
/var/log/ironman/by your log path
/path/to/ironmanby the path of your application
export RAILS_ENV=staging;) by your application environment
bundle exec sidekiqby the command you wanna run (
bundle exec rake resque:work QUEUE=communication,normalfor instance)
Place these files in
/etc/init, then you can use
sudo service ironman to
You will want to restart the workers after deploying new code (to reload application). But if your user isn't root, you have no permission to run
sudo service ironman restart.
To solve it, I grant permission to my application user. Run
sudo visudo and add the following:
deploy(server's user) and
That is it, thanks.