Capistrano部署失败,rvm-shell说没有找到rvm

时间:2013-08-31 13:04:35

标签: rvm capistrano rvm-capistrano

最近,我继承了一个已多次部署到生产环境的Rails应用程序。我之前已部署到暂存环境。现在,它无法部署到任何一个。但是,使用rvm和capistrano成功部署到具有相同帐户的相同服务器的另一个Rails应用程序。

我收到以下错误:

  * 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 'ruby-1.9.3-current@appuser'
    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 'ruby-1.9.3-current@appuser'
    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 'ruby-1.9.3-current@appuser' -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 'ruby-1.9.3-current@appuser' -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已安装并正常运行。

1 个答案:

答案 0 :(得分:1)

这是rvm / rvm-capistrano版本不匹配。检查服务器上安装的rvm版本,并与安装了bundle的rvm-capistrano版本进行比较。如果您的服务器具有rvm 1.18.x,则将您的Gemfile中的rvm版本锁定到1.2.x. rvm-capistrano 1.3.x需要rvm 1.19.x。

我正在回答我自己的问题,因为我必须努力解决这个问题。回想起来很明显,但是当你第一次看到错误时就不会这样。这是无法在Gemfile中指定产品版本的情况。一般来说,我们广泛的测试套件会遇到这样的问题,但是我们的测试套件不包括部署,所以我们错过了这个,直到为时已晚。