Ruby on Rails on Arch Linux with Mongrel and Apache

I’ve spent the last week or so trying to get a Ruby on Rails up and running on my Arch Linux box. I was determined to get something ‘better’ than WEBrick running to allow me to have production(ish) environment. I also wanted to achieve side by side with LAMP configuration I’m running to serve this (wordpress) blog.

I started off looking at using Apache with mod_fastcgi, which for the life of me, I couldn’t get the module to compile at all. I tried numerous PKGBUILDs from other archers but none seem to compile.

I then looked to Apache with mod_fcgid which is supposed to be better for Apache2 installations over mod_fastcgi. I had a little more success with this but overall it didn’t work. I successfully created my own Arch package for this which seemed to install OK, I just never seemed to get it ‘talking’ to rails properly 😦

I then started to read some stuff about Mongrel which looked interesting. No FCGI but with speed 😀 I actually was reminded about Mongrel while reading Amy Hoy’s article ‘Because let’s face it, WEBrick sucks‘ which showed my how easy it would be to use Mongrel. Thanks Amy 🙂

So, getting Mongrel working was fine, but I wanted to proxy the requests through apache so that I had only one webserver talking to the outside world. I found Hank Matter’s article ‘Successful settings for Apache forwarding to Mongrel‘ set me off in the right direction but actually discovered this was overly complex for my setup. It was actually alot easier than this to setup.

Hank seems to be setting it up so that a folder off your site proxys back to Mongrel and serves your rails content. If though, like me, you are using virtual hosts, the setup is simplified further.
It is just a case of adding this in your virtual host config –

Redirect / http://vhost.example.com/
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/

That’s it, Apache is now proxying back to Mongrel 🙂

Simplest LAMP Set-up

Having just moved this blog from Windows to Arch Linux, I’m keen to stress how easy it was.

Installing Arch isn’t supposed to be easy, but I think it is, it’s not graphical with bells and whistles but it’s simple and concise. Once I had Arch up and running, I had a quick look at the Arch Wiki and soon had a fully working LAMP set-up.

I think that has to be the most painless install of Apache, MySQL and PHP I have ever done. Well done Arch 🙂

Thoughts on SLED 10

For me and probably a great many others, the most anticipated Linux release of late has been that of SuSE Linux Enterprise Desktop 10 (SLED10). When Novell released the public beta I rushed to download the 5 CDs and burn them. I then, having recently moved house, found myself in a situation where I had absolutely nothing to install it on as my house was still in boxes. When I finally got round to unpacking my office equipment the first thing I therefore wanted to do was install this puppy 🙂

The install went very well. I was very impressed with this distro’s ability to detect my 200GB disk attached as a third IDE device on my motherboard, no other distro has ever managed this! The install made a pretty reasonable assumption that I wanted to install in the 150GB of free space on this drive and reuse the swap space allocated for an existing linux distro. Good assumption but not what I wanted to do. I simply told it to use my second disk and overwrite the exisiting linux distro, which it was happy to do and was childsplay really. I answered a few no-brainer questions and the installation of files started, I was impressed at this point with the ‘slideshow’ and ‘details’ (I think that was what it was called) tabs during this stage. Slideshow provided some nice blurb about the OS and it’s features while the details tab allowed me to really see what was going on. I like the way the installer showed me how long it was likely to be until a disk change, very neat. On the subject of disk changes, this is where the installer took a turn for this worst. I watched the time counter get to 0 and expected the installer to ask for disk 2, it didn’t, it simply rebooted. I would consider myself pretty techy and even I was worried at this point, no warnings, no nothing, just a reboot. My fears were unnecessary as the installer started back up again after the reboot got straight back to where it left off and asked for disk 2, that’s fine but why not tell me it’s going to reboot? One thing I noted at this point was that the installer now only had the details tab rather than the option of the friendly slideshow, this struck me as a strange inconsistency which might scare a non-technical user.

The rest of the install is a blur, so I guess it went pretty well. All of my hardware was detected correctly including my graphics card and monitor combo which has always been a headache for SuSE. No other SuSE install has ever configured X correctly on this machine. So all was good, apart from one major bugbear. On logging in to my new spangly desktop my first impressions were immediately marred by the realisation that the X config had somehow left me with a 20 pixel (or so) black strip down the right hand side of my screen. I could probably delve into xorg.conf (or similar) and tweak a number that reflects the geometry of my monitor, but I shouldn’t have to.

I’m really encouraged by what I’ve seen so far in SLED10 and to be honest I haven’t had much time at all to play with it. I was particulary impressed that Banshee managed to play my music collection (from an NTFS partition) with no problems at all, even though the entire lot are encoded as AAC, now that’s pretty good for linux.

Beagle seems really good, although rather slow on my test machine. I have however, managed to crash beagle just by clicking on one of the little arrows to see more results 😦

I really would like to test the distro more and I’m pretty confident that Novell will kill any little bugs before final release. Since installing SLED10 I’ve spent some time installing Arch on another machine so that I can move this blog off of my windows machine (the dual boot with SLED10). With this blog now running on Arch I can spend more time in SLED10 🙂