1

我正在尝试在由 chruby 管理的新服务器和 ruby​​ 版本上使用 capistrano 3 进行部署。

capistrano 文档中指定的所有测试都可以正常工作。

当我尝试进行部署时,它似乎试图在系统 ruby​​ 中找到捆绑程序,而不是在 deploy.rb 中指定的 chruby 版本

set :chruby_ruby, 'ruby-2.1.2'

我已经在服务器上安装了带有 ruby​​-install 的 ruby​​ 2.1.2,如果我以部署用户身份登录,它似乎正在使用正确的 ruby

deploy@server:~$ ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [i686-linux]

部署的错误是

INFO[8ec8ed42] Running /usr/local/bin/chruby-exec ruby-2.1.2 -- bundle install --binstubs /var/www/oentry/shared/bin --path /var/www/oentry/shared/bundle --without development test --deployment --quiet on 103.6.213.27
DEBUG[8ec8ed42] Command: cd /var/www/oentry/releases/20140810095255 && /usr/local/bin/chruby-exec ruby-2.1.2 -- bundle install --binstubs /var/www/oentry/shared/bin --path /var/www/oentry/shared/bundle --without development test --deployment --quiet
DEBUG[8ec8ed42]     chruby: unknown Ruby: ruby-1.9.3-p392
DEBUG[8ec8ed42]     /usr/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find bundler (>= 0) amongst [] (Gem::LoadError
DEBUG[8ec8ed42]     )
DEBUG[8ec8ed42]         from /usr/lib/ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
DEBUG[8ec8ed42]         from /usr/lib/ruby/1.9.1/rubygems.rb:1231:in `gem'
DEBUG[8ec8ed42]         from /usr/local/bin/bundle:22:in `<main>'
cap aborted!

deploy.rb (下面的都是默认的)

lock '3.2.1'

set :application, 'oentry'
set :repo_url, 'git@1nnn.nnn.nnn.nnn:/opt/git/oentry.git'
set :chruby_ruby, 'ruby-2.1.2'

production.rb(下面的都是默认的)

role :app, %w{deploy@nnn.nn.nnn.nnn}
role :web, %w{deploy@nnn.nn.nnn.nnn}
role :db,  %w{deploy@nnn.nn.nnn.nnn}

头文件

# Load DSL and Setup Up Stages
require 'capistrano/setup'

# Includes default deployment tasks
require 'capistrano/deploy'

# Includes tasks from other gems included in your Gemfile
#
# For documentation on these, see for example:
#
#   https://github.com/capistrano/rvm
#   https://github.com/capistrano/rbenv
#   https://github.com/capistrano/chruby
#   https://github.com/capistrano/bundler
#   https://github.com/capistrano/rails
#
# require 'capistrano/rvm'
# require 'capistrano/rbenv'
require 'capistrano/chruby'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'

# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

更新。

在 2.1.2 环境中的服务器上执行 gem install bundler 似乎可以使它工作,但我仍然在输出中收到以下令人不安的消息

DEBUG[1b6631e7]     chruby: unknown Ruby: ruby-1.9.3-p392
4

0 回答 0