Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Chef Recipe to control Unicorn Servers

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 attributes
Octocat-spinner-32 files
Octocat-spinner-32 recipes
Octocat-spinner-32 README.md
Octocat-spinner-32 metadata.rb
README.md

unicorn2: Control processes running the unicorn server software

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.

The unicorn_rack script

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.

databags and the unicorn.conf file

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.

User accounts (aka BUGS)

The recipes expect a rails user and group to exist. It creates it for you.

Contributing

  • Fork the project
  • Make your edits
  • Be sure to not change anything in metadata.rb without prior permission.
  • Send a pull request.

Author

Erik Hollensbe erik+chef@hollensbe.org

Something went wrong with that request. Please try again.