Installing Ruby Version Manager AFTER ruby on rails installation - ruby-on-rails

This might be a paranoid question, but am I likely to break anything in my ruby on rails app if I install RVM AFTER having installed rails?
Thanks in advance for any peace of mind you can offer me :P

Your App will be fine - but after installing RVM it will take some configuration get everything running back the way it was. This has nothing to do with your app, but with your environment. If you follow the installation instructions EXACTLY then it will not be too difficult.
If you are planning to do this on a production server then be prepared for some downtime.

Related

Accidentally installed Rails under sudo without RVM. How to move Rails installation and gems to RVM without breaking applications?

So I wish I had known far before that installing Rails with sudo was a bad thing. In fact, after doing my research, it appears that most people would agree that installing any type of package manager as sudo is a big no-no.
Unfortunately for me, I found this out a bit too late. I have several Rails applications that I have created and I am worried that If I try to reinstall Rails with RVM that my applications will not work because of dependency issues.
When I would install gems with bundle install, if the gem was new, Rails would ask for my password before installing it. I did not think much of it at the time, but now, I am worried nothing will work after I try booting a Rails app.
So my questions are:
If I installed Rails with sudo, will my applications still work if I reinstalled it under RVM?
If they don't work, what would I need to make them function correctly?
How do I remove a Rails installation that was installed with sudo?
Is this issue as severe as I think it is?
I had seen a lot of related posts about why one should not use sudo to install gems and Rails in general, as well as why not to do it with RVM, and pretty much not to do it all with anything Ruby related. But I have not seen a post that really addresses any of my concerns and questions that I mentioned above.
No it's not severe as you think. Applications are meant to be portable (somewhat), once you have the same dependencies installed as your development machine, they are meant to work again otherwise you wouldn't be able to deploy.
Now the main thing to check is that all your files in your rails applications are owned by user and not by sudo (otherwise you won't be able to read them later on).
Aside from it, you can simply install rvm, ensure with which ruby and which gem comes from rvm and not from your packaged ruby installation (which you can remove, I do this usually) and then simply run bundle install in your rails application, at that point they are ready to start again.

Upgrading ruby on a production server with Rails and Passenger

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.

Updating Ruby version to newer (latest) on production?

We use Ubuntu 12.04 TLS, Ruby 1.9.3, Rails 3.2.12, and RVM on our production server.
We want to upgrade Ruby from 1.9.3 to 2.2 (or whatever the latest one is), without updating Rails.
I have three questions:
Are there any caveats in doing that, any inconsistensies, deprecated methods? Is there any chance that site will stop working?
Considering that we are using RVM, would it be possible to get back to the version we are using right now (if anything goes wrong)?
Would it be necessary to re-install all the gems that we are using right now?
Thanks in advance!
Always presume the whole machine is going to be trashed beyond repair by this process. Prepare for the worst, hope for the best. If you don't have a test machine, you can build one with a tool like Vagrant. Once you have a procedure that works, repeat it on your production system.
Ruby 2.1.1 is the current version. You'll also want to look at upgrading Rails itself to avoid a bunch of nasty vulnerabilities. 3.2.17 is the version to target here.
RVM does make it easier to upgrade things, but you'll also need to upgrade your launcher (e.g. Passenger) to use the newer Ruby version. Yes, it is possible to back out, but this is not always convenient.
One trick that might help rescue from disaster is checking your /etc directory into a local Git repository. This allows you to rollback any configuration changes you make, as well as see what changes you've actually made through the course of your upgrades.
Any change to the base Ruby version does require re-installing all gems. If you're using Bundler or an automated deployment tool this should be fairly automatic.

Ruby On Rails Install

I've spent some time in web development and since I have decided that ruby is quite a nice language to code in I want to try the reason why some people say ruby got known : Rails
I installed rails in my linux machine however I am now trying to develop it in Windows. I know that it was recommended to install rails using RVM in linux however I'm not sure what is the best way to install it in Windows since I've read articles which said that
gem install rails
is a method which will cause you lots of bugs in both linux and windows
My question to you is what is a method which is "bugless" to install rails in windows?
Is
gem install rails
actually buggy?
Yeah, installing Rails on Windows is a little more complicated, but that's why they have bundles for it.
Go here and follow instructions.
http://railsinstaller.org/en

Trying to get Ruby/Rails installed on OSX Mountain Lion

This is my first question please be nice.
I've been trying to get my hands dirty with ruby/rails for a small coding project. I have Mountain Lion, and have been trying to use various techniques i've found on stackoverflow, and across the interwebs. It's not going so great! Nothing works of course. I have the system version of Ruby (1.8.7) as of now, and a bunch of broken junk from trying and failing to install Ruby!
When I install Rails via gem install, it sat for awhile... I finally learned to use -V, and noticed everything was returning back 302, and this takes forever, and finally it installs -- I get this output when I try to run rails -v
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:230:in `activate': can't activate rack (~> 1.4.5, runtime) for ["actionpack-3.2.13", "railties-3.2.13"], already activated rack-1.5.2 for ["rack-ssl-1.3.3", "railties-3.2.13"] (Gem::LoadError)
It looks like some dependencies are broken? Anyhow I'm now trying to use RVM now to get another version of ruby and setup grails with brew, This is telling me that I need a newer version of ruby to install anything pretty much?? Here is the output.
rvm install 1.9.2-head
Installing requirements for osx, might require sudo password.
Skipping brew update make sure your formulas are up to date.
Cowardly refusing to continue, please read 'rvm autolibs'.
To proceed rvm requires a ruby-1.9|ruby-2 compatible ruby is installed.
We attempted to install ruby automatically but it failed.
Please install it manually (or a compatible alternative) to proceed.
-- I am getting os frustrated here, please throw me a bone and help me out --- If I have to have to I'll setup a linux vm just to get rails running -- yet I prefer working on my mac.
Please any advice?? I just want a working version of Rails 3 on my Mac this is allThanks in advance
Please go through www.railsinstaller.org for detailed installation and setup process. This guide should answer all of your questions.
Have you tried this tutorial http://net.tutsplus.com/tutorials/ruby/how-to-install-ruby-on-a-mac/
The tutorial includes all the errors you may come across during the installation.
According to this tutorial Ruby on Rail comes with the mac out of the box.
Have you tried JewelryBox? It provides a painless install method for rvm and a great little gui that helps you monitor the size of your gem sets, and installs of ruby. Along with helpful reminders to upgrade rvm. I resisted at first using it, because using a GUI made me feel like a noob, but it really is a great little tool, that makes for super easy installs of ruby, and rvm, and consequently rails.
http://jewelrybox.unfiniti.com/

Resources