0

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,      "000.000.201.001"
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"
end

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

desc "Restart Application"
task :restart, :roles => :app do
  run "touch #{current_release}/tmp/restart.txt"
end
end
hagope
  • 101
  • 2
  • 1
    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
    1. cap deploy:setup 2. cap deploy:cold – kaji Jan 31 '12 at 01:25
  • #1 works, #2 fails – hagope Jan 31 '12 at 02:50

1 Answers1

1

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"
end 
Amadu Bah
  • 207
  • 2
  • 3