port5432
port5432

Reputation: 6381

Debugging Capistrano

I'm deploying to a VPS using capistrano, based on the guide at RailsCasts. http://railscasts.com/episodes/335-deploying-to-a-vps?view=asciicast

It's failing on the deploy:cold command, with a conflict with Ruby. I actually can't see what the problem is, as when I shell into the same user the Ruby version looks correct.

$ cap shell
cap> which ruby
[establishing connection(s) to 192.xxx.xxx.xxx]
 ** [out :: 192.xxx.xxx.xxx] /home/deployer/.rbenv/shims/ruby
cap> ruby -v
** [out :: 192.xxx.xxx.xxx ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]

This is the error:

command finished in 655ms
* 2013-07-01 16:40:39 executing `bundle:install'
* executing "cd /home/deployer/rails/assay/releases/20130701144038 && bundle install --  gemfile /home/deployer/rails/assay/releases/20130701144038/Gemfile --path   /home/deployer/rails/assay/shared/bundle --deployment --quiet --without development test"
servers: ["192.xxx.xxx.xxx"]
[192.xxx.xxx.xxx] executing command
** [out :: 192.xxx.xxx.xxx] rbenv: version `1.9.3' is not installed
command finished in 662ms
*** [deploy:update_code] rolling back

My question is: how can I debug this? When I read the deploy.rb file I can't see where it even references the Ruby version. Pretty frustrating, I am about ready to ftp the repo up, which is not ideal obviously.

Upvotes: 5

Views: 11223

Answers (3)

Lane
Lane

Reputation: 4996

Debug info of capistrano can be shown by tail -f log/capistrano.log.

Upvotes: 0

cthulhu
cthulhu

Reputation: 3726

I just had similar issue, the reason was .ruby-version file pointing at 1.9.3 (file was generated by rails-composer), while there was 1.9.3-p392 installed via rbenv on remote machine.

Upvotes: 3

port5432
port5432

Reputation: 6381

Well I finally got to the bottom of the issue - a mismatch between ruby versions use by Capistrano and what was actually on the server.

To debug Capistrano run it like this:

cap deploy:cold  -d

That was you can step through the commands and access the temporary directories on the remote server before they are deleted.

Upvotes: 8

Related Questions