Capistrano部署rails的失败错误 - bundle:not found

时间:2013-03-13 07:48:07

标签: ruby-on-rails capistrano

这是我第一次部署并收到错误。

这是我的deploy.rb文件     要求'bundler / capistrano'     set:application,“app”

set :scm, :git
set :repository,  "git@github.com:myname/#{application}.git"
set :branch, "master"

server "198.12.78.92", :web, :app, :db, primary: true
set :user, "myname"
set :deploy_to, "/home/#{user}/public_html/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false

default_run_options[:pty] = true
ssh_options[:forward_agent] = true

 namespace :deploy do
   task :start do ; end
   task :stop do ; end
   task :restart, :roles => :app, :except => { :no_release => true } do
     run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
   end
 end

这是我得到的错误。

*** [deploy:update_code] rolling back
  * executing "rm -rf /home/myname/public_html/app/releases/20130313073408; true"
    servers: ["198.12.78.92"]
    [198.12.78.92] executing command
    command finished in 891ms
failed: "sh -c 'cp -RPp /home/myname/public_html/app/shared/cached-copy /home/myname/public_html/app/releases/20130313073408 && (echo dd92017bc8bb7f951df52d6a14c933e3033fd24b > /home/myname/public_html/app/releases/20130313073408/REVISION)'" on 198.12.78.92

编辑 - 我评论过“set:deploy_via,:remote_cache”,现在收到包:找不到错误

3 个答案:

答案 0 :(得分:19)

好的似乎答案是(见我对你的问题的评论):

在您的工作站和服务器上安装了最近的rvm(我有1.17.1)。

添加:

gem 'rvm-capistrano'

到您的Gemfile(内部组:开发为capistrano gem)

添加:

require "rvm/capistrano"
require "bundler/capistrano"

到你的config / deploy.rb

应该这样做

答案 1 :(得分:12)

如果使用rbenv将其放在.bashrc

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

在capistrano的以下行之前加载环境即使连接非交互式shell

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

也可能也适用于rvm初始化

答案 2 :(得分:10)

我遇到了同样的问题。以下是RBenv和RVM的解决方案。

<强> RBENV

正确安装RBenv。安装bundler gem。 Pefrorm'rbenv rehash'。

添加到deploy.rb或部署/ .rb

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

<强> RVM

正确安装RVM。安装bundler gem。

gem 'rvm-capistrano'

deloy.rb或deploy / .rb

require 'rvm/capistrano'
set :rvm_ruby_string, 'ruby-2.0.0-p247' # Change to your ruby version
set :rvm_type, :system # :user if RVM installed in $HOME

有关更多配置信息,请阅读:https://github.com/wayneeseguin/rvm-capistrano

祝你好运。