Mini Series - Capistrano

Latest Article:

Capistrano Series - Installing Apache with Passenger (mod_rails) Support

One of the last things that we need to do is install Apache as our webserver, with Rails support via Passenger (mod_rails).

Passenger is an exciting development in Rails deployment, as it allows us to use a single webserver without the need to configure proxies. It supports both Apache and Nginx — for these articles we will be using Apache.

These two mini series will take you through a Ruby on Rails stack with full Capistrano integration and deployment.

The original series used subversion as the main version control system. The new series utilises git instead and is based on the newest Ubuntu LTS release (Hardy Heron).

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 (new and improved):

New Capistrano Series - Introduction: This second series of Capistrano articles utilise the git version control system and the base distro is the latest LTS version from Ubuntu (known as Hardy Heron). It also incorporates a newer version of capistrano.

Introduction to Capistrano 2: Before delving into the new series, take a look at this 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 us to install git as the first step in our stack.

Setting up git: 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 the version control system called 'git'.


Installing Ruby, Rubygems and sqlite3: Let's continue setting up our Slice for our stack. We'll look at installing Ruby, Rubygems and sqlite.

Installing Apache with Passenger (mod_rails) Support: Following along with this series, we can now move forward to installing Apache with Passenger (mod_rails) support.


Capistrano Mini-Series (original):

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