我得到了上述配置的服务器。Bundler + RVM + Passenger + Capistrano部署和缺失的宝石
这是我deploy.rb配方的重要组成部分:
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require 'rvm/capistrano'
require 'bundler/capistrano'
set :rvm_ruby_string, 'ruby-1.9.2-p290'
set :rvm_type, :system
set :bundle_flags, "--deployment"
set :default_environment, {
'PATH' => ENV['PATH'],
'RAILS_ENV' => ENV['RAILS_ENV']
}
set :stages, %w(staging production)
require 'capistrano/ext/multistage'
运行cap staging deploy
原样,导致一个错误:
* executing "cd /mnt/data-store/project/releases/shared &&
bundle install --gemfile /mnt/data-store/project/releases/shared/Gemfile
--path /mnt/data-store/project/shared/bundle --deployment --without development test"
** [out :: localhost] The --deployment flag requires a Gemfile.lock.
Please make sure you have checked your Gemfile.lock into version control
before deploying.
... rolling back ...
failed: "env PATH=... RAILS_ENV=staging rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'ruby-1.9.2-p290' -c 'cd /mnt/data-store/project/releases/shared && bundle install --gemfile /mnt/data-store/project/releases/shared/Gemfile --path /mnt/data-store/project/shared/bundle --deployment --without development test'" on localhost
的Gemfile和Gemfile.lock的是在源头控制。我先在本地运行bundle install
以生成.lock文件。但是,bundler/capistrano指向/ mnt/data-store/project/releases/shared/Gemfile,所以我只是在那里手动复制这两个文件。我确信我在这里做错了。我想它应该被自动复制。
执行的部署试(1),并没有对捆绑安装失败,它甚至在输出了
Your bundle is complete! It was installed into /mnt/data-store/project/shared/bundle
。
但是,我的一个帽子任务执行一次耙子。其结果是: *在任何源中找不到bcrypt-ruby-3.0.1 *尝试运行bundle install
。
与我的冒险出发,我发现,一旦你有.bundle/config中 BUNDLE_PATH: /mnt/data-store/project/shared/bundle
它的工作原理。 我有这个目录,可能由bundler创建,在/mnt/data-store/releases/shared/
下,所以我手动复制到rails根目录。
现在,rake/rails c工作。
bundle show twitter
显示.../shared/bundle/ruby/1.9.1/gems/twitter-1.7.1
。
但是,重新部署使我回到(1),因为.bundle目录不在那里。
具体问题:
- 我是否需要创建/手动复制.bundle /配置?
- 我需要将Gemfile/Gemfile.lock手动复制到共享目录吗?如果我添加宝石会发生什么?我应该持有两份,还是手动/编程同步它们?
- 我做错了什么?
谢谢!
谢谢!我仍然不明白为什么'current_release'指向共享路径而不是实际版本。 – elado