Off the Rails ?
With all the recent rage of Ruby On Rails , I was tempted like everyone else to find out if this technology can actually help me get my web applications developed any quicker. I have tried my hands at PHP, Perl, Java, and C#. All these technologies have their pluses and minuses, but I am still left feeling unfulfilled. Surely web development does not have to be this tedious ? My ideal technology will be something which allows me to knock together in a day a portal like kind of website, completely personalised to my individuality, but with extensible components which allow for complicated plug-ins at a later date. I know these applications are available in all the technologies mentioned above, and they are all excellent too, but I think they all suffer from the same kind of problem which makes ongoing maintenance and enhancement of the application a real nightmare: developer has to learn about the intricacies of the glue which holds the different layers together, and they also have to make changes to multiple places in different layers in order to introduce new functionalities. No, there must be a better way !

Ruby On Rails offers two main features which attract me as an independent web developer:

  • zero configuration (well almost, you still have to configure the database connections)
  • convention based code development (almost like built in re-factoring, for those familiar with XP techniques)

There are other flashy stuff like AJAX support, cool drag and drop etc. But as an independent developer trying to compete against the big boys, I would like to say my priority is all in the 'time to market' factor i.e. how long it takes me to have a concrete technological representation of my next killer business idea which will make me that gazillion dollars, as I simply have to be there before everyone else.

Ruby On Rails has the potential, and with the numerous on line examples, tutorials, forums, books etc. I have seen, it makes it look like it is a walk in the park to set up this environment and be productive in no time. Well, reality is a bit different, and I would like to relate my own personal experience in getting Ruby On Rails up and running, so you can see another side to the story. Hopefully my experiences will benefit someone else trying to do the same thing.

The first few screens of the Ruby On Rails official website have instructions on how to be up and running, and things are extremely simple if you happen to be doing this on a Windows PC, using WEBrick (the default built in web server). But think about this for a moment, how many people will be hooking their PC to the Internet and run their website from there using a web server which only works for the technology in question ? Chances are a large number of people will have something like Apache running on a Linux box, with a whole bunch of PHP/Perl scripts already running, and it would be a nice idea for the new technology to be incorporated and co-exists with the existing technologies, on the same web server. Don't get me wrong, there are plenty of resources around to get you on your way too, but the instructions on the download page will simply not work if you deviate from the standard set up.

The second problem from both the Ruby/Gems/Rails distributions is they all make the assumption of a minimum or medium security model on your target machine. My Linux server has the security level set at DEFCON 1, so things just break in the most mysterious ways, and the errors you get are simply not helping you to pinpoint the problem very easily. Why do I want to do it this way ? Well, like I mentioned before, time to market is important. Also, imagine when you come to deploy your beautifully crafted application, which was developed on your own laptop, to a production server, and suddenly everything just breaks left, right, and centre. Would that not be disheartening ? Might as well bite the bullet and use something as close to the real thing as possible to solve these issues as you go along. At least that is my approach.

The standard configuration for my server is:

  • Mandrake Linux 9.2 running with Apache 2, mod_perl, PHP. MySQL and Sybase installed.
  • Security is set at the highest level by DrakConf.
  • the user running the web server process is not the user owning the files under the document root, meaning none of the files/directories underneath the running process is writeable.
  • Virtual host is switched on, and depending on where you come from, you will see different views of my world
  • root (the privileged user) has a mean umask

My goal is to:

  • install Ruby on Rails on my web server
  • get Rails to run under fastcgi
  • configure Rails to run up as a an embedded web application in Apache, alongside my other PHP/Perl applications

So this sets the scene, let's go down the path to see what I had to do in order to get to the point where I can print "Hello World" on the home page of my first RoR application. Click on the arrows at the end of one of the part below to carry on reading

Next page Give me a place to stand and with a lever I will move the whole world.