3

我正在关注 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 install 1.9.3-p125 rbenv global 1.9.3-p125 gem install bundler --no-ri --no-rdoc rbenv rehash

但是在 cap deploy 之后,rbenv 不再是我的路径。

  rbenv: command not found

回声 $PATH:

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

3 回答 3

4

问题是当 capistrano 运行时,它不会加载 .profile,因此您需要手动加载 rbenv。

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

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

这应该足够了。

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

于 2013-04-03T16:12:03.580 回答
0

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

于 2012-10-12T07:44:34.890 回答
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

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

于 2012-10-12T12:51:51.670 回答