My name is Seth Chisamore.
Former IBMer, former FIMer currently I'm principal architect for MaxMedia an interactive agency in Atlanta, GA. I create rich internet and web applications using open source technology. I love my wife, our triplets and independent music.


Vital Stuff:
=> Resume
=> Github / schisamo
=> Twitter / schisamo
=> FriendFeed / schisamo
=> Del.icio.us / schisamo
=> Flickr / schisamo
=> Facebook / schisamo
=> Linkedin / schisamo
=> Last.fm / schisamo
=> Vimeo / schisamo


Powered by:
=> The Rackspace Cloud
=> Tumblr
=> Coffee

Twitter Updates

posted on twitter. click to follow me »
04 02 10

Nodes 2 Hosts

As MaxMedia’s virtualized infrastructure grows, I’ve found myself tiring of looking up IP addresses every time I need to SSH into a box. Deciding it was time to work smarter, I threw together a quick ruby script that will generate a local hosts file that maps a nodes ip address to it’s fully qualified domain name (fqdn). This task was a piece of cake with Knife (Chef’s command-line utility), the Chef server search index, and a little ruby-foo:

#!/usr/bin/env ruby
require ‘rubygems’
require ‘json’
require ‘chef’
 
hosts = ”# Host File generated from Chef Search on #{Time.now}\n
# perform search via knife and loop through results
JSON.parse(%x(knife list_nodes)).each do |n|
  # parse result as Chef::Node..uses the result json_type
  node = JSON.parse(%x(knife show_node —node=#{n}))
  # extract ipaddress and fqdn
  hosts « #{node.ipaddress}\t\t#{node.fqdn}\n
end
# append our localhost info
hosts « “127.0.0.1\t\tlocalhost
255.255.255.255\t\tbroadcasthost
::1\t\t\tlocalhost
fe80::1%lo0\t\tlocalhost\n
puts hosts

Just paste the output into your Mac’s /etc/hosts file and your ready to roll.

12 11 09

Change the Time Zone in the Cloud

We recently ran into an issue with one of our virtual servers running up in the Rackspace Cloud . Some legacy application code required the time zone on our server to be set to EST but we could not get the UTC offset to stick. We tried all the usual suspects on our Ubuntu 8.04 LTS instance:

  • changed /etc/default/rcS
  • ran /usr/bin/tzselect

….nothing seemed to worked. My sysadmin and I were at a loss, but we finally stumbled across a site with some good advice about setting a time zone in the cloud:

As a virtual server hosted using Xen virtualization technology, such as those offered by RackSpace Cloud Server offer, system time will get reset by Xen to match the physical machine’s clock whenever the virtual server is restarted.

This time-reset behavior can be modified if you can change the Xen configuration. However as a user of the cloud computing service, you most likely do not have such access.

You can however do the following to set your system to the time you want. Changing the time zone of your system will set your system time to the correct time of that time zone, given that your virtualization provider gives your server a correct UTC time.

Here’s how we finally made the offset stick on our configuration:

~$ date
Thu Nov 12 23:46:51 UTC 2009
~$ sudo cp /usr/share/zoneinfo/EST /etc/localtime
~$ sudo ntpdate ntp.ubuntu.com
12 Nov 18:47:15 ntpdate[5012]: adjust time server 91.189.94.4 offset -0.002164 sec
~$ date
Thu Nov 12 18:47:17 EST 2009
 
view raw This Gist brought to you by GitHub.

…bonus points…no reboot required