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.

About these ads

Tags: , ,

5 responses to “Deploying with Capistrano and RVM: .rvmrc trust issues!”

  1. Giovanni Cappellotto says :

    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

  2. DGM says :

    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)

  3. exchgr says :

    You might want to update the color scheme of your code highlighter. Underscores are so faintly grey that they look like whitespace.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: