Custom runit exporter with support for rbenv and runit dependent services. This is customized for our uses so some unexpected things happen - like the fact that we don't use specific ports or several numbered services of the same type, so you WILL NOT get anything like:
/path/to/services/<appname>-web-1
/path/to/services/<appname>-web-2
/path/to/services/<appname>-web-3
This will ONLY create ONE such service, that's the way we run. We generally use stuff that forks as many processes it needs on it's own. We just want runit to supervise the whole thing.
Add this line to your application's Gemfile:
gem 'foreman'
gem 'foreman-export-great'
And then execute:
$ bundle
Define the usual stuff in Procfile (and remember the names), if you need one service to depend on another... let's say you've got some workers that should start and stop together with the main web app, so you've got your Procfile looking like this:
web: bundle exec unicorn -c unicorn.conf
workers: ./script/workers
Now you want those workers to start/restart/stop when your main app does eg. when you do sv start -web you want to automatically also run sv start -workers. To get this to work, open up .env in your project directory and add:
WEB_DEPENDENT_SERVICE: <appname>-workers
Done!
To export to runit, just do something like this:
bundle exec foreman export great-runit /path/to/services -l /path/to/logdir -a appname -u user
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request