Sub-domain-er

And now, a little bit of meta, behind-the-scenes tech talk.

A week and a half ago my site had a little downtime. The cause was a result of the dynamic IP address that was assigned to Eggers1, my web server, was a little too dynamic: it changed, without warning, putting my site on a little cul-de-sac on the internet.

I was able to move my content over to another server I had, on a slower connection, temporarily. And since then, I’ve moved everything back to Eggers, but I’ve left my site content on my secondary server, Lethem2, as a backup.

I’ve been slowly working on the backend stuff necessary to have my backup server automatically mirror the main one, and to act in the future as a failover in case something goes wrong again in the future. And, knowing technology, something will fail in the future.

Not all of it is in place yet, but I’m kind of proud of the fact that I know have sub-domains to my main address on the internet. eggers.bamoon.com points to my main server, and lethem.bamoon.com points to my secondary. I’ve got each server emailing me their current IP address at 1 AM in the morning, every morning, and it checks against the previous day’s address and sends a separate alert if it changes.

Next step is to implement a script, using Mac OS X’s launchd(8) to copy the primary over to the secondary if the primary has updated. In order to make that work best, I need to upgrade both servers to Mac OS X 10.5 – they’ve been running 10.4.11 since their inception.

I would not call myself a Unix or command-line guru or wizard – at best, I’m a padawan, still learning and not yet a master. But I’ve been learning all sorts of new stuff:

  • I’ve learned a lot about using crontab(1) to run scripts on a regular basis. Unfortunately, crontab(1) is deprecated on Mac OS X – the functions of it are in Apple’s replacement, the previously-mentioned launchd(8), and launchd(8) adds more, to boot.
  • Because the default editor for crontab(1) is the viciously-user-unfriendly text editor vi(1), ugh, I’ve been learning how to do basic editing in that.
  • In the process of setting up my sub-domains, and having my main domain point to two different IP addresses and two different servers, I’ve learned a lot more about how DNS, the internet’s address book system, works; like how I can have multiple A records in a single DNS entry, to utilize DNS’s ability to load-balance traffic.
  • And, of course, I’ve learned more about how to write shell scripts, since those are what do all the heavy lifting of mirroring each server, checking IP addresses and notifying me about any changes.
  • This may seem like a simple thing, but since Unix-y (and Mac OS X is Unix-y – well, technically, BSD-y – at its core) operating systems are configured by simple text files, being able to manipulate and make changes to lots of different text files quickly and efficiently is a key skill. To that end, rather than wrestle with vi(1) all the time (or, more correctly, in addition to wrestling with vi(1)), I’ve learned how to use the command-line tool sed(1) to do fast search-and-replace on multiple text files with one fell swoop.

…and in these hard economic times, learning new skills is always a good thing. Anyone need any web server work done? Anyone? I work cheap while I’m still learning…


1 Everyone has a naming convention for their hardware. Mine is to name my computers and computing devices after favorite authors; in this case, my main web server is named after Dave Eggers, author of “A Heartbreaking Tale of Staggering Genius” and others.
2 This server is named after Jonathan Lethem, an incredibly dark and brilliant author.