Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using Capistrano to deploy a Ruby on Rails app to a VPS running Ubuntu 11.10. However, whenever I run cap:deploy i get this error:

cd: 1: can't cd to /var/www/appname/releases

The VPS I'm using is Linode. Locally, I'm on Mac OS X 10.7.2 Lion.

Also, I'm using git, Passenger and Ngninx, although I don't think it makes a difference, I think it has to do with folder privileges and SSH more than anything.

Here's the deploy.rb

set :user, "name"
set :application, "appname"
set :domain,      ""
set :repository,  "."
set :use_sudo,    true  
set :deploy_to,   "/var/www/#{application}"
set :scm,         "none"
set :deploy_via, :copy
role :app, domain
role :web, domain
role :db,  domain, :primary => true

namespace :deploy do
  task :start, :roles => :app do
    run "touch #{current_release}/tmp/restart.txt"

task :stop, :roles => :app do
  # Do nothing.

desc "Restart Application"
task :restart, :roles => :app do
  run "touch #{current_release}/tmp/restart.txt"
share|improve this question
Do you have to do something like "cap deploy:setup" to create the directory prior to deployment? Can you ssh into the box and see if the directory exists, and verify the permissions are compatible with the user capistrano is using? – cjc Jan 30 '12 at 21:14
that def helped, but now I'm getting this error: find: `/home/omar/apps/appname/releases/20120130213034/public/javascripts': No such file or directory – hagope Jan 30 '12 at 21:32
1. cap deploy:setup 2. cap deploy:cold – kaji Jan 31 '12 at 1:25
#1 works, #2 fails – hagope Jan 31 '12 at 2:50

Try add the following to deploy.rb:

before 'deploy:update', :create_release_folder
task :create_release_folder do  
  run "sudo mkdir -p #{deploy_to}/releases"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.