Jason Noble's blog



Jason NobleJason Noble
Verifying hosts are active in the load balancer pool
edit Posted by Jason Noble on Wednesday January 11, 2012 at 03:52PM

Most load balancers have a heart beat monitor, that allows the load balancer to decide whether or not to send traffic to a given host.

For example:

http://server1.host.com/check.txt

If the load balancer gets a 200, it will send traffic to server1, if it gets a 404 or a timeout, it will not.

Today we were trying to figure out how to find what servers were up and running in the load balancer pool.

Here's the capistrano task we came up with:

desc "Curls the check.txt file to see if the host is in the load balancer"
  task :check_load_balancer do
    roles[:web].map(&:host).each do |hostname|
      value = %x{/usr/bin/curl -fs 'http://#{hostname}/check.txt'}
    puts "Curling http://#{hostname}/check.txt: #{value}"
  end
end

This gives you output like the following:

$ cap production deploy:check_load_balancer 
  * executing `production'
  * executing `deploy:check_load_balancer'
Curling http://server2.dc1.domain.com/check.txt: 
Curling http://server3.dc1.domain.com/check.txt: OK
Curling http://server4.dc1.domain.com/check.txt: OK
Curling http://server5.dc1.domain.com/check.txt: 
Curling http://server6.dc1.domain.com/check.txt: OK
Curling http://server7.dc1.domain.com/check.txt: OK
Curling http://server8.dc1.domain.com/check.txt: OK
$

Now we can easily see there are issues with server 2 and 5.

Jason NobleJason Noble
Why can't it be Moly or Mogust?
edit Posted by Jason Noble on Sunday November 13, 2011 at 09:52AM

It’s Movember, the month formerly known as November. I decided to join the Movember cause this year by shaving my beard off and growing a mustache. I've had a beard for a good 5+ years, so it's rather cold in the morning waiting for the bus.

You can help make my sacrifice more worth while by donating funds to combat cancers affecting men. Please support my efforts by making a donation at http://mobro.co/jasonnoble/d.

Even $5 helps a ton!

Quite a few Pivots are participating this year. We're part of the Webstache network:

Webstache
Pivotal SF
Pivotal NY
Pivotal Boulder

Jason NobleJason Noble
Figuring out what Rails Guide to edit next
edit Posted by Jason Noble on Sunday November 13, 2011 at 09:41AM

I've been contributing to Rails lately by going through the Rails Guides and making sure they're up to date.

How do I go about finding a guide that hasn't been updated in a while?

Here's what I came up with:

Jason NobleJason Noble
Installing Rails development stack on OS X Lion
edit Posted by Jason Noble on Thursday August 04, 2011 at 09:15PM

I recently started working with OS X Lion at home and started researching the best way to get a Ruby on Rails environment up and running quickly.

After a little searching, I found a really well written article by Frederico Araujo over at http://www.frederico-araujo.com/2011/07/30/installing-rails-on-os-x-lion-with-homebrew-rvm-and-mysql/.

Fred's blog post walks you through step by step getting Homebrew, RVM, Ruby 1.9.2 and MySQL up and running.

It worked perfectly.

Thanks Fred!

Jason NobleJason Noble
Using git bisect to find where something broke
edit Posted by Jason Noble on Monday May 09, 2011 at 03:25PM

We recently had an issue where our CI build broke over the weekend.

We used git bisect to figure out where the problem occurred.

We wrote a cucumber feature (feature/path/to/is_it_fixed.feature) that worked on Friday and fails today.

We start by setting up git bisect:

git bisect GOOD BAD

Where GOOD is the git SHA from last Friday and BAD is this morning's SHA.

Jason NobleJason Noble
Bash Brace Expansion
edit Posted by Jason Noble on Thursday March 24, 2011 at 04:18PM

In our static assets directory, we have the following directories:

   public/images
   public/javascripts
   public/stylesheets

We want to namespace our application (my_app). We could type the following:

   mkdir public/images/my_app
   mkdir public/javascripts/my_app
   mkdir public/stylesheets/my_app

Or to save time, we could type:

   mkdir public/{images,javascripts,stylesheets}/my_app

This will create the three directories with one command.

Jason NobleJason Noble
Visiting Pivotal Labs in Boulder, CO
edit Posted by Jason Noble on Wednesday March 16, 2011 at 03:42PM

I recently had the opportunity to visit Boulder, CO (Wiki, Map). The reason for my visit was to visit the Pivotal Labs office and spend a day pairing with them.

One of the cool/interesting features of the Pivotal office is that the company provides breakfast in the morning. I walked into the office to find two quiches, pears, strawberries, Orange Juice, Milk, Coffee and several choices of breakfast cereal.