Monday, April 28, 2008

Deployment: Part 2

As I mentioned in the last post, we got past SVN.

We finally came to Mongrel Cluster. This was a major headache. Apparently, Capistrano is broken when it comes to handling Mongrel Cluster. Simply following the Capistrano's site tutorial will not work.

The first step around this was to get the Palm Tree gem on the local machine:

>sudo gem install palmtree

This will include some recipes that we can use with our deploy.rb that you need to run Capistrano.

Next, add this to the top:

require 'palmtree/recipes/mongrel_cluster'

This will include the recipe needed to fix the deployment scripts. Basically, it rewrites the deploy script that comes with Capistrano. All you really need to know is that it works ;)

Next, generate a mongrel_cluster.yml by following the "Mongrel Cluster Setup" in this wiki. Check this into your repository as we'll need it.

Add this line to your deploy.rb:

set :mongrel_conf, "root_of_the_app/config/mongrel_cluster.yml"

Last thing we need to add is to tell Capistrano not to use sudo:

set :use_sudo, false

When all this is finally done, make sure that everything is in your repository. We can now attemtp a deploy:

cap deploy:cold

Make sure you use cold, as this should be the first time you're deploying. A deploy:cold is different than a simple deploy because it assumes that your servers are not running yet. Hopefully everything went right here. This should get you past Mongrel Cluster.

The next would be take a look at how to customize your deploy, such as starting other servers that you would potentially need.

We found the "after_stop", "after_start", and "after_restart" helpful for handling our other servers. Make sure that you put them in the deploy namespace ;)

Good luck!


W

No comments: