1

I am trying to get a deploy working with capistrano 3 on a new server and ruby version managed by chruby.

All the tests specified in the capistrano docs work fine.

When I try to do a deploy it appears to be trying to find bundler in the system ruby rather than the chruby version that is specified in the deploy.rb with

set :chruby_ruby, 'ruby-2.1.2'

I have installed ruby 2.1.2 with ruby-install on the server and if I log in as the deploy user it apears to be using the correct ruby

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

The error from the deploy is

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 (everything below this is default)

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 (everything below is default)

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

capfile

# 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 }

UPDATE.

doing a gem install bundler on the server in the 2.1.2 environment seems to make it work but I still get the following disconcerting message in the output

DEBUG[1b6631e7]     chruby: unknown Ruby: ruby-1.9.3-p392
giorgio
  • 2,115
  • 5
  • 23
  • 39

0 Answers0