We are currently testing different Ruby versions (1.8 and 2.0). Ruby 1.8 is the system Ruby and 2.0 is installed via RVM.
For a variety of reasons, we do not want to move 1.8 to RVM in the fear of breaking things. We want to move to Ruby 2.0 throughout and, for testing, we need a way so that we can easily switch between Ruby 2.0 and 1.8 on our staging servers which is managed by Passenger.
Are there any good guides for doing the same?
The easiest way is probably to simply specify which Ruby you want Passenger to use. In 4.0.0 or later you can do this on a global basis with PassengerDefaultRuby, or it can be in the virtual host config on a site by site basis using PassengerRuby. Both of these options simply take the path to the ruby binary you wish to use. Documentation can be found here: http://www.modrails.com/documentation/Users%20guide%20Apache.html#PassengerRuby
Note that you will have to restart Apache after making these config changes.
Related
What happen if i use ruby version 2.5.1 with rails version 2.3.18 ?
I had rails application built on rails 2.3.18 and ruby 1.9.2p320,
I want to upgrade version of ruby only not the rails is it possible ?
What are the challenges i have to face with this ?
GitHub maintain a public fork that has branches for older Rails versions, with various changes, that they've been running over time. For some time, they were running older Rails releases on newer Ruby versions than they were originally supported on, so you might find some useful hints around what needs backporting there. They haven't used 2.3 for a few years now, though, so at best it will make less work.
In general, Ruby versions make few incompatible changes, but with a codebase the size and variety of Rails, most of those few changes do hit somewhere. This seems like a bad idea to me: any security fixes in newer Ruby versions, for example, will be vastly outweighed by the known vulnerabilities in such an old Rails release.
If you're doing this because your application uses the system Ruby and you're upgrading/replacing the OS, I would instead suggest using rbenv / chruby / ruby-build / ruby-install to install the old version for this app.
It should go without saying that running such an old Rails version is highly discouraged, and exposing it to the Internet is outright dangerous -- but I'll say it anyway.
Rails LTS apparently provides a service backporting security fixes to Rails 2.3, which may make it slightly safer. They also seem to currently support running Rails 2.3 with Ruby 2.3; while that's not 2.5, it might get you closer, or be good enough.
Given we use a preferred flavour of a ruby version manager (RVM or Rbenv) the ruby gems are isolated per ruby version.
Let's say we want to work on multiple applications locally (they are completely separate applications) and we want to use the same ruby version and the same rails version how do we properly isolate them and their gems? Are gemsets the (only) answer here? I mean if I have 5 applications with the same ruby version and I keep adding gems on all 5 fronts it's just a matter of time when one of the applications is ok with the latest stable gem version while one of the apps will still need to roll on an older version of the same gem due to legacy dependency or whatnot. How do you guys avoid this timebomb?
What if we want to use the same ruby version on multiple apps but a different Rails version? Rails being 'just a gem' is the answer same as for the above?
Thanks.
I'd recommend to use:
rbenv to handle multiple ruby versions on the same machine
bundler to define the dependencies of each application
Make sure to push .ruby_version, Gemfile and Gemfile.lock to make sure every is using the appropriate version of each gem...
I just created a cool web app on my Mac using Ruby 2.2.3p173 and Rails 4.2.5.
The place where I would like to host it only has up to Ruby 2.0.0 and Rails 4.2.4 installed on their shared hosting platforms.
What should I do? Can I downgrade Ruby and Rails? If so, what is the best way to go about it?
Thanks
Porting your app to an older Ruby and Rails would be a bad idea. Not only would you be exposing yourself to security holes that have been fixed in more recent releases (Ruby 2.0 will be end of lifed on February 24, 2016, and there have been important security patches since Rails 4.2.4), you would be swimming against the continuous pressure to upgrade exerted by the other gems you might want to use, documentation, etc.
There is probably nothing preventing you from installing a current version of Ruby in your own account on the hosting provider using a version manager like rbenv or rvm. (I recommend rbenv.) You are also probably free to install any gems you like (probably with bundler), including current versions of Rails.
If that hosting provider does prevent you from using or installing a newer Ruby or Rails, find a different hosting provider. That one will fail soon enough anyway.
I want to develop a website using Ruby on Rails.
What is the requirements for the Server, i.e. what do I have to tell the admin what I need. I believe the server will be running on a machine that is already hosting some websites which use PHP. I dont know more about that so far, and it will probably be depending on my requirements.
As far as I understood from documentation and other questions the server needs to have ruby, rails installed. It also said that I could use cgi.
My problem is that I need a concrete list of things that my admin should provide.
Another question suggests that the only thing is to intall Phusion Passenger if I can use an Apache Werbserver. This would seem like an option maybe.
So what do I really need?
Phusion Passenger is the easiest way to go in a mixed environment.
A Rails app needs these things:
ruby (ruby enterprise edition or MRI 1.9.2)
rubygems
sort of gems handled with bundler
You should try it with Passenger on Your local computer. Then you will see the list for the installation.
I have some production Rails 2 apps. I want to start using Rails 3 and Ruby 1.9 for new apps I develop.
I'm using Passenger and Apache with REE (Ruby 1.8.7). I don't vendor anything -- I install gems on the system level and specify versions per app in environment.rb.
If understand it right, the problem is not so much the Rails and other gem versions (because each app can specify their own in environment.rb), but whether my Rails 2 apps and their gems will run under Ruby 1.9.
Do I have that right?
Based on Googling it appears that there may actually be a problem with some gems like Searchlogic and Ruby 1.9.
If so what would be the recommended solution?
I have looked into RVM and it looks fantastic for testing, experimentation, and development. But it doesn't look like it was designed help with a production setup.
As I understand it, when you install Passenger you compile it against one particular version of Ruby. That Ruby can be under RVM no problem, but Passenger can't use different Rubies for different apps.
Look into RVM (Ruby Version Manager). You can manage multiple ruby versions on the same box, and multiple gemsets for each.
http://beginrescueend.com/
Additionally, Bundler allows projects to maintain their own libraries of gems (and for me at least, obviates the need for using RVM gemsets)
http://gembundler.com/
Check the following link for Hongli Lai from Phusion explaining how to set up Passenger running on multiple versions of Ruby simultaneously by using Passenger standalone and reverse proxy.
http://blog.phusion.nl/2010/09/21/phusion-passenger-running-multiple-ruby-versions/