title: RVM and Bundle in production
body: <p>I'm in the process of upgrading my rails app originally in ruby 1.8.7 and rails 2.3.5 to ruby 1.9.2 and rails 2.3.12, and trying to use RVM and bundler, expecting the migration would be easier. Everything works great on my local machine, but I'm having a very hard time using RVM and deploy my bundle in production.</p>
  
  <p>First of all, I'm not sure whether RVM loads my default environment correctly. I did a multi user install with my root user. Then I typed:</p>
  
  <blockquote>
    <p>rvm --default use 1.9.2</p>
  </blockquote>
  
  <p>and added:</p>
  
  <blockquote>
  <pre><code>[[ -s "/usr/local/rvm/scripts/rvm" ]] &amp;&amp; ."/usr/local/rvm/scripts/rvm"
  </code></pre>
  </blockquote>
  
  <p>to my root user ~/.bash_profile, but when I open a new shell, and type "which ruby", it links to "/usr/local/rvm/bin/ruby". When I type "rvm default" then "which ruby", I get "/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/ruby" as expected. So I'm not sure RVM is installed and configured properly.</p>
  
  <p>Then, my bundle is installed in (I believe) in:</p>
  
  <blockquote>
    <p>"/home/web-app/www/shared/bundle"</p>
  </blockquote>
  
  <p>and when I type "bundle list" I can see the gems I installed (including my rails 2.3.12). But when I do "gem list" I only see:</p>
  
  <pre><code>*** LOCAL GEMS ***
  
  bundler (1.0.18) 
  daemon_controller (0.2.6) 
  fastthread (1.0.7)
  passenger (3.0.8) 
  rack (1.3.2) 
  rake (0.9.2 ruby)
  </code></pre>
  
  <p>The gems from my bundle are not part of the list. So right now, on my live site (sigh), passenger can't find Rails 2.3.12 (accessible from the bundle, not in Local Gems). Not sure how to tell passenger there are some gems available in the shared/bundle folder... </p>
  
  <p>Would love some help!</p>
  
  <p>-- 
  EDITS:</p>
  
  <p>1: I hadn't install passenger the right way. I used </p>
  
  <blockquote>
    <p>sudo passenger-install-apache2-module</p>
  </blockquote>
  
  <p>Using "sudo" caused the install to happen on my system ruby, not on the RVM one. Once I ran the command <strong>WITHOUT sudo</strong>, the console gave me the right lines to insert into my apache2.conf file, and I was able to start my server. Good first step, but now I can't start thinking-sphinx: it complains it can't find Rails 2.3.12...</p>
  
  <ol>
  <li>By default, Rails 2.3 only loads gems from the Gemset. I had to add a little code to tell my application to load the bundled Gems as well, as explained <a href="http://gembundler.com/rails23.html" rel="nofollow">here</a>.</li>
  </ol>