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

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.


5 thoughts on “Deploying with Capistrano and RVM: .rvmrc trust issues!

  1. 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)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s