Skip to content
This repository

Install chef-server from scratch using rvm and ruby 1.9.3

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 conf
Octocat-spinner-32 files
Octocat-spinner-32 NOTES
Octocat-spinner-32 README.md
Octocat-spinner-32 bootstrapper
Octocat-spinner-32 install-chef-server
README.md

Install chef-server from scratch

Installing your own Chef server can be a bit hoop-jumpy. This abstracts all of those hoops into one (ugly) script which does all the jumping for you.

What does it do?

Chef server depends on a truckload of not-necessarily-easy-to-install things. We mostly follow this with a detour into RVM and Ruby 1.9.3.

The script:

  • Installs CouchDB
  • Installs and configures RabbitMQ (a more recent version than is in the Ubuntu repos)
  • Installs Sun Java 1.6 (using this witchcraft) - THIS IS NOW BROKEN, SEE BELOW
  • Installs OpsCode's Gecode
  • Installs RVM
  • Installs Ruby 1.9.3 (which isn't yet in the Ubuntu repos)
  • Installs the Chef gems
  • Configures the Chef server
  • Creates upstart scripts for each of the Chef components
  • Installs nginx to proxy the WebUI

Regarding Java, the delightful people at Oracle, always the friends of free software, have moved the goalposts and the oab-java6 thing no longer works (UPDATE: I've had it working intermittently on a Vagrant box, and I've had it working recently on an EC2 node). I know people have come up with workarounds for this, but no doubt these will get stepped on soon, too. Life is too short to spend it trying to outwit lawyer-driven corporations, so it now tests if Java is already installed, and if not, installs OpenJDK (which seems to work OK for me).

These steps are mostly idempotent. Foo bar

How to use it

Dead-simple install:

sudo apt-get install -y curl ; bash <(curl -s https://raw.github.com/pikesley/catering-college/master/bootstrapper) 

What the above is actually doing: we create a new user (I've used 'chef') and add them to the 'admin' group (the shortest path to sudo happiness, at least on Ubuntu). Then, as this new user, checkout and run the script.

NEWUSER=chef
sudo useradd -m ${NEWUSER} -s /bin/bash
cat /etc/group | sed "s/^\(admin:.*\)/\1,${NEWUSER}/" > /tmp/group && sudo mv /tmp/group /etc/
sudo apt-get update
sudo apt-get install -y git-core

sudo su - ${NEWUSER} 

git clone https://github.com/pikesley/catering-college
cd catering-college
./install-chef-server

There's a trick here: visudo, then change this line:

%admin ALL=(ALL) ALL

to

%admin ALL=(ALL) NOPASSWD: ALL

to allow members of the 'admin' group to sudo without a password. You may not want to do this, of course.

Caveats

  • I've tested this to death on an Ubuntu Lucid VM. I suspect it'll probably work on other Debian-ish platforms. It's also known to work on Precise.
  • The configuration step for chef-solr assumes there's no data in there that we care about (which is obviously true for a new installation), and nukes the whole thing. There may be ways around this, but I don't know how Solr works and I really have no desire to.
Something went wrong with that request. Please try again.