Bug 974632 - Ruby default gem/location assumptions are "wrong"
Ruby default gem/location assumptions are "wrong"
Product: OpenShift Origin
Classification: Red Hat
Component: Containers (Show other bugs)
Unspecified Unspecified
unspecified Severity medium
: ---
: ---
Assigned To: Hiro Asari
libra bugs
: FutureFeature
Depends On:
Blocks: 974983
  Show dependency treegraph
Reported: 2013-06-14 12:53 EDT by Clayton Coleman
Modified: 2015-05-14 19:12 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-06-28 14:24:09 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Clayton Coleman 2013-06-14 12:53:16 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.
Comment 2 Hiro Asari 2013-06-14 16:57:56 EDT
PR is wrong.
Comment 3 Hiro Asari 2013-06-17 12:04:31 EDT
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 10:59:31 EDT
Postponing for now.

Existing gears need to be migrated.
Comment 5 openshift-github-bot 2013-06-27 10:17:56 EDT
Commit pushed to master at https://github.com/openshift/origin-server

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 14:24:09 EDT
See https://trello.com/c/71WPHuYT for status.

Note You need to log in before you can comment on or make changes to this bug.