Archive for the 'Uncategorized' Category

A thing or two about deploying Rails apps

May 14, 2009

Note: This is an old rant which I wrote because I saw no end to possibilities and how to choose the right one when deploying large-scale Rails app yourself. Now, almost a year later, I’m still not sure there is one true way. But it’s not important any more. Enjoy the read.

It’s easy. Until you go worldwide.

I don’t know Django or any other web frameworks as well as Rails, so please don’t bite as this is no such call.

For local, small size web apps, Rails is absolute winner. It’s fast on development side and it’s fast to deploy. Few lines in NginX (or Lighty) and you’re set. You might just run it in development mode, just to see what is going on under the hood. It won’t hurt too much. The on;y downsize is if you happen to have a lot of theese small aps. Each app eat’s up at least 50MB of RAM, probably more. Before you know, you’re short on memory.

Situation changes rapidly when one starts thinking about going worldwide with it’s app. There’s a whole lot of stupidities you have to to through to get the right hardware setup the right way. But let’s drop this one. Let’s consider only software. Here’s my take: To run worldwide Rails app, you need at least 5 different software packages, all running and working with each other in perfect harmony. And this is just the very bare minimum. Let me explain.

For starters, let’s say we only have one server, so replication and load-balancing are out of the equation. To run a Rails app you need this: database software, web server (static and dynamic), Rails package and some search engine software package (I delibrately put out the text editor, as it’s not vital for production app deployment). This is the bare minimum. But this setup can get you a long way. It just could be enough to live trough and be a successful web app. Many did.

As many real world examples show, in most cases this is not enought. By far. To write it you need a bit bigger arsenal of tools. If you want to do it right (for some common sense level of right), you need even more software to support your development, deployment and at the very end, your production web app.

Test Driven Development seems to be praised in these days (even in startup-compressed time measures). This alone brings in 2-3 new Rails software packages, all of which you need to get to know of, use and maintain. Version control is of core necessity (git is popular this days), while caching (memcached), bug-tracking(insert your favorite here) and project management software (again, your favorite) is usually “a must have”. (Note: I still shiver when I hear “project management” phrase. Don’t even try mentioning “time management” to me…)

Deployment software to copy your app to multiple servers is also needed (Rails guys usually go with Capistrano), so is testing software (selenium, to name one) and of course we cannot forget about monitoring and reporting (God or Monit comes to mind). And then there are various statistics. We can’t let managers go empty handed, pretty graphs are essential!

With all this in mind, to deploy an Rails web app, you’d need 15 to 20 different software packages. And I didn’t even mention database replication, backup and keep-it-running-force-scripts we’re all aware of (but never talk about). Now, the hardest part isn’t developing this monster Rails app. It will probably have some errors at the beginning, but you can find them easily and quickly. It’s keeping all this various pieces of software of the right version on the right servers running in the way you’d expect them to. Countless hours are usually wasted in the process of fixing and maintaining the latter. And I don’t even want to remember the moments we did deploys and were crossing our fingers hoping everything would work as we planned.

Maybe your project has better foundations or is somehow of better stability and maintainability. Good for you. But I’m sure you’re not using less than 10 pieces of software to drive the whole thing. If so, let me know! Immediately, please!

But hey, I’m wondering, isn’t there a better way to deploy, run and maintain a worldwide web app? This is software. Why can’t it be more simple? Do we really need all this additional software just to keep one web app running (smoothly, I dare to say).

They say web3.0 is just around the corner… What will be the next a-must-have software package to support all this fine new ideas that are about to emerge?

Maybe an “off” button?

Advertisements