2013-08-31 75 views
0

最近我繼承了一個Rails應用程序,已經部署到生產中很多次。我以前部署到臨時環境。現在,它無法部署到任一個。然而,另一個部署到具有相同帳戶的相同服務器的Rails應用程序成功部署了使用rvm和capistrano。Capistrano部署失敗rvm-shell說rvm沒有被發現

我收到以下錯誤:

  * executing "if [ -d /path/to/app/shared/cached-copy ]; then svn switch -q --username svnusername --password <filtered> --no-auth-cache  -r111111 https://svn.server.local/svn/projects/app/trunk /path/to/app/shared/cached-copy; else svn checkout -q --username svnusername --password <filtered> --no-auth-cache  -r111111 https://svn.server.local/svn/projects/app/trunk /path/to/app/shared/cached-copy; fi" 
    servers: ["myserver-prod01.private.local"] 
    [myserver-prod01.private.local] executing command 
 ** [myserver-prod01.private.local:: out] 
 ** [myserver-prod01.private.local:: out] $rvm_path (/home/appuser/.rvm/) does not exist. 
 ** [myserver-prod01.private.local:: out] /usr/local/rvm/scripts/rvm: line 174: rvm_is_a_shell_function: command not found 
 ** [myserver-prod01.private.local:: out] /usr/local/rvm/scripts/rvm: line 185: __rvm_teardown: command not found 
 ** [myserver-prod01.private.local:: out] /usr/local/rvm/bin/rvm-shell: line 83: rvm: command not found 
 ** [myserver-prod01.private.local:: out] Error: RVM was unable to use '[email protected]' 
    command finished in 554ms 
*** [deploy:update_code] rolling back 
  * executing "rm -rf /path/to/app/releases/20130425150643; true" 
    servers: ["myserver-prod01.private.local"] 
    [myserver-prod01.private.local] executing command 
 ** [out :: myserver-prod01.private.local]  
 ** [out :: myserver-prod01.private.local] $rvm_path (/home/appuser/.rvm/) does not exist. 
 ** [out :: myserver-prod01.private.local] /usr/local/rvm/scripts/rvm: line 174:  rvm_is_a_shell_function: command not found 
 ** [out :: myserver-prod01.private.local] /usr/local/rvm/scripts/rvm: line 185: __rvm_teardown: command not found 
 ** [out :: myserver-prod01.private.local] /usr/local/rvm/bin/rvm-shell: line 83: rvm: command not found 
 ** [out :: myserver-prod01.private.local] Error: RVM was unable to use '[email protected]' 
    command finished in 209ms 
 ** [deploy:update_code] exception while rolling back: Capistrano::CommandError, failed: "env PATH=/opt/toolkit/extra-dev-current/root/usr/bin:$PATH:/usr/database/bin LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 RAILS_ENV=production rvm_path=$HOME/.rvm/ /usr/local/rvm/bin/rvm-shell '[email protected]' -c 'rm -rf /path/to/app/releases/20130425150643; true'" on myserver-prod01.private.local 
failed: "env PATH=/opt/toolkit/extra-dev-current/root/usr/bin:$PATH:/usr/database/bin LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 RAILS_ENV=production rvm_path=$HOME/.rvm/ /usr/local/rvm/bin/rvm-shell '[email protected]' -c 'if [ -d /path/to/app/shared/cached-copy ]; then svn switch -q --username svnusername --password <filtered> --no-auth-cache  -r111111 https://svn.server.local/svn/projects/app/trunk /path/to/app/shared/cached-copy; else svn checkout -q --username svnusername --password <filtered> --no-auth-cache  -r111111 https://svn.server.local/svn/projects/app/trunk /path/to/app/shared/cached-copy; fi'" on myserver-prod01.private.local 

我已經檢查了服務器。 RVM已安裝並正在運行。

+0

[部署Rails應用程序通過Capistrano發生RVM錯誤]的可能重複(http://stackoverflow.com/questions/5253153/rvm-error-with-deploying-rails-app-via-capistrano) – mpapis

回答

1

這是一個rvm/rvm-capistrano版本不匹配。檢查服務器上安裝的rvm的版本,並與捆綁安裝的rvm-capistrano版本進行比較。如果您的服務器具有rvm 1.18.x,則將Gemfile中的rvm版本鎖定爲1.2.x. rvm-capistrano 1.3.x需要rvm 1.19.x.

我在回答我自己的問題,因爲我必須弄清楚這個難題。回想起來很明顯,但是當你第一次看到這個錯誤的時候並不是這樣。這是沒有在Gemfile中指定產品版本的情況。通常,我們廣泛的測試套件會捕獲這樣的問題,但是我們的測試套件並未覆蓋部署,所以我們錯過了這個測試套件,直到爲時已晚。