Mini Series - Capistrano

Latest Article:

Capistrano series - alternative subversion setups

In the main Capistrano series, we set it up so that the main repository could only be access from the local workstation (so a deployment would checkout the repo to the workstation, zip it up, upload it and then unzip it).

This is great from a security point of view, but what if the subversion repository is on the same Slice as the application (as is the case with many people)?

This mini series will take you through a Ruby on Rails stack with full Capistrano integration and deployment via a subversion repository.

Once done, all you do is make any adjustments on your workstation and enter one command.

This will fire up Capistrano which will deploy the changes and restart the web and app servers - leaving you to concentrate on your application rather than the hassle of deploying it.

Capistrano Mini-Series:

Capistrano Series - Introduction: Introducing the aims and goals of the Capistrano mini series.

Introduction to Capistrano 2: Overview of what Capistrano is and what is does. If you are not sure of the concept behind this great tool, then take a peak.


Setting up your Slice: Now we've read a couple of articles, we can get down and start to configure the Slice ready for the Capistrano stack.

Setting up Subversion: Your Slice is now ready for the first phase of the Ruby on Rails and Capistrano stack. Let's get on and install and configure Subversion.

Installing Ruby, Nginx and sqlite3: Now we can really see the setup start to take shape by installing Ruby, rubygems, the lightweight Nginx web server and sqlite3.

Nginx, Rails and Mongrels: One of the last things on the Slice is to install and configure Ruby on Rails and Nginx with mongrel support.


Local setup and Capistrano: Now the Slice is pretty much setup, we can move onto the local workstation to check out and 'capify' our project.


Configuring Capistrano #1: Now we can look at the Capistrano deploy.rb file, define some variables and issue our first Capistrano command.

Configuring Capistrano #2: Some final tweaks to the deploy.rb file and creating a script/spin file will allow us to deploy our application for the first time.


Application Vhost Creation: Now we've deployed our application for the first time, let's create a simple Nginx vhost to serve it.

Deploying Application Changes: Let's take a look at adding a custom task. Then all we do is enter one command to deploy any application changes.


Handling Database Migrations: Now the main setup and deployment has been completed, let's look at how Capistrano handles database migrations.

Alternative Subversion setups: If your Subversion repository is on the same Slice as your application, you may want to look at this method of configuring Capistrano.

Please feel free to request articles or comment with any suggestions or ideas of your own.

PickledOnion