Boohoo, My Site is Down!! -- Got Capistrano?

Posted by Aaron Qian Thu, 26 Jun 2008 16:26:00 GMT

Servers DO Fail—Get Real

About three days after my failed attempt in persuading my contractor FooBy Company (for privacy reasons, the name is not real) to setup automatic deployment solutions for their rails online shopping service, I got a call from them and was informed that the website is down, and they can’t seems to get the site back up. I have just started working with them. Without the knowledge of the internals of the server structure, I ssh into their server(a little nervous), read their poorly written bash scripts, hack around. After about one and half hours of frustration, 2 server reboots, a dozen mongrel_rails cluster::start, a few undeleted pids, and countless French. I finally brought the site back from oblivion.

Total downtime: 3 hours 23 minutes…

A Better Solution Than French

Someone as smart as you might wonder, there must be a better solution to this. Yes, if you ask any creditable rails developer, usually you will get Capistrano.

As you probably already know, Capistrano is a automatic server deployment solution that ease the complexity of rails/merb deployment. You can find out more on their website.

How long does it take to setup Capistrano?

  1. sudo gem install capistrano
  2. cd /YOUR_APP_ROOT; capify .
  3. mate config/deploy.rb
    and modify to your liking
  4. cap deploy:setup
  5. ssh into your server, create directories, create config files
  6. cap deploy:cold

Setup time: 20 minutes. Deployment time: 1minute. (Just run cap deploy)

Do it right => Do it fast

From my own experience in working with managers and CEOs, I have concluded some commonalities.

  1. Speed is everything.
  2. Short term benefit is always greater than long term benefits.
  3. We should do it right, but we should do it later, because it cost too much
  4. Don’t fix/change/optimize it if it works now.
  5. We know there are potential problems, let’s fix it when the problem arises

No No No!

Do it right, and do it once!!

Tags , , , , ,  | 3 comments | 7066 trackbacks