Capistrano (Part 4) – Setting up the server and checking dependencies

$ cap deploy:setup

This will log into your server and do a series of “mkdir”
calls. Note,  though, that if you aren’t using sudo
(e.g., you set use_sudo to false,  in your deploy.rb),
you’ll need to make sure the permissions on your deploy_to
directory are okay. If they aren’t, deploy:setup will fail.

To  fix the permissions, you’ll need to log into your server
and do a few  invocations of chown to set the permissions.
$ cap deploy:check

Capistrano will check both your local and remote servers for
a variety  of things. If any of the dependencies are not met,
you’ll get an error message indicating what the problems are.
For things like “you do not  have permissions”, you’ll need
to log into the server and manually chmod  or chown
directories until the permissions are sufficient.

For others  (like the “svn” executable missing, if you’re
using Subversion) you’ll  need to make sure you have those
tools installed.

By default, when Capistrano needs to start your
application layer, it will try to execute a script called

“spin”, in the “script” directory of your application, oneach

remote server. We’ll need to write that script, and

then check it into the source repository.


#{deploy_to}/current/script/process/spawner \
  mongrel \
  --environment=production \
  --instances=1 \
  --address= \

Be sure to replace #{deploy_to} with your actual (full)
deployment path,  and #{port} with the port you want
your mongrel instance to listen on. 

(If you haven’t a preference, 8000 is as good a port
as any.) Make sure  script/spin is executable, and then
check it into your repository. (You  Windows folks will
need to work harder to make sure things are  executable;

If you’re using Subversion, you can do
“svn propset  svn:executable ON script/spin”,
and committing again.)

Lastly here, make sure your web server is configured to

proxy all requests for your application to the port in

question. If you are using multiple mongrel instances,

you’ll need to configure your web server to round

robin (or otherwise load balance) across the multiple