Sunday, March 20, 2011

A train set and a two story bed


What would you name if I asked you to recall a few things you had badly wanted as a kid but had never had?

Mine are a train set toy and a two story bed.

Train set. A metal one, from the East Germany, the ultimate gift I, a six year old boy in the USSR, could have wished for. It was expensive, would likely cost a good part of what my dad was making a month, if you could find it. No store had it. Your family should have had connections to get it delivered from the place of origin.

Two story bed. I was growing up with my younger brother and we were sharing the room for as long as I remember myself, up to the point when I left to start my own family. As a kid I saw a two story bed once or twice and it must have penetrated my memories so deep I still cannot get it out.

My son is eight and a half. He had number of different train sets made of metal and wood and plastic and stopped playing them all a while ago. His younger sister is two and a half and they rarely share a bedroom but he enjoys the second story of his two story bed. I told him how much I once wanted to have one when I was a kid so he offered me the second story on the night it was brought in and assembled. I let him enjoy it and kept my memories :)

Last winter I took my whole family skiing up north in New Hampshire. We shared a nice big house right on the mountain with two other friend families, our rooms where on the first floor and one had a two story bed in it. The bed was higher than usual, my son found it uncomfortable to be too close to the ceiling so I took it. Next night I sprained my ankle getting down at night, must have missed a rung or something. Did not enjoy much climbing it back and forth in the upcoming few days but still love my memories of not having it as a kid :)

Care to share your story?

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 config.ru 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 :)