November 2006 Archives

FreeBSD, Mongrel, and Typo

|

I've moved my site over to a FreeBSD virtual machine running under a VMWare server generously provided by my employer. I decided I'd upgrade to the latest version of Typo, the software that powers this site, and use Apache 2.2 + Mongrel to serve it up rather than FastCGI or something. There are FreeBSD ports for all of this software: www/apache22, www/typo, and www/rubygem-mongrel.

After moving my MySQL database over, setting up my config/database.yml, and upgrading my schema with rake db:migrate in the Typo directory installed by the port, I was able to fire up Mongrel and start serving pages. However, I didn't want to have to start up Mongrel by hand with a bunch of command line options. I wanted a configuration file and a startup script that would get run automatically at system boot time. So I made them.

Here is my configuration file for Mongrel. I put this in /usr/local/www/typo-4.0.3/config/mongrel.yml. And this is my startup script, which I put in /usr/local/etc/rc.d/typo. You then just put typo_enable="YES" in your /etc/rc.conf, and you can control Mongrel+Typo with /usr/local/etc/rc.d/typo start|stop|restart. This script and config file can easily be adapted for using other Rails apps with Mongrel, too.

Thumper Hype

|

I've read a lot of sites lately talking about how great the Sun Fire X4500 (AKA "Thumper") is. It's a 4U server that you can shove 48 500GB hard drives into. It also has a pair of dual core 2.6 GHz Opterons and 16GB of RAM in its standard config, so it can do quite a bit of heavy computing too. It's a big, fast server with ridiculous amounts of storage, packed into a relatively small space.

APT/dpkg Nonportability

|

I've been spending quite a bit of time at work lately trying to port APT to FreeBSD, and upgrading/improving the existing dpkg port. We want to use these tools for distributing our in-house software to production servers. I'm also sort of hoping that this will lay the groundwork for distributing open source software packages for FreeBSD as .deb files, installable with apt-get, so there may some day be an alternative to the existing FreeBSD Ports system (I like ports well enough, but using APT would be really nice for a lot of reasons).

Anyway, both APT and dpkg are some of the least portable pieces of software I've ever seen. There is a lot of hard coding of paths for dependencies and where to install stuff, which is really unnecessary since they're already using autotools. They could just set these paths using things like --prefix in configure scripts, or let the shell determine the path to some executable that is being called rather than hard coding /usr/bin/foo. There is also a lot of dependence on GNU-specific features in utilities that FreeBSD has its own implementations of, like md5sum (FreeBSD has md5) and patch. FreeBSD patch specifically wasn't working until I installed GNU patch (and tweaked dpkg so it'd use that instead of the FreeBSD version). I thought this snippet from dpkg-source's code was particularly amusing:

# Make sure patch doesn't get any funny ideas
delete $ENV{'POSIXLY_CORRECT'};

Uh-huh, complying with POSIX sure is a funny idea...

Archives