2013-07-01 19 views
4

我使用capistrano基於RailsCasts指南部署到VPS。 http://railscasts.com/episodes/335-deploying-to-a-vps?view=asciicast調試Capistrano

它在部署:冷命令失敗,與Ruby發生衝突。我實際上看不出有什麼問題,因爲當我將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] 

這是錯誤:

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 

我的問題是:我怎麼能調試嗎?當我讀取deploy.rb文件時,我無法看到它甚至引用了Ruby版本的位置。相當令人沮喪的是,我準備好回購ftp,這顯然不理想。

+0

看起來像你正在使用rbenv你的紅寶石安裝 - 你可能想結帳這篇文章:http://henriksjokvist.net/archive/2012/2/deploying-with-rbenv-and-capistrano/ - 'set: default_environment,{ 'PATH'=>「$ HOME/.rbenv/shims:$ HOME/.rbenv/bin:$ PATH」 }' – house9

回答

2

我只是有類似的問題,原因是.ruby-version文件在1.9.3指向(由軌道作曲家生成的文件),而有通過遠程計算機上安裝rbenv 1.9.3-p392

+0

其實我也使用過Rails Composer。 – ardochhigh

8

那麼我終於到了這個問題的底部 - Capistrano使用的ruby版本和服務器上的實際內容之間的不匹配。

要調試運行Capistrano的像這樣:

cap deploy:cold -d 

那是你可以通過命令步驟和訪問遠程服務器上的臨時目錄被刪除之前。

+4

這對Capistrano 3來說不是正確的:'OptionParser :: AmbiguousOption:ambiguous option :-d' –

+0

for Capistrano3我們可以使用cap staging deploy -t代替 –