Bug 974632 - Ruby default gem/location assumptions are "wrong"
Summary: Ruby default gem/location assumptions are "wrong"
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: OKD
Classification: Red Hat
Component: Containers
Version: 2.x
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: ---
Assignee: Hiro Asari
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks: 974983
TreeView+ depends on / blocked
 
Reported: 2013-06-14 16:53 UTC by Clayton Coleman
Modified: 2015-05-14 23:12 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-06-28 18:24:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

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.


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