Writings

Technology, open source, personal essays, and everything that isn't climate.

Building a new home media server

This weekend I finally built my new home file server (been meaning to do this for most of 2006). The impetus was that last weekend I noticed Seagate 320 GB SATA2 drives priced at $95 / per on NewEgg, and just couldn't resist.

The final contents of the system involved:

  • MSI K9N Platinum MB (6 onboard SATA, 2 onboard gig-e nics)
  • Athon64 x2 4400 CPU
  • 2 GB Ram
  • 6 x 320 GB (16 MB cache) Seagate Drives
  • A nice Lian Li case which takes 12 internal 3.5 drives
  • 600 W PSU

I scrounged a diamond stealth pci video card from 1999, a CD drive, and a small 20 GB IDE drive for the base OS (raid root was something I didn't want to tackle).

I started by trying to install Mandriva 2007 b1 CDs.... Fail. Machine consistently turns off during "determining package selection..." screen. As in hard power off. I then tried Mandriva 2006 i586 CDs (no reason to be 64bit yet) Fail. There appears to be an issue with the onboard sata drives on this version of Mandriva. After much fiddling I end up turning off the sata controller in the BIOS to install. Partial Success. Things install this time around with Mandriva, though the onboard nics aren't found. So I throw in a 100 Mb card I've got laying around. Fail. Machine doesn't boot under installed kernel. It can't find /dev/hda. Under the CD boot kernel, and the rescue kernel this is fine. I first blame this on LVM root, so reinstall without it, but no help there. Time to leave the problem alone and head of to NYC for shopping for the wedding.


Sunday morning... more coffee... more time to think...

I try an Ubuntu 6.06 CD, just to see if I'm hitting a Mandriva weirdness. Fail. Machine turns off as soon as it starts looking for packages. Well, at least this is on a few distros. Ok, Rescue CD it is. With Rescue CD in hand, I decide to pull down 2.6.17.6 source, and rebuild my kernel. It looks like at least a few nforce5 fixes went into 2.6.17, so that should make things better. Success! As soon as I purge some of the hacks out of my kernel appends (which were screwing up ACPI discover of the sata drives), I can now boot with sata and onboard ethernet enabled, and working. Raid 5 setup took nearly no time, and given the write speed, I was able to push all 228 GB of data in the house that needed to be on that array there overnight. This whole process took a little longer than I expected, but in the end was well worth it. In all it's glory, here is the really cool df output, that uses T. :)

gallifrey:~> df Filesystem Size Used Avail Use% Mounted on /dev/hda5 3.9G 1.9G 1.8G 52% / /dev/mapper/vg-home 1.6G 39M 1.6G 3% /home /dev/md0 1.5T 228G 1.3T 16% /data

Related: How puppet rescued my botched server install · Switching to Ubuntu · Mono 1.9 install script

How to blow 2 hours on apache, ruby, and rails

'Note to self'

Make sure to remove all pp stanzas for debugging rails apps under webrick. While they work fine there, that is printing to stdout for apache, and hence break everything when one of them is tripped.

Lesson learned, moving on.

Related: Perfect Rails Development / Deployment environment with mercurial and passenger · 700 Ruby Hobos · Why I love Ruby on Rails... impement a new feature in about an hour

700 Ruby Hobos

It's been a while, so there will probably be a couple of posts coming in rapid fire, especially as Tuesday is going to land me with a nice 7 hour car ride to Canada (at least I'm not doing it alone this year).

A couple weeks ago, I knew I had to revive my old labtrack application at our lab, as everyone was getting confused about who had which machine, and for how long. When we had this problem about 4 years ago, I took a week, and built a perl application that would nicely manage it all for us. That fell into disarray a couple years ago.

Staring at the old code, I realized that if I was going to do this again, I needed to do at least the following:

  • Make it so new machines and network adapters could be added from the web interface- Actually automate the generation of dns and dhcp backing files from the database- Use sqlite instead of postgresql (just to take out one more moving part).- Do it in some sort of web framework, so I'd at least learn something in the process

After looking around a little bit, I decided that Ruby on Rails was worth trying, so I'd at least have an opinion on whether or not this "web 2.0" thing is total hype, or if there is some usefulness in it. For those that have been living in a cave for the last year, Ruby on Rails is "the new hotness" when it comes to web development. It is a very cleanly separated Model-View-Controller framework for the Ruby language, which has generators for many of the most common things you would do. Verdict: Ruby on Rails does deserve some of its hype Longer Verdict It took me 2 weeks to build my Ruby on Rails app over the course of nights and weekends (not 2 hours), in that time I did read 250 pages of the Ruby on Rails book as well. For me, the hardest part of the framework was understanding all the implicit relationships between the MVC layers. It wasn't until the in depth section of RoR that it sunk in. I guess a lot of that comes from my own bad habbits, where naming wasn't always consistant between layers of an application. In Ruby, if you keep them very consistant, you get a lot for free.

Things I really like about Ruby in General, and Rails in specific:

  • Syntax is nearly Perl (regex operator is just like you expect)- Good parts of Python were pulled in (no semicolons, everything is an object even more so)- Bad parts of Python were not pulled in (no block ending sequence, no explicity new() method)- The interesting block callback that you use for things like sorting is very ruby, and I think very cool- Rails has lots of really sensible defaults, and high function macros like date_select input type- Setting validation criteria on your Models covers about 50% of error checking that you'd need in an application. And because it is so brain dead easy, you're likely to put it in version 0.1 of your code.- The RoR book enforces good habbits. They go out of their way to talk about SQL Injection (and how to prevent it), unit testing, and development vs. test vs. production environments.

Things the annoy me about Ruby, and Rails:

  • Documentation is scattered. If you don't buy the 2 books (Programming Ruby, and Ruby on Rails), you'll end up lost pretty quickly. Better free online documentation would be good. (As a perl guy, I have a high standard here, as perl comes with > 100 man pages that cover almost anything you'd ever want to know about the language.)- No equiv of 'use strict' like in Perl. Fully dynamic languages are all fine and good, but I feel like they miss the mark in not having some base level checks like "did you actually declare that variable?"

Overall, Ruby is definitely growing on me. And RoR is a much better (safer, better habbits) approach than random PHP that I've seen as largely the alternative in this space. We'll see how this first deployment goes today, then I'll decide if RoR has a place in my toolkit.

Related: How to blow 2 hours on apache, ruby, and rails · Things I learned this week · Ruby gymnastics

The Hudson River

Today was our first kayak outing of the year, timed very nicely with the first greater-than-90-degree day of the year. We hit the water at about 2, and got off at 6, stopping twice along the way (including once to visit with my friend Nick who was working on his sailboat). 6 miles in all, about 2 of which was pushing against the current.

The Hudson River is the defining geographic element around these parts. They don't call it the Mid-Hudson Valley for nothing. ;) Given that it is pretty amazing how few people really use the river for much. As we were kayaking along there were a bunch of things I realized that people who don't spend time on the river don't realize, so I decided I'd write them down for river neophytes out there:

  1. The River is Tidal, with Tidal delta about 3.5 in Poughkeepsie. Tidal affects occur all the way to Albany, where the river is dammed.

  2. From this, it follows that the River has saline content. Once you get a far North as Poughkeepsie, it is pretty dilute, though the area is still considered estuary, as it isn't pure fresh water.

  3. The 3.5 foot tides also mean the river changes direction 4 times a day. The river runs almost as fast upstream as downstream (over 2 mph), as anyone who's spent much time on a boat on it will tell you. The first time you realize the river is going backwards, it is definitely a shock, but as you understand it a bit more it makes sense.

  4. Whenever the river direction changes there is a very violent wave period for 30 - 60 minutes. I'm assuming the reason has to to with part of the water still making it downstream, while another part forces up. I've experienced it enough times that it is something very real, and becomes and interesting period of time to be in a kayak. ;) I've tended to call this "the river fighting itself", but I'm sure there is a better term for it.

  5. There are a bloody lot of giant Carp in the Hudson. I'm not sure where they come from, if they winter over, or what. But they are there, and this time of the year they are breading, so are seen quite a bit.

  6. The river flushes every year. From March -> June there is a ton of debris in the river (it seems to mostly flush out come late June). The debris is mostly water logged wood, which doesn't do any harm to a kayak, but can do some nice damage to motor boat engines.

  7. There are Bald Eagles on the River. I've seen two now (one on July 4th last year), and they are pretty spectacular.

I'm sure there are other fun facts that I should add, but all of those seem to be bits that even people around here don't know. If I think of anything else good, I'll post it in future. If you've got anything else good, please stick it in comments.

Related: Hudson River Greenway Water Trail Resources · Kayak Adventure on Wappingers Creek · My Climate Summer

Spam scoring

Every once in a while I love to look through my spam folder just to see what makes spamassassin mark something really high. Here is one that got 49 points:

*  4.5 MIME_BOUND_DD_DIGITS Spam tool pattern in MIME boundary
*  4.4 MSGID_SPAM_CAPS Spam tool Message-Id: (caps variant)
*  0.1 FORGED_RCVD_HELO Received: contains a forged HELO
*  1.5 RCVD_NUMERIC_HELO Received: contains an IP address used for HELO
*  0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay
*      lines
*  2.0 HTML_MESSAGE BODY: HTML included in message
*  5.0 BAYES_99 BODY: Bayesian spam probability is 99 to 100%
*      [score: 1.0000]
*  4.5 MIME_HTML_ONLY BODY: Message only has text/html MIME parts
*  3.7 PYZOR_CHECK Listed in Pyzor (http://pyzor.sf.net/)
*  0.2 DNS_FROM_RFC_ABUSE RBL: Envelope sender in abuse.rfc-ignorant.org
*  2.0 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net
*      [Blocked - see ]
*  3.9 RCVD_IN_XBL RBL: Received via a relay in Spamhaus XBL
*      [65.67.110.5 listed in sbl-xbl.spamhaus.org]
*  2.5 FORGED_OUTLOOK_TAGS Outlook can't send HTML in this format
*  2.7 FORGED_OUTLOOK_HTML Outlook can't send HTML message only
*  4.5 MIME_HTML_ONLY_MULTI Multipart message only has text/html MIME
*      parts
*  2.6 FORGED_MSGID_HOTMAIL Message-ID is forged, (hotmail.com)
*  1.6 MISSING_MIMEOLE Message has X-MSMail-Priority, but no X-MimeOLE
*  4.1 FORGED_MUA_OUTLOOK Forged mail pretending to be from MS Outlook

A few of these I've cranked up, like MIME_HTML_ONLY, as I don't get any useful mail that is only text/html formatted. I still like that SA detects things like MIME_BOUND_DD_DIGITS. :)

Related: Blocking AIM spam in pidgin · Best downtime message I've seen recently · Linux Job Spam

End of uptime

Well, it finally happened, the wireless driver got wedged on my laptop meaning I was done with wireless and suspend until a reboot. Final uptime was:

07:22:01 up 52 days, 18:27,  1 user,  load average: 4.67, 13.07, 11.02

before I had to reboot. It did mean I could take all the kernel updates I need to, as well as update wireless drivers.

Related: New record laptop uptime - 70 days · 30 days uptime on my Linux Laptop · 47 days

Mercurial fun bits

I'm catching up on the mailing list for mercurial from the past couple of months. A couple really neat things in there:

* Mercurial Quick Reference Cards. These are really awesome. I've got to print out copies for all my interns on Monday, as they are just wonderfully done.

* Distributed Bug Tracking in Hg. This is based on the Bugs Everywhere concept. This looks really handy as a way of keeping todos in a source tree itself. Ah, I love hg. :)

Related: Perfect Rails Development / Deployment environment with mercurial and passenger · Yet more fun with RSS, rssbot · from trac to moin

Build To Order Servers... buy from these people

We got a donation to MHVLUG a year ago, which was a stack of 2U PIII servers that were being decommissioned from a company that one of our members worked at. We sold about 1/2 of them (at really nominal price) to get machines into eager members hands, and raise a little cash for MHVLUG events (like equipment for install fests). The servers had one flaw though, the power supplies liked to commit suicide if you unplugged them. You know this has happened if you plug the box in, and just hear a clicking sound from the power supply, and the machine won't power on. :( The power supplies are an odd proprietary connector (though it breaks out to standard connectors after that) so direct replacement didn't seem like an option. We swapped out PSU for those LUG members that got ones that broke, until we ran out. At which point everyone was on their own.

This hits home a bit, because I've got 2 of these boxes. 1 is serenity 🔗💀, which runs my wiki 🔗💀, but more importantly, my wedding site 🔗💀. That machine is fine. However, my xen test box did the suicide dive this weekend. Ominously, we are out of power supplies, and the site that we've got the wedding info on no longer has anything I could steal a supply from. This is not a good place to be in.

So over the weekend I began searching for power supplies again. While we'll never find the crazy card interface that the current PSUs have, a little further research showed that any long 2U supply should fit in the case. After much time with google I came across Build to Order Servers. It appears that they had a 2U supply that would fit in the box, output 300W (the current one is 275W), and only cost $68. So between me, and the rest of nycccp.net, we ordered 4 of those units. That was Sunday.

Monday rolls around, and I get an email from the Vendor (and, as I found out later, a phone call at home). They are out of the supply I ordered, and won't get more until July 17th. He does ask me where I'm going to be running the systems, because if it is in the US (where the power is reasonably conditioned), they've got an equivalent model which is $10 cheaper. He also asks about what my server board pins are, because the power supply is 20 + 4 pins, and most people order a 20 -> 24 pin converter with them. I respond back to him with output of dmidecode from my server board, plus the fact that it looks like I've actually got 24 + 6 pins. A couple hours later he sends me an image of a similar mother board ("is this what yours looks like?"), offering to custom mod the power supply pin outs for 24 + 6 for a small fee, and still being able to ship by Thursday if I'm ok with all of this.

That, ladies and gentlemen, is service. We're talking about a total sum of about $250 worth of equipment here, and the folks at Build to Order Servers spent a lot of time making sure that I actually got equipment that is exactly what I needed. It's rare that you see that now adays with all the crazy big box stores, so I am always astounded when someone really does give that much care for their customers.

Anyway, if you are in the market for anything Build to Order Servers has to offer, you should consider them. They went the extra mile for me on a small order, so I can't imagine they'd do any different for you.

Related: Wedding Pics · Weekend Drupaling · If only they had power...