Tuesday, November 2, 2010

At a Glance To-do List for Running Rails 2 and Rails 3 on the Same Linux Server

This is geeky. You've been warned.

Environment: Rails 2.3.5 app - redmine,our internal project management tool, in our case - running on Ubuntu 10.04.
Requirement: Install a Rails 3 app - our new corp web site in this case. Goodbye, Wordpress, hello home-grown RoR happiness.

Note: this will down your rails 2.3.5 app briefly.

  1. Make sure your core libs are up to date:
    1.  apt-get install libyaml-ruby
    2.  apt-get install libzlib-ruby
  2. Update rubygems. Ubuntu won't let you using "gem install rubygems", so do this instead:
    1. gem install rubygems-update
    2. rubygems-update
  3. Install bundler
    1. gem install bundler
  4. Install Rails 3. This will take a few minutes.
    1. gem install rails
  5. Go to your Rails 3 app directory and run:
    1. bundle install
  6. Reload apache (optional)
    1. /etc/init.d/apache2 reload OR service apache2 reload
  7. Your old Rails 2 app will now be down and your new Rails 3 app is running. Now we reinstall Rails 2. Bundler lets these coexist peacefully:
    1. gem install rails -v=2.3.5
  8. Reload apache. 
    1. /etc/init.d/apache2 reload OR service apache2 reload
Check your work by accessing both of your applications. Voila!