TurnKey Linux Virtual Appliance Library

How to upgrade Turnkey Rails to Rails 3.0.1

This is a command-line recipe for getting your Rails 3 apps running on a Turnkey Rails appliance. Be nice to have an automated way to do this, but I have to get back to ACTUALLY WRITING APPS.

Basically the secret to getting it running is to use rvm, and to listen to what rvm is telling you. This installs rvm as the root user, which I figure is fine for a VM.

I was using TKR 11.1-lucid as my base VM.

# Install curl. It's needed to install rvm the easy way. Ignore the error about the java .so:
  apt-get install curl
# Install rvm:
# Install rvm function into root's .bashrc:
   echo '[[ -s "/usr/local/rvm/scripts/rvm" ]] && . "/usr/local/rvm/scripts/rvm" # Load RVM function' >> ~/.bashrc
# Reload:
  . ~/.bashrc
# Install 1.9.2 under rvm:
  rvm install ruby-1.9.2
# Make it the default:
  rvm use ruby-1.9.2 --default
# Change to it (although the --default line probably does this):
  rvm use ruby-1.9.2-p(patchlevel)
 
# Gemset for Rails 3:
  rvm gemset create rails3
# Use that gemset:
  rvm gemset use rails3
# (Re-) Install Rails:
  gem install rails -v=3.0.1
# (Re-) Install Passenger:
  gem install passenger
# Install the necessary prerequisite library:
  apt-get install libcurl4-openssl-dev
 
Compile and install the Passenger module. First you have to find the version of Passenger that you just installed (which is in a different place from the one preinstalled in the appliance):
  find /usr/local/rvm -name passenger-install-apache2-module
 
Two paths will appear, one of them in bin and the other one in gems. Take the shorter one and copy it. For my system, the two paths were:
  /usr/local/rvm/gems/ruby-1.9.2-p290@rails3/bin/passenger-install-apache2-module
  and 
  /usr/local/rvm/gems/ruby-1.9.2-p290@rails3/gems/passenger-3.0.8/bin/passenger-install-apache2-module
 
Run that script:
/usr/local/rvm/gems/ruby-1.9.2-p290@rails3/bin/passenger-install-apache2-module
 
IMPORTANT: Grab the configuration lines at the end of the passenger install process! If you just use the default Passenger LoadModule, PassengerRoot, and PassengerRuby lines the GEM_HOME and paths won't be set up correctly, and you'll run into issues like "bundler: cannot load file". For my system, those lines were:
  LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.8/ext/apache2/mod_passenger.so
  PassengerRoot /usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.8
  PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.2-p290/ruby
 
In /etc/apache2/conf.d/passenger, replace the three corresponding lines with the new stuff you copied.
 
Set up your Rails application in /var/www/railsapp, do a bundle install, restart Apache (/etc/init.d/apache2 restart), and you're golden!
 
Feel free to contact me (f e w a y n e 'at' w i s c 'dot' e d u) if I've goobered something.

Thanks!

Wow!  You saved me a bunch of time.

Thanks.

 

 

BTW:  

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

now whines and says you should do this...

bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

 

Worked for me.

I knew I could

count on TKL community to give me the answer!  Thanks Mr. Wayne.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)