Possible to run rails 1.2.x and 2.0.x on the same host?

0 views
Skip to first unread message

Ed

unread,
Aug 12, 2008, 1:23:17 PM8/12/08
to Deploying Rails
Hello,

Does anyone have experience running multiple versions of rails on a
single host? Is this even a reasonable suggestion?

Thanks.

Jamie van Dyke

unread,
Aug 13, 2008, 4:13:32 PM8/13/08
to rubyonrails...@googlegroups.com
I run multiple Rails version on my server, by specifying the version
my app requires in the environment.rb file, I have no issues. The
alternative (which I usually do) is to freeze the Rails version that
your app uses to the vendor folder.

Hope that helps.

-- Jamie van Dyke
-- Parfait

Aníbal Rojas

unread,
Aug 14, 2008, 7:23:02 AM8/14/08
to Deploying Rails
Ed,

Follow Jamie's advice, not only it is possible and reasonable, but
Rails is designed to support this feature. Buy the Obie's Rails Way
and check the first chapter where he explains how a Rails application
is initialized, later continue with rest of the book ;-)

Bests regards,

--
Aníbal Rojas
http://hasmanydevelopers.com
http://rubycorner.com
http://anibal.rojas.com.ve

Anthony Ettinger

unread,
Aug 14, 2008, 12:12:33 PM8/14/08
to rubyonrails...@googlegroups.com
Are there any good references of what the freeze process is used for, and why?

I found the Deployment book to fall a little short on freezing.

I've tried freezing, and it appears to have deleted everything in the
path, when I do an svn update, I get it all back.

Also, the architecture of deployment with respect to ruby (and also
rails) independtly.

I'm a little confused on where the framework lives, is the Rails
version I use part of my deployment, or is that provided by the ISP on
their server?

I'm pretty sure I'm stuck with whatever ruby version they install,
unless I install my own.
--
Anthony Ettinger
408-656-2473
http://anthony.ettinger.name

Aníbal Rojas

unread,
Aug 15, 2008, 9:50:23 AM8/15/08
to Deploying Rails
Anthony,

On Aug 15, 11:12 am, "Anthony Ettinger" <ettin...@gmail.com> wrote:
> Are there any good references of what the freeze process is used for, and why?

$ rake -D rails:freeze:edge
(in /home/anibal/sandboxes/cb-claimchaser-trunk)
rake rails:freeze:edge
Lock to latest Edge Rails, for a specific release use
RELEASE=1.2.0

$ rake -D rails:freeze:gems
(in /home/anibal/sandboxes/cb-claimchaser-trunk)
rake rails:freeze:gems
Lock this application to the current gems (by unpacking them into
vendor/rails)

If you have have in your development box different rails applications
tied to different rails versions you will need to freeze so each
application uses the freezed rails version under vendor/rails folder.

If you don't have control on what rails gems are installed you should
not take chances and freeze rails before ever thinking on deploying.

> I found the Deployment book to fall a little short on freezing.
>
> I've tried freezing, and it appears to have deleted everything in the
> path, when I do an svn update, I get it all back.

Please add more info here.

> Also, the architecture of deployment with respect to ruby (and also
> rails) independtly.

These are two different things,it would be unusual having trouble with
your Ruby version.

> I'm a little confused on where the framework lives, is the Rails
> version I use part of my deployment, or is that provided by the ISP on
> their server?

When a Rails based applications initializes it can use a a specific
Rails version available as a gem, or use the same libraries located
under vendor/rails

> I'm pretty sure I'm stuck with whatever ruby version they install,
> unless I install my own.

if you are not running your own VPS or Dedicated Server, I would not
recommend trying to install your own Ruby version, it requires
building from source, fixing paths for the build and setting up
environment variables, it is possible, but it is a lot of work if you
don't have the skills.

Good luck,

Ben Hoskings

unread,
Nov 6, 2008, 7:39:52 AM11/6/08
to rubyonrails...@googlegroups.com
Freezing isn't the best way, there's a much simpler method.

1) Define the version of Rails your app requires in config/
environment.rb. For example, one of the apps I've worked on this week
has
RAILS_GEM_VERSION = '2.1.2' unless defined? RAILS_GEM_VERSION

2) For each app you're running on the server, install that version's
gem to the system like normal. For the above app, I'd do a
sudo gem install rails --version='2.1.2'

The app then selects the correct gem when it is started. You can have
as many different versions of Rails installed to the system gem path
as you like:

ben@zaphod ~ $ ls -1d $GEMS/rails*
/opt/local/lib/ruby/gems/1.8/gems/rails-1.2.5
/opt/local/lib/ruby/gems/1.8/gems/rails-2.0.2
/opt/local/lib/ruby/gems/1.8/gems/rails-2.1.0
/opt/local/lib/ruby/gems/1.8/gems/rails-2.1.1
/opt/local/lib/ruby/gems/1.8/gems/rails-2.1.2
/opt/local/lib/ruby/gems/1.8/gems/rails-2.2.0
ben@zaphod ~ $

I'm not sure whether rake gems:install handles this step; if it does,
then things are even simpler.

3) Done.

Ben Hoskings

Stoyan Zhekov

unread,
Nov 6, 2008, 9:10:29 PM11/6/08
to Deploying Rails
I'm using GIT to keep all Rails versions and I'm exporting the needed
one in proj/vendor/rails:

http://tt.zhekov.net/post/51803697/switching-between-several-rails-versions
Reply all
Reply to author
Forward
0 new messages