Tag: capistrano

Capistrano is a tool for automating tasks on one or more remote servers. It executes commands in parallel on all targeted machines, and provides a mechanism for rolling back changes across multiple machines. It is ideal for anyone doing any kind of system administration, either professionally or incidentally.

Capification

The first thing you need to do (after installing Capistrano) is to “capify” your application. This is the process of configuring Capistrano to deploy your application. It’s easy enough; just make sure you’re in your application’s root directory and type “capify .” (that’s “capify”, followed by a space, followed by a dot).

This will create two files:

Capfile

this is the “main” file that Capistrano needs. Just as “make” automatically loads “Makefile”, and “rake” automatically loads “Rakefile”, Capistrano looks for and loads “Capfile” by default. The default Capfile generated by capify is pretty minimal. All it does is load “config/deploy.rb”…

config/deploy.rb

this is the file that contains your Rails application’s deployment configuration. Rails prefers that all configuration go under the config directory, and so Capistrano tries to abide by that as much as it can by just pointing the Capfile at config/deploy.rb

Configuration

Now that we’ve got the files we need, the next step is to tell Capistrano about our server. First, we need to tell it what our application is called.

set :application, "tutorial"

Then, we need to tell Capistrano where our source code resides. This is the repository address for your application, and by default it must be accessible both by your local machine (where you will be deploying from) and your production servers (where you will be deploying to)

set :repository, "svn+ssh://code.capify.org/repos/tutorial"

Now, if you aren’t using Subversion, you’d next want to tell Capistrano what SCM you are using:

set :scm, :git

Next, we should tell Capistrano, where on our server we are deploying to.

(Refer Capistrano Part 2 Blog for continuation. Hey boy it’s not this much small. A lot remaining.)