Red Hat Bugzilla – Bug 974632
Ruby default gem/location assumptions are "wrong"
Last modified: 2015-05-14 19:12:14 EDT
The default configuration of the Ruby in gears sets the Ruby environment to expect ~/.gem as the home directory (because no GEM_HOME is set). This means that any client wishing to use Ruby in their cartridge code or app (even if their app is of a different type) is unable to properly gem install because .gem doesn't exist and isn't writable.
In the long run, there are good arguments to be made for and against writing to the root dir. Ruby with SCL correctly versions these gems (so that the directories don't collide). The best argument is going to be that multiple cartridges in a gear may use ruby and install gems that we want to be shared (ruby can handle that, some languages can't). For the cases where they are shared, it is better to use a central location. This should *not* affect how the ruby cartridge deploys and installs - it's more to allow cartridge authors to develop cartridges that use more than bash.
Solution: make .gem owned by the gear user.
Reproduce: ssh to a gear, run "gem install thor"
We probably will want to do similar things for other languages, but let's do it on a case by case basis. Eventually, we need cartridges to declare dependencies on characetristics of the node (whether they have ruby193 available, etc) but that is not yet required.
PR is wrong.
We can create ~/.gem and have it be owned by the gear user for all gears.
However, in all cases other than the Ruby 1.9, the current default Ruby version is 1.8.7, where the installation directory is set to /usr/lib/ruby/gems/1.8. It is not clear to me at the moment if this is a 1.8 issue, or the way the RPM package is configured.
In order for this to work, then, we need to set GEM_HOME explicitly to $OPENSHIFT_HOMEDIR/.gem for all gears.
Postponing for now.
Existing gears need to be migrated.
Commit pushed to master at https://github.com/openshift/origin-server
Create ~/.gem, owned by the gear user, for all cartridges.
To have user gems be installed in this directory, we now set $GEM_HOME
explicitly on all cartridges.
Subsequently, the Ruby 1.9 cartridge need not create ~/.gem.
See https://trello.com/c/71WPHuYT for status.