27.02.2013 Views

Rails%203%20In%20Action

Rails%203%20In%20Action

Rails%203%20In%20Action

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

400 CHAPTER 14 Deployment<br />

With the Capistrano configuration done, you can run the cap command, passing<br />

in the name of a task to set up your application, such as deploy:setup. This task is<br />

one of a group of tasks that are provided by default with Capistrano. To see a list of<br />

these tasks, use the cap -T command.<br />

14.5.3 Setting up the deploy environment<br />

You’ll now use the deploy:setup task, which will set up the folder where your application<br />

is deployed, /home/ticketeeapp.com/apps/ticketee, with some basic folders:<br />

cap deploy:setup<br />

This command is in the same vein as the rails new command you’ve used previously<br />

because it sets up an identical, standard scaffold for every Capistrano. When this command<br />

runs, you’ll see a large chunk of output that we’ll now break down, one line at a<br />

time:<br />

* executing `deploy:setup'<br />

Capistrano tells you the name of the currently executing task, deploy:setup. The<br />

next line tells you what command it is about to execute.<br />

* executing "mkdir -p /home/ticketeeapp.com/apps/ticketee<br />

/home/ticketeeapp.com/apps/ticketee/releases<br />

/home/ticketeeapp.com/apps/ticketee/shared<br />

/home/ticketeeapp.com/apps/ticketee/shared/system<br />

/home/ticketeeapp.com/apps/ticketee/shared/log<br />

/home/ticketeeapp.com/apps/ticketee/shared/pids<br />

These are the basic directories required for Capistrano. The first directory acts as a<br />

base for your application, containing several different subdirectories, the first of<br />

which is releases. Whenever you deploy using Capistrano, a new release is created in<br />

the releases directory, timestamped to the current time using the same time format as<br />

migrations within Rails (such as 20110205225746, or the full year followed by two digits<br />

each for the month, day, minute, hour, and second, or YYYYMMDDHHmmSS). The latest<br />

release would be the final one in this directory.<br />

The shared directory is the directory where files can be shared across releases,<br />

such as uploads from Paperclip, that would usually go in the public/system directory,<br />

which would now be placed in shared/system.<br />

The shared/log directory is symbolically linked 23 to the current release’s log directory<br />

when you run a deploy. This is so all logs are kept in the shared/log directory<br />

(rather than in each release) so that, if you choose to, you can go back over them and<br />

read them.<br />

The shared/pids directory is symbolically linked to the current release’s tmp/pids<br />

up on deploy. This folder is used for process ids of any other parts of your application.<br />

At the moment, you don’t have any of these and so this directory is of no major<br />

concern.<br />

23 http://en.wikipedia.org/wiki/Symbolic_link.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!