Reputation: 55
I am deploying in a multiuser, multiserver environment (Site5).
I am deploying a rails 4 app. The default environment is ruby 1.8.7, rails 3.0.
There is access to local versions of ruby,
Things are working until the bundler is called.
Here's the error snippet:
INFO [4439d586] Running /usr/bin/env bundle install --path /home/username/apps/todos/shared/bundle --without development test --deployment --quiet as [email protected]
DEBUG [4439d586] Command: cd /home/username/apps/todos/releases/20160121174533 && ( export RUBY_BIN_PATH="/usr/local/ruby20/bin" PATH="/usr/local/ruby20/bin:/usr/username/ruby/gems/gems/bundler-1.11.2/exe:$PATH" ; /usr/bin/env bundle install --path /home/username/apps/todos/shared/bundle --without development test --deployment --quiet )
DEBUG [4439d586] Gem::InstallError: i18n requires Ruby version >= 1.9.3.
DEBUG [4439d586] An error occurred while installing i18n (0.7.0), and Bundler cannot continue.
Make sure that `gem install i18n -v '0.7.0'` succeeds before bundling.
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as [email protected]: bundle exit status: 5
bundle stdout: Gem::InstallError: i18n requires Ruby version >= 1.9.3.
An error occurred while installing i18n (0.7.0), and Bundler cannot continue.
Make sure that `gem install i18n -v '0.7.0'` succeeds before bundling.
bundle stderr: Nothing written
As you can see, I am setting environment variables before the bundle command is called.
So, here's what I've figured...
Because Capistrano 3 is executing everything with /usr/bin/env
and /usr/bin/env bundle install ...
in particular, it is not finding the correct version of bundler to use.
[email protected] [~2]# /usr/bin/env bundle -v;whereis bundle
Bundler version 1.2.1
bundle: /usr/bin/bundle
(Note: /usr/bin/env is linked to /bin/env )
I have installed the current user of bundler (gem install bundler
) which is now in ~/ruby/gems/gems/bundler-1.11.2 with executable script at ~/ruby/gems/gems/bundler-1.11.2/exe/bundle
So? Now What?
1) How can I get this version of bundler to execute?
2) Also, inside the script it calls #!/usr/bin/env ruby
. Should I change this to the correct ruby path?
3) I saw this solution for Cap 2 elsewhere:
set :bundle_cmd, "/usr/username/ruby/gems/gems/bundler-1.11.2/exe/bundle"
set :bundle_dir, "/usr/username/ruby/gems/gems/bundler-1.11.2"
So the question remains: How do I change the bundler called in Capistrano 3?
(Finally: Can this be solved without rvm?)
Upvotes: 0
Views: 819
Reputation: 11082
In Capistrano 3 there is a concept of a "command map" that lets you override the string used for any arbitrary command. In the case you want to map bundle
to /usr/username/ruby/gems/gems/bundler-1.11.2/exe/bundle
, let's say.
You do that like this:
# Put this in deploy.rb or production.rb, etc.
SSHKit.config.command_map[:bundle] = "/usr/username/ruby/gems/gems/bundler-1.11.2/exe/bundle"
Upvotes: 1