简体   繁体   English

调试Capistrano

[英]Debugging Capistrano

I'm deploying to a VPS using capistrano, based on the guide at RailsCasts. 我正在使用capistrano部署到VPS,基于RailsCasts的指南。 http://railscasts.com/episodes/335-deploying-to-a-vps?view=asciicast http://railscasts.com/episodes/335-deploying-to-a-vps?view=asciicast

It's failing on the deploy:cold command, with a conflict with Ruby. 它在deploy:cold命令失败,与Ruby发生冲突。 I actually can't see what the problem is, as when I shell into the same user the Ruby version looks correct. 我实际上看不出问题是什么,因为当我对同一个用户进行shell时,Ruby版本看起来是正确的。

$ 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. 当我读取deploy.rb文件时,我看不到它甚至引用Ruby版本的位置。 Pretty frustrating, I am about ready to ftp the repo up, which is not ideal obviously. 非常令人沮丧,我准备好将repo up起来,这显然不太理想。

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. 好吧,我终于找到了问题的根源--Capistrano使用的ruby版本与服务器上的实际内容之间存在不匹配。

To debug Capistrano run it like this: 要调试Capistrano,请按以下方式运行:

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. 那就是您可以逐步执行命令并在删除之前访问远程服务器上的临时目录。

我刚才有类似的问题,原因是.ruby-version文件指向1.9.3 (文件由rails-composer生成),而在远程机器上通过rbenv安装了1.9.3-p392 p392。

capistrano的调试信息可以通过tail -f log/capistrano.log

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM