Capistrano (Part 2)

Deployment Directory Structure

A successful deployment with Capistrano will result in a directory structure like the following (where [deploy_to] is where you want Capistrano to be deploying to on your server):

[deploy_to]/current -> [deploy_to]/releases/20080819001122

Each time you deploy, a new directory will be created under
the “releases” directory, and the new version placed there.
Then, the  “current” symbolic link will be updated to point
to that directory. (For  now, don’t worry about the shared
directory; we’ll get to that  eventually.)

You’ll need to make sure you’ve configured your web server
(whichever one you choose) to look at
[deploy_to]/current/public as the  root web directory
for your application.

Back to Configuration

We need to tell Capistrano where on the server we want our application to live. It defaults to ”/u/apps/#{application}” (where #{application} is the name you set application to, above), but you might prefer (or need) to deploy to something like ”/var/www”. To do so, just set the :deploy_to variable:
set :deploy_to, "/var/www"

Lastly, we need to tell Capistrano where our servers are (we
only have  one), and what roles they each play (again, we only
have one, which will  fill all of the roles).
This is done via the “role” declaration.
role :app, ""
role :web, ""
role :db, "", :primary => true

Because we have only a single server, our role declarations
look a bit redundant.
An alternative syntax uses the “server” keyword:

Those three roles (app, web, and db) are the three that
Capistrano needs  for Rails deployment. You can always add
your own roles, too, for tasks  of your own, but make sure
you declare at least one server in each of  app, web, and
db when you’re deploying Rails applications.