Check out our Bootcamp Schedule View Schedule

Ruby 1.9.2 Fresh from the Oven or Bootstrap Chef with ruby 1.9.2 and ubuntu 10.10

Jonathan Wallace

Highgroovers. Flexible, self-starting, curious, good, nerdy, professional. These are a few of the words we used to describe ourselves in our annual 2010 Recap meeting (attendance optional – we’re ROWE baby!). We are always re-examining our best practices (a best practice – how meta!) to insure that we’re delivering maximum value to our customers.

“Delivering maximum value.” That sounds lame!

I feel lame typing it. I sound like I’m some silly marketer when I’m just a programmer with a passion for kicking ass, exceeding expectations, and writing tight code.

Fortunately, I can say “delivering maximum value” with a straight face. You see, “delivering maximum value” is a delicious by-product of our continual efforts to be the best. Internally, we push ourselves to get better every day. And not because being the best software developer “delivers maximum value” but because we take pride in our craft.

All of that to say, when ruby 1.9.2-p136 was released a little over a month ago we had to see what it took to get it working with chef, one of our favorite tools. (Ruby 1.8.7 is so twenty-ten.)

Chef, a ruby-based configuration management engine, at the time of writing, has yet to officially support ubuntu 10.10 (itself just a few months out of the oven) or ruby 1.9.2 but, dear reader, we’re going to do that right here and now.

Here’s our recipe for success:

  1. Prereqs – only a few
  2. You have a opscode chef account.
  3. Chef is set up and working.
  4. You have an aws account
  5. Chef has access to your aws security credentials in your knife file.

  6. Set up your default AMI w/ruby 1.9.2

  7. Get the latest ubuntu AMI
  8. Boot an extra large ebs instance (live a little! compiling is much faster, about 4 minutes for ruby 1.9.2, on an extra large instance)
  9. Install ruby 1.9.2-p136 from source (as root)

Install latest ruby build from source requirements

$ apt-get update
$ apt-get install -y build-essential zlib1g-dev libssl-dev openssl libcurl4-openssl-dev libreadline6-dev

Install ruby from source

$ wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p136.tar.gz
$ tar -xvf ruby-1.9.2-p136.tar.gz
$ cd ruby-1.9.2-p136
$ ./configure –prefix=/usr
$ make
$ make install

  1. Create your own AMI
  2. Create your own bootstrap file.

The ubuntu bootstrap files that come with chef 0.9.12 both use debian’s apt package manager.

I modified the ubuntu10.04-gems.erb a little bit. Since ruby 1.9.2 comes with rubygems by default we only need to install the chef and ohai gem. Here’s my bootstrap file. You can use it; I don’t mind. You can put the bootstrap file anywhere but I recommend your-chef-repo/.chef/bootstrap/use_existing_ruby.rb. 3. Start up your server

If you need to specify the specific aws zone check out the knife page, specifically the EC2 SUB-COMMANDS section.

$ knife ec2 server create -I ~/.ssh/your_key_pair -x ubuntu -i ami-cef405a7 -f m1.xlarge –template-file ./.chef/bootstrap/use_existing_ruby.rb

SUCCESS!!!

But wait!!

In our quest to be the best, I’ve gotta know one thing, dear reader.

What would you do to make this better? 🙂

Similar Posts:

Not Happy with Your Current App, or Digital Product?

Submit your event

Let's Discuss Your Project

Let's Discuss Your Project