How to Configure Capistrano to Use My Rvm Version of Ruby

How do I configure capistrano to use my rvm version of Ruby

The rvm-capistrano gem is the best way to go.

Link to the official detailed usage of that gem. From that I am guessing this will get the local version of Ruby:

set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"") # Read from local system

Changing Ruby and Rails version with capistrano and rvm

In Rails.root create file with name .ruby-version and following content:

2.3.3

or whatever version you want. When you or capistrano cd to root folder rvm will change ruby version according to file's content

How to get Capistrano 3 to use RVM ruby?

I don't think you understand how capistrano-rvm works.

Here's the relevant code

capistrano-rvm works by figuring out the location of your RVM installation, and then prefixing your capistrano commands with the relevant mapped commands. The command-map is part of SSHKit.

Capistrano-rvm by default maps gem rake ruby bundle to an rvm-prefixed version. What this means is that whenever capistrano encounters a command, e.g. in the form of execute :bundle it will replace it with, e.g. ~/.rvm/bin/rvm 2.1.1 do bundle

You've completely side-stepped that entire mechanism in your contrived execute_interactively command that specifies the command in-line. In fact, you've completely side-stepped the beauty of capistrano as a whole by setting up your own SSH session!

Also the whole set :default_env, { rvm_bin_path: '~/.rvm/bin' } is not at all needed, that's the reason you're using the capistrano-rvm gem.


As for why cap production rvm:check is displaying system is because the term system is overloaded in this case. What you think it means in this context is "what kind of rvm setup scheme is this, a /usr/local/rvm installation or a ~/.rvm installation"

What it actually means is from this code, i.e. it checks the ruby version that's listed in RVM as the current ruby, which the default installation of ruby on a server is known as the system ruby

Capistrano using wrong ruby version after rvm update

Had to do the following to get it working...

sudo chown -R your_user /home/deployer/.rvm
gem install bundler

Then run capistrano script.

Capistrano RVM and Ubuntu RVM is not a function, selecting rubies with 'rvm use ...' will not work

In my deploy.rb file, setting this line:

set :bundle_dir, "/usr/local/rvm/gems/ruby-1.9.3-p392"

before this line:

require 'bundler/capistrano'

seemed to help bundler know where to install the gems. Not sure why this is needed. I've never needed it before.

Capistrano deploying to system wide RVM not seeing installed Rubies

This WARN about not installed ruby is a misleading msg, it should say could not find ruby@gemset pair. If you would use this command on server:

rvm use 1.9.2@MY_APP

You would see the messages in reverse order - first error that the gemset can not be found, to solve it please go to server and run:

rvm --create use 1.9.2@MY_APP

Which will create a gemset for you, if you need any more help with it please contact IRC channel #rvm on FreeNode servers.



Related Topics



Leave a reply



Submit