One recipe at this time -- unicorn::default. This recipe:
- installs a
unicorn_rack
service meant to manage several unicorn services (see more below) - configures any hosts in the
/etc/default/unicorn.json
file from databags (see examples) and node configuration. - restarts the service if the above has changed in any way.
This script lives in /etc/init.d/unicorn_rack
, and is installed as service.
The script itself takes two arguments: the directive (stop, start, restart,
reload) and the name of the app. If the name of the app is omitted all apps
will recieve the actions taken for the directive.
The /etc/unicorn.conf
file is generated by the recipe, and looks a bit like this:
/www/chef-dashboard:/www/chef-dashboard/config/unicorn.rb:unicorn:rails
/www/jsonip:/www/jsonip/config/unicorn.rb:unicorn:rails
The key is the path to the application, it will be started from that directory.
Databags and node configuration are used to generate this file. Instead of mimicing the structure for the init script, we've provided something a little more streamlined:
{
"id": "jsonip",
"path": "/www/jsonip",
"bin": "unicorn",
"config_path": "/www/jsonip/config/unicorn.rb",
"hosts": [ "coffee" ]
}
Where hosts
is an array of node names, and the path is the key of the data
structure above. Note that node configuration looks exactly the same and the
key for the node and the databag name searched are both applications
.
NOTE: For those of you using the older cookbook with the unicorn.json
file, this will be removed on the next run after this cookbook is uploaded and
replaced by the /etc/unicorn.conf
file.
The recipes expect a rails
user and group to exist. It creates it for
you.
- Fork the project
- Make your edits
- Be sure to not change anything in metadata.rb without prior permission.
- Send a pull request.
Erik Hollensbe erik+chef@hollensbe.org