Eki Eqbal
Eki Eqbal

Reputation: 6057

Having problems with setting up my Capistrano with Rails

I'm trying to deploy my Rails application using Capistrano.

My deploy.rb file looks like this :

require "bundler/capistrano"

server "xx.xx.xxx.xxx", :web, :db, :primary => true

set :application,       "myApp"
set :user,              "ubuntu"
set :deploy_to,         "/home/#{user}/apps/#{application}"
#set :deploy_via,       :remote_cache
set :migrate_target,    :current
set :keep_releases,     3

set :scm,               "git"
set :repository,        "[email protected]:name/#{application}.git"
set :branch,            "master"
set :use_sudo,          false

default_run_options[:pty] = true

# default_run_options[:shell] = '/bin/bash'

ssh_options[:forward_agent] = true
ssh_options[:keys] = ["#{ENV['HOME']}/.ec2/keypair.pem"]

Now whenever I try to do

cap deploy:cold

I get an error just like the following :

https://gist.github.com/c54933142b900f9f93b9

Any help would be appreciated .

Upvotes: 1

Views: 104

Answers (1)

Tom Harrison
Tom Harrison

Reputation: 14068

The only thing I am looking at that I don't recognize is the set :migrate_target :current -- this is probably the default or implied so maybe nothing to worry about, but the root error from your gist is

 ** [out :: xx.xx.xxx.xxx] rm:
 ** [out :: xx.xx.xxx.xxx] cannot remove `/home/ubuntu/apps/myApp/current'
 ** [out :: xx.xx.xxx.xxx] : Is a directory

current should be a symbolic link, not a directory, so it's hard to know how it got to be directory.

I would log in to the server, change to /home/ubuntu/apps/myApp/ then rm -rf current. From there you could manually create the expected symlink (current will link to a directory whose name is a date/time), or alternatively back from your local machine run cap deploy:create_symlink then try a regular deploy.

I think it's fair to say that capistrano initialization is not it's strong suit -- once you get things going it tend to be ridiculously awesome, until then, more just infuriatingly obtuse.

Upvotes: 2

Related Questions