Capistrano 2 - an introduction

Before delving into the mini series, an introduction and explanation of what Capistrano is and what it does is needed.

Once setup, deploying your application changes (and it doesn't have to be Ruby on Rails) is a breeze with Capistrano.

Ease of deployment

Capistrano 2 makes all of the mundane and fiddly tasks a lot easier. You don't need to log into the Slice to upload and serve an updated revision of your application.

It can all be controlled from the workstation you develop on.

Do note that Capistrano is not designed to be used solely by Ruby on Rails - you can use it for many application structures and architectures.

What it's not

Capistrano 2 is not designed to build your server. It will not install Apache for you. It can be used for much more than uploading updates and restarting servers but it is not designed to be used as a replacement for building your Slice.

If you want an automated build system there is the deprec gem. However, it is not (as yet) compatible with Capistrano 2 (when it is, there will be articles aplenty!).


Let's have a look at how the vast majority of users develop their applications and deploy them to their Slice.


Normally, one of the first things to happen is a subversion repository is created. For the sake of argument (and to make my images clearer) I am going to assume it is on a remote server.

It can be on the same slice as the application server or even on your local workstation - as long as both the Slice and local workstation have access to it, it doesn't really matter.

If you are unsure about setting up subversion, please the subversion articles.

Subversion Workflow

Once setup, it is usual for developers to check out revision 1 of the application and start working on it: changes being committed as and when needed.


Once happy, the same sort of thing happens but from the Slice. Once the vhost has been setup and configured correctly, the developer logs into the Slice and checks out the latest working version, restarts the server and/or mongrels and then logs out again:

Subversion Workflow


I don't know about you but this all seems very repetitive - effectively repeating the same commands but in different locations.

This is where Capistrano 2 comes in:

Capistrano Workflow

As you can see, it bridges the gap that comes from working from the workstation and then working from the Slice.

It allows you to use the workstation to send a single command to the Slice which will update the application to the latest subversion revision, save old revisions of the domain folders and restart the server and mongrels.

Not bad for a single command and no messing about with logging into the server do all of this.


This makes for deploying updates a lot easier and a lot more convenient.

Yes, it's possible to log into the server to do all of this - it's what most of us do. But why makes life as a developer and/or sysadmin more complicated than it has to be?

Although installing, configuring and deploying Capistrano 2 is in the next article, once done all you have to do to deploy your updated Rails is:

cap deploy



I hope this clarifies what Capistrano is intended to do and what it acheives.

Now your appetite has been whetted, we can move on and setup the Slice in the next articles.


Article Comments:

vince commented Thu Nov 01 03:39:37 UTC 2007:

Thanks for all the excellent articles! Looking forward to the one regarding configuring capistrano 2.

John Griffiths commented Sun Dec 02 01:20:06 UTC 2007:

Me too, Capistrano has made my life so much easier!

Wanted to switch to the 2.0 release a while back but the incompatibility with Deprec put me off, now i'm getting better at doing the server setup I might finally be able to migrate.

Looking forward to the article Paul, your a genius!

Frank K commented Wed Dec 05 19:16:31 UTC 2007:

Can't wait for the second article...I defiantly want to use this for deployment.

Sudar commented Thu Jan 24 09:51:05 UTC 2008:

Thanks for the articles and keep up the good work.

There is a small typo in the first paragraph. It should be

"...Capistrano is and what *it* does is needed."

instead of

"...Capistrano is and what *is* does is needed."

PickledOnion commented Thu Jan 24 10:01:46 UTC 2008:


Thanks - I fixed it :)


Kris commented Thu Jul 15 12:46:50 UTC 2010:

Sprinkle is a good alternative to deprec for automated provision of a slice, and can use cap2, vlad or ssh under the hood.

Want to comment?

(not made public)


(use plain text or Markdown syntax)