No commit activity in last 3 years
No release in over 3 years
Easily create and run supervisord configuration files
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

>= 0
 Project Readme

Warehouse Supervisor

Easily create supervisor configuration files and run them in dev mode.

Installation

Add this line to your application's Gemfile:

gem 'warehouse_supervisor'

And then execute:

$ bundle

Or install it yourself as:

$ gem install warehouse_supervisor

Usage

Warehouse Supervisor may be used either from its own CLI interface or from rake, both provide the same commands:

print

warehouse_supervisor print -g production -c config.yml processes.conf.erb

or

rake warehouse_supervisor:print WS_GROUP=production CONFIG=config.yml TEMPLATES=processes.conf.erb

This will print the programs in config.yml, using the templates in processes.conf.erb.

Note that only [program:x] sections are printed. The result of this command is intended to be redirected to a file to be included in your main supervisord.conf file

start

warehouse_supervisor start -g production -c config.yml processes.conf.erb

or

rake warehouse_supervisor:start WS_GROUP=production CONFIG=config.yml TEMPLATES=processes.conf.erb

This will start a supervisor instance running in the foreground with the config you specified

Both these commands take the following options:

  • --group | -g, WS_GROUP= Group to use.
  • --config | -c, CONFIG= Definition file.
  • , TEMPLATES= Templates file.

Files

Warehouse Supervisor needs 2 files to work:

  • Templates file
  • Definitions file

Templates file

This is an erb file where you'll define the different program templates that your app uses, for example:

<% template :resque_web do %>
  user = <%= user || ENV["USER"] %>
  directory = <%=dir || ENV["RAILS_ROOT"]%>
  command = bundle exec resque-web -F -L -p 5678 config/resque_config.rb 
  environment = HOME='<%=home || ENV["HOME"]%>',USER=<%=user || ENV["USER"]%>
<% end %>

Each program template that you need will be define in a template block.

Definitions file

This is a yml file where you can define the programs that supervisor will run. For example:

development:
  resque_web:
    template: resque_web
    dir: "/my/dir"

It defines groups of programs and for each one defines the template to be used and the variables that each program requires.

For each program Warehouse Supervisor will compile its template with the provided variables, and it'll add this to the output. This way you may use generic templates to define similar programs.

For a full example of both files check the examples dir.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request