Bug 974632

Summary: Ruby default gem/location assumptions are "wrong"
Product: OKD Reporter: Clayton Coleman <ccoleman>
Component: ContainersAssignee: Hiro Asari <hasari>
Status: CLOSED UPSTREAM QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 2.xCC: jhonce, jkeck
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-06-28 18:24:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 974983    

Description Clayton Coleman 2013-06-14 16:53:16 UTC
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.

Comment 2 Hiro Asari 2013-06-14 20:57:56 UTC
PR is wrong.

Comment 3 Hiro Asari 2013-06-17 16:04:31 UTC
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.

See https://github.com/openshift/origin-server/pull/2865

Comment 4 Hiro Asari 2013-06-18 14:59:31 UTC
Postponing for now.

Existing gears need to be migrated.

Comment 5 openshift-github-bot 2013-06-27 14:17:56 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/651e1f606b68ed8c031f3816ba30b35a17346277
Bug 974632

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.

Comment 6 Jhon Honce 2013-06-28 18:24:09 UTC
See https://trello.com/c/71WPHuYT for status.