在Capistranos'cap deploy:cold`之后,Rbenv停止了工作 - RailsCast第335集失败了

时间:2012-10-12 04:21:09

标签: ruby-on-rails capistrano railscasts linode rbenv

我正在关注rails Cast第335集:http://railscasts.com/episodes/335-deploying-to-a-vps

使用linode VPN,

跑步:

cap deploy:cold

* executing `deploy:cold'
  * executing `deploy:update'
 ** transaction: start
  * executing `deploy:update_code'
    updating the cached checkout on all servers
    executing locally: "git ls-remote git@github.com:benamir/listpro.git master"
    command finished in 1546ms
  * executing "if [ -d /home/deployer/apps/listpro/shared/cached-copy ]; then cd /home/deployer/apps/listpro/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 84770c5b6f38dbfeca1b5ef619fb1b9940121a4e && git clean -q -d -x -f; else git clone -q git@github.com:benamir/listpro.git /home/deployer/apps/listpro/shared/cached-copy && cd /home/deployer/apps/listpro/shared/cached-copy && git checkout -q -b deploy 84770c5b6f38dbfeca1b5ef619fb1b9940121a4e; fi"
    servers: ["198.74.59.184"]
    [198.74.59.184] executing command
    command finished in 2874ms
    copying the cached version to /home/deployer/apps/listpro/releases/20121012050310
  * executing "cp -RPp /home/deployer/apps/listpro/shared/cached-copy /home/deployer/apps/listpro/releases/20121012050310 && (echo 84770c5b6f38dbfeca1b5ef619fb1b9940121a4e > /home/deployer/apps/listpro/releases/20121012050310/REVISION)"
    servers: ["198.74.59.184"]
    [198.74.59.184] executing command
    command finished in 8648ms
  * executing `deploy:finalize_update'
    triggering before callbacks for `deploy:finalize_update'
  * executing `deploy:assets:symlink'
  * executing "rm -rf /home/deployer/apps/listpro/releases/20121012050310/public/assets &&\\\n        mkdir -p /home/deployer/apps/listpro/releases/20121012050310/public &&\\\n        mkdir -p /home/deployer/apps/listpro/shared/assets &&\\\n        ln -s /home/deployer/apps/listpro/shared/assets /home/deployer/apps/listpro/releases/20121012050310/public/assets"
    servers: ["198.74.59.184"]
    [198.74.59.184] executing command
    command finished in 246ms
  * executing "chmod -R g+w /home/deployer/apps/listpro/releases/20121012050310"
    servers: ["198.74.59.184"]
    [198.74.59.184] executing command
    command finished in 878ms
  * executing "rm -rf /home/deployer/apps/listpro/releases/20121012050310/public/system && mkdir -p /home/deployer/apps/listpro/releases/20121012050310/public/"
    servers: ["198.74.59.184"]
    [198.74.59.184] executing command
    command finished in 99ms
  * executing "ln -s /home/deployer/apps/listpro/shared/system /home/deployer/apps/listpro/releases/20121012050310/public/system"
    servers: ["198.74.59.184"]
    [198.74.59.184] executing command
    command finished in 96ms
  * executing "rm -rf /home/deployer/apps/listpro/releases/20121012050310/log"
    servers: ["198.74.59.184"]
    [198.74.59.184] executing command
    command finished in 95ms
  * executing "ln -s /home/deployer/apps/listpro/shared/log /home/deployer/apps/listpro/releases/20121012050310/log"
    servers: ["198.74.59.184"]
    [198.74.59.184] executing command
    command finished in 95ms
  * executing "rm -rf /home/deployer/apps/listpro/releases/20121012050310/tmp/pids && mkdir -p /home/deployer/apps/listpro/releases/20121012050310/tmp/"
    servers: ["198.74.59.184"]
    [198.74.59.184] executing command
    command finished in 99ms
  * executing "ln -s /home/deployer/apps/listpro/shared/pids /home/deployer/apps/listpro/releases/20121012050310/tmp/pids"
    servers: ["198.74.59.184"]
    [198.74.59.184] executing command
    command finished in 95ms
    triggering after callbacks for `deploy:finalize_update'
  * executing `bundle:install'
  * executing "ls -x /home/deployer/apps/listpro/releases"
    servers: ["198.74.59.184"]
    [198.74.59.184] executing command
    command finished in 132ms
  * executing "cd /home/deployer/apps/listpro/releases/20121012050310 && bundle install --gemfile /home/deployer/apps/listpro/releases/20121012050310/Gemfile --path /home/deployer/apps/listpro/shared/bundle --deployment --quiet --without development test"
    servers: ["198.74.59.184"]
    [198.74.59.184] executing command
 ** [out :: 198.74.59.184] sh: bundle: not found
    command finished in 95ms
*** [deploy:update_code] rolling back
  * executing "rm -rf /home/deployer/apps/listpro/releases/20121012050310; true"
    servers: ["198.74.59.184"]
    [198.74.59.184] executing command
    command finished in 868ms
failed: "sh -c 'cd /home/deployer/apps/listpro/releases/20121012050310 && bundle install --gemfile /home/deployer/apps/listpro/releases/20121012050310/Gemfile --path /home/deployer/apps/listpro/shared/bundle --deployment --quiet --without development test'" on 198.74.59.184
[listpro-a(__git_ps1 " (%s)")]$ 

我道歉,我们必须回溯......

运行rbenv安装程序后:

 curl -L https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash

我得到了

 Seems you still have not added 'rbenv' to the load path:

export RBENV_ROOT="${HOME}/.rbenv"

if [ -d "${RBENV_ROOT}" ]; then
   export PATH="${RBENV_ROOT}/bin:${PATH}"
   eval "$(rbenv init -)"
fi

以上内容已保存在我的.bashrc文件中

昨天: 执行所有这些命令: rbenv bootstrap-ubuntu-10-04 rbenv安装1.9.3-p125 rbenv global 1.9.3-p125 gem install bundler --no-ri --no-rdoc rbenv rehash

但是在上限后,rbenv不再在我的路径中了。

  rbenv: command not found

echo $ PATH:

 /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

3 个答案:

答案 0 :(得分:4)

问题是当capistrano运行时,它不会加载.profile,所以你需要手动加载rbenv。

将其添加到您的deploy.rb文件中:

set :default_environment, {
  'PATH' => "$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"
}

这应该足够了。

注意:我在我的服务器上使用Ubuntu Precise Pangolin。

答案 1 :(得分:0)

登录到您的服务器,cd到最新版本并尝试捆绑安装,看看它给出了什么错误

答案 2 :(得分:0)

原因:

  * executing "cd /home/deployer/apps/listpro/releases/20121012050310 && bundle install --gemfile /home/deployer/apps/listpro/releases/20121012050310/Gemfile --path /home/deployer/apps/listpro/shared/bundle --deployment --quiet --without development test"
servers: ["198.74.59.184"]
[198.74.59.184] executing command
** [out :: 198.74.59.184] sh: bundle: not found

您似乎没有安装捆绑包。尝试ssh并执行:

gem install bundler

也许这会有所帮助。如果没有提供更多信息,我可能会帮助您。