我正在尝试使用Capistrano部署rails app . 部署应用程序,运行捆绑安装
〜/ .rvm / bin / rvm默认执行bundle install --path / home / pro / www / shared / bundle --without development test --deployment --quiet
但是当我运行应用程序时,它使用默认的gemset而不是来自shared / bundled的gem . 我收到了以下错误
Message from application: <p>It looks like Bundler could not find a gem. Maybe you didn't install all the gems that this application needs. To install your gems, please run:</p>
Could not find rake-11.2.2 in any of the sources (Bundler::GemNotFound)
<pre> /home/pro/.rvm/gems/ruby-2.3.1@gemset/gems/bundler-1.12.5/lib/bundler/spec_set.rb:95:in `block in materialize'
我不是在这里理解这个问题 . 我的deploy.rb文件有:
set :application, 'rails_a[['
set :repo_url, 'git@bitbucket.org:user/app.git'
# set :rvm_ruby_version, 'ruby-2.3.1@gemset'
设置:阶段,%w( 生产环境 )设置:deploy_to,'/ home / pro / www'
2 回答
问题可能在于您的配置 . 由于rvm根据ruby版本设置
$GEM_HOME
env变量,并且bundler将其路径(即BUNDLE_PATH
)默认为$GEM_HOME
(至少在开发中) . 您可以在bundler配置中覆盖它 .在应用程序目录中 .
local
标志将保留特定于您的应用程序的更改,您还应从.gitignore
中删除.bundle
以将捆绑配置推送到部署服务器 .看一下bundle config documentation .
This也是一篇不错的博文 .
这里@ rails3.2是gemset . 当capistrano将调用bundle install时,它将采用这个gemset . 所以你需要设置rvm_ruby_string