Deploying with Capistrano and RVM: .rvmrc trust issues!
I’ve been having some problems with my deployments since I introduced a project-specific .rvmrc file. This file IS checked into version control, because I have several machines I develop on and want them to all be the same in terms of gemsets etc.
Capistrano was successfully completing my deployment but the Rails app was not starting. Passenger could not start the application because RVM had not been told to trust the new .rvmrc file. Eh…?!
As it turns out this is a fairly easy fix. I modified my deployment recipe to contain the following:
require 'capistrano/ext/multistage'
require 'bundler/capistrano'
namespace :rvm do
desc 'Trust rvmrc file'
task :trust_rvmrc do
run "rvm rvmrc trust #{current_release}"
end
end
after "deploy:update_code", "rvm:trust_rvmrc"
All this does is run a command to tell RVM that is should trust my rvm file in the new release directory. It’s important to use current_release and not current_path here because RVM needs the actual path – RVM won’t trust a file given a symlink path.
You can also trust by default all .rvmrc files by adding this line to your rvm configuration file (~/.rvmrc or /etc/rvmrc):
rvm_trust_rvmrcs_flag=1
Thanks!
I’m getting this error, despite having rvm_trust_rvmrcs_flag=1 set in my /etc/rvmrc file.
I had it working, but I recently updated rvm (by reinstalling via the install command, rvm update didn’t work)