Monday, December 14, 2009

Install Memcached from source on Debian Lenny

Debian is quite simply excellent, and I wouldn't even consider running any other distro in production anymore.

Occasionally though, there are packages that become a bit outdated, and a source install is needed.

For me, Memcached is one of those packages. The latest in the Debian Lenny Apt repositories is 1.2.2, but the latest stable build is actually 1.4.4. Good luck seeing that in the stable apt repositories anytime soon :)

So, to make life easy, I've put together a fairly simple bash script that downloads and installs Memcached, and libevent, for you.

The script is a blunt instrument, and assumes...

  1. You haven't installed memcached from apt repositories on this machine
  2. You won't be sad when it puts config and startup files at
    • /etc/memcached.conf
    • /etc/init.d/memcached
    • /usr/share/memcached/scripts/start-memcached

Thursday, December 10, 2009

Fix POST for Ruby 1.9.1 and Passenger

How exciting! A new Ruby release to play with.

I figured it was time to migrate this particular app to 1.9.1 on the integration server. We've been developing this app with 1.9 and all looks good.

So I...

  • Upgraded Nginx to version 0.7.64
  • Installed Ruby 1.9.1-p376
  • Installed Passenger 2.2.7
  • Configured Nginx to use the new versions of Ruby and Passenger
  • ... and restarted Nginx

I hit the home page of the app.... Sweet, it works! Yay!

At this point I did a minor happy dance. Nothing over the top, you know... just a little wiggle :)

Then I tried to login to the app... "500 Internal Server Error"

Oh. :(

I stopped dancing right there.

It turns out that POST requests fail for Ruby 1.9.1 and Passenger.

Fortunately, there is a patch.

Patching tempfile.rb did the trick. On that particular machine, tempfile.rb was located at /usr/local/lib/ruby19/1.9.1/tempfile.rb

Thanks to Ryan Bigg for confirming the fix is good.