Once a year or so, I need to update a few rails apps. This means that while I know the ruby language... I forget and don't keep up with the best practices of setting up the rails environment on osx 10.6.7. In the past year I got a new mbp... so I need to reconfig everything. One of the apps is 2.0.2 and two other apps are 2.3.x... so I'd like to also upgrade these as I make changes to them. I've heard good things about homebrew and pow so I installed those. And all would be well if I was writing a new app from scratch... but how do I run a rails v.2.0.2 app with this setup?
There is no way to run a rails 2.0.2 app with pow, unfortunately. Pow is a tool for running rack apps, and rails wasn't build on top of rack until version 2.3.
Related
I have a project on old framework Rails 2.3.5 & ruby 1.8.6 ,which is running on window 7 and Server mongrel.
Now i want to upgrade rails framework to rails 5 on Linux platform.
Is there any tool available for this. as manual work is too long process.
No. There is no tool to do upgrade 2.3.5 to 5. Neither can this be done in 1 step. If you don't want to rewrite from scratch or pay a 3rd party for it, assign enough time to it and start upgrading version by version.
It can be accomplished, just requires a lot of patience.
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 have a few Rails apps, each running on their own server. They run under Passenger-apache, and currently under ruby 1.9.3. Currently, they run under a ruby installed and managed with rbenv.
I'd like to upgrade them all to ruby 2.2.x. As long as I'm doing this, I'd like to upgrade them from passenger 4.x to 5.x as well.
Let's assume I've tested them all on my development box and am confident they run fine under ruby 2.2.
As I think through this, I get very confused about the best way to do this -- especially with minimal production downtime.
I guess I'd start out by installing ruby 2.2 under rbenv, which theoretically shouldn't disturb the running apps. Passenger is installed under a particular ruby, but then has the option of running apps under different rubies. Should I install the latest passenger first, under the new ruby 2.2, but configured to run the existing apps under the old ruby? And then upgrading the apps to the new ruby... I guess involves running bundle install again, to get all dependencies installed under the new ruby?
Or something else entirely? Is there a way to do this that is relatively safe, and will have limited or zero downtime for my apps?
Has anyone done this before? I'm fairly familiar with all the pieces already, and can brainstorm possible approaches myself, but when I start, there are too many places where I'm not sure what the best approach is. What I could really use is advice from someone who has already done this, or is otherwise pretty sure that what they recommend will work as they say -- not just guesses about things you haven't done that might work. Thanks!
Make sure that your applications work under the new ruby version. I have had some legacy Rails 3.2.x applications that works up to ruby 2.1.5, but breaks in ruby 2.2.x. You should be fine with updating your ruby and passenger versions.
Since each application runs on their own server, you don't have to really worry about running multiple versions of passenger. You should be able to install the new version ruby on each server, install the gems, update apache to the newer passenger and restart apache to have everything take effect. Worst case, you can clone your servers to a virtual environment and test everything prior to doing it on production. This would help you minimize downtime as you would have any workarounds and/or research of bugs done prior to touching the production environment.
I upgraded to the latest Rails v3.1.3. And everything is fine, I'm able to run the 2.3 version of one website and the app for v3.1.3.
However I couldn't move it to a new machine, I installed all the required gems with
bundle install
and just cannot start Thin with the 2.3.2 version. I can only run the v3 apps. Thanks
Go read about RVM, and try to configure you machine according to the instructions given there.
As #Syed Aslam said the ideal way of doing is using RVM, but you may set bundler to your Rails 2.x project (because rails 3.x already have bundler..) and run both your projects in the same machine (actually currently I'm doing that).
Following is a tutorial how setting up bundle with Rails 2.x.