A Chef Cookbook for deploying Thin + Nginx
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
attributes
recipes
templates/default
CHANGELOG.md
README.md
metadata.rb

README.md

thin_nginx Cookbook

A super simple Thin and Nginx web and application service.
Why? I found opscode's nginx cookbook with passenger had some quirks. Thin is lightweight and faster than Passenger for simple web apps. I've always had great success running thin with nginx, so I figure someone else would want this too. This solution is super simple and doesn't require a lot of confusing parameters.

Requirements

cookbooks

  • rvm - Sorry. but rvm is required because rvm_shell is needed to install Thin from gem

gems

  • thin -v 1.6.1 - thin's version 1.6.1 is installed into your current rvm gemset. Solution didn't work correctly when installed to chef's embedded ruby. I haven't had the time to experiment installing thin directly from source. That would remove the constraint of RVM, but time wasn't on my side.

packages

  • nginx - nginx is installed from apt package. This does not use the nginx cookbook from opscode.

supported OS

Only tested on Ubuntu 12.04.3

Attributes

thin_nginx::default

Key Type Description Default
['thin_nginx']['app_name'] String you must set your application name here. this is typically the folder name used when cloning a git repository such as /var/www/`jumpsquares`. "jumpsquares"
['thin_nginx']['www_dir'] String this is your directory used for serving up www. usually at /var/www "/var/www/"
['thin_nginx']['user'] String user that can access www files. usually www-data on Ubuntu/Debian "www-data"
['thin_nginx']['thin_version'] String version of thin to run. Currently tested against 1.6.1 "1.6.1"
['thin_nginx']['number_of_thins'] Integer number of thin servers that should run. each server comes up with a new sequential port 3
['thin_nginx']['worker_processes'] Integer nginx worker processes 5
['thin_nginx']['rails_env'] String Rails environment used for the thin server "production"
['thin_nginx']['ruby_version'] String Ruby version install for rvm_shell "ruby-2.1.2"
['thin_nginx']['ruby_path'] String Ruby path for rvm "/usr/local/rvm"
['thin_nginx']['ruby_source'] String Ruby source path for initiating console "/usr/local/rvm/scripts/rvm"
['thin_nginx']['gemset'] String What gemset should we use? By default none is used so lets keep it that way. "default"

Usage

thin_nginx::default

I haven't been able to successfully override an attribute with this cookbook from a different cookbook. Change the key attributes above to have this cookbook work successfully.

Before running this cookbook include the following:
1. rvm::system - recipe will install ruby across the entire node. Everything works successfully with ruby-2.1.2.
2. your application - run git clone on a git repository to the /var/www/ directory

Include thin_nginx in your node's run_list:

{
  "name":"my_node",
  "run_list": [
    "recipe[thin_nginx]"
  ]
}

Contributing

I am not a software developer by nature. Just a hack. Please contribute to make this better.
1. Fork the repository on Github
2. Create a named feature branch (like add_component_x)
3. Write your change
4. Write tests for your change (if applicable)
5. Run the tests, ensuring they all pass
6. Submit a Pull Request using Github

License and Authors

Authors: Kendrick Coleman | @KendrickColeman

Licensed under Apache 2.0