Monday, November 29, 2010

My Phusion Passenger Checklist

I spent some considerable time trying to get the "hello world" rails app (the one you get when you run rails new myapp) to run under Apache + Passenger the same way it does under rails server.

I tried both root and sub URI setup and was basically struggling with variations of the following three errors:

  • Apache would serve static content out of the document root and then send 404 for the default /rails/info/properties route (Apache
    s 404, not RoR's 404)
  • The Passenger would engage but then fail to start the rails app
  • The Passenger engages and rails app starts but the default /rails/info/properties would report a "No route" error even for local request (telnet from within the SSH)

Without going into very much details (drop me a line if you're interested and I will elaborate) here are the things that you should check:

  • Permissions for the folder the document root is pointing out. It has got to be accessible and executable by the Apache's user
  • Have the mod_rewrite loaded. The default Apache installation that you get with "sudo apt-get install apache2" doesn't have it and the Passenger's doc (at least the pieces I skimmed through) doesn't explicitly tells you to have it on.
  • The default /rails/info/properties controller works for local requests only and only in the development environment. Passenger runs your rails app in production environment by default. So make sure to have the config.consider_all_requests_local set to true and also use the RailsEnv development directive in the Virtual Host configuration
  • You don't need the in your application root. Passenger might treat your app as a Rack app and it's not. Not sure if this one helped me but I googled it up before I figured I was missing the rewrite mode so I followed the advise

Right now both built-in rails server and the kosher Apache show exactly the same result and render the well known "You're riding Ruby on Rails" including the little environment details AJAX piece.


I would have been proud if I figured it all in "no time" as the documentation suggested :)

Sunday, November 28, 2010


Today in the morning I made potato pancakes for breakfast. My family loves it and I usually make more than we together can eat so we have some leftovers as snack.

I must have made a little more than usual today and there was something left when in the afternoon we went out to finish our holiday shopping. Great, we packed it to-go so that kids have something to eat on the way.

My little daughter took one out of the bag and... fall asleep halfway through it. It actually was her time to take a nap anyway. She slept for good forty minutes as we drove around making our scheduled stops. All this time she kept the pancake safe in her hand.

We got back home and she woke up the very minute I turned off the engine. Looked at me. Smiled. Looked down to her hand. Saw the pancake. And she just resumed eating it as if nothing happened.

I couldn't help it and smiled with a very clear thought - continuation. A great example of one in our real life :)


Just about fifteen minutes before, at our last stop, I was catching up on my RSS subscriptions watching Alice asleep while another half of my family was finishing the grocery gshopping list. It's what I was reading that fifteen minutes later made me think continuation and not "how cute".

The latest installment from Eric Lippert about async in the upcoming C#5.0. Even if you don't program in C# or work on .NET platform (I do neither) it's absolutely worth it.

Read it and tell me if you still think I should have first noticed how cute that move was :)

Tuesday, November 16, 2010

Nice weather up here

Online at 30,000 feet is nothing special these days though I still find it amazing. For some $10 you can get a cross country flight long WiFi access. If only the coach cabin had a little more leg room for a full size laptop experience to be a pleasure and not a struggle. Diverting to iPad might be great for reading and movies and emails but if you need to work you're still stuck with a laptop. My usual in-flight setup includes a laptop to catch up on emails and do some work, a Kindle to read a book, an iPhone to listen to music and catch up on pre-cached RSS feeds, and some printouts to read during takeoff and landing (apparently, they let you use WiFi past 3,000 feet but require no electronic device on during take off and landing).

It's a nice weather up here: