Upgrading Ruby and Rails on Mac OSX and Moving to Mongrel
Past posts have probably nailed me by this point as a huge fan of Ruby on Rails and the Ruby language in particular.
While I think a huge mythology now surrounds how much more productive it makes you which causes difficulty in separating the hype from reality, my personal experience has made me a raver about it in terms of just getting things done. In one (ok, mostly sleepless) weekend, I managed to get up a canvassing and get out the vote application, web enabled across the internet that was used successfully and to great effect in a Canadian federal leadership campaign (and the person ran rings around the other candidate partly because of its contribution). The party in question had been unable in several years of trying to accomplish the same thing.
While I was programming those things and having them work on the mighty little 12" G4 PB that is my main machine, I really didn't want to be messing with upgrading Ruby or Rails from the 1.8.2 and 1.1.2 versions installed as standard on Tiger.
Fast forward to this week. One of the problems we have at work is an unbelievable pent-up demand for a lot of enterprise/infrastructure database apps, that because of the nature of the organization, really need distribution over the web for it to be eastside, westside and worldwide. Oh, and we have a very limited number of programmers already working their butts off on other projects so prototyping and doing proof of concept stuff in RoR seems like a total no brainer.
But, I really need to update the powerbook. In particular, I want Ruby at version 1.8.4 so it mirrors what is on my hoster and what I'll be installing on the Ubuntu servers we'll use for this at work as well as getting Rails up to its most current version 1.1.6. Slight differences made deploying my last Rails app a bit tricky and led to some minor fixes having to be done directly on the hoster when I deployed the gotv app which was very irritating and caused a bit of late night scrambling (for the future, I intend to use pure subversion and Capistrano deploys)
It's not exactly an easy task however, but I was absolutely blown away by the thoroughness of HiveLogic's cookbook recipe for doing the upgrades. I ran into a couple of gotchas... mostly having to do with not having my
/usr/bin/ but managed to figure it out and correct it and am now running on all the latest shiny new ruby, rails and gems.
On top of all that (compiling and all took a couple of hours while I did other things with that in the background), I also wanted to start using Mongrel. It uses straight up http rather than funky cgi and fast-cgi stuff which, for me, removes a layer of complexity in configuring and getting apps working off the bounce. Also, Webrick, the script included with ruby as a standalone web server, is dead slow and I've been thinking of using clustered Mongrel for real application deploys instead of lighttpd which gives me headaches when trying to debug things with it.
Pretty simple to sort...
sudo gem install mongrel
Say yep to all the dependencies and away you go.
You're now fully updated on ruby, rails and have a shiny new ruby server to help you out.
One thing that got me immediately after loading up mongrel on one of my little web apps was that I started getting this error :
Routing Error Recognition failed for "/gotv/admin"
Where gotv was the directory I was running mongrel in for a web app I had built. Made me think I'd blown the whole thing actually and was a bit stressful.
This is apparently what has happened : Default routes have changed from the previous version of Rails to the new one I had upgraded to. So, where before I would use a URL like:
it appears now that the correct URL to use to get the same thing is :
I actually like it better, but does cause a bit of sweating right after you've done the upgrade unless you know that it is where you're supposed to be pointing your browser. Had to google a few incorrect answers before I found the right one, so assuming people are also upgrading like me I thought I'd provide the answer her for incoming googling peeps' sake.