[chef] Re: knife bootstrap alter gem path


Chronological Thread 
  • From: Benoit Caron < >
  • To: Bryan McLellan < >
  • Cc:
  • Subject: [chef] Re: knife bootstrap alter gem path
  • Date: Wed, 23 Nov 2011 13:06:06 -0500

On Wed, Nov 23, 2011 at 12:50 PM, Bryan McLellan < "> > wrote:
On Wed, Nov 23, 2011 at 11:39 AM, Benoit Caron < "> > wrote:
> Comparing the config of my two servers, I see that my original VM had :
>   - GEM PATHS:
>      - /var/lib/gems/1.8
>      - /home/ubuntu/.gem/ruby/1.8
> and my chef-ized now have:
>   - GEM PATHS:
>      - /usr/lib/ruby/gems/1.8
>      - /home/ubuntu/.gem/ruby/1.8
>  So:
> - Why is Chef altering the gem path?
> - Gem newbie question: How can I fix this? What is the "correct" way to
> manage this system-wide? Adding a GEM_PATH environment variable in
> /etc/profile? Or is there a better way?

From the paths, I presume you're using Ubuntu which relies heavily on
packages from the Debian project which adheres pretty strictly to its
collective interpretation of the Filesystem Hierarchy Standard (FHS).
The FHS specifies that /usr should be able to be mounted read-only and
shared to network clients. The version of Rubygems that ships with
Debian and Ubuntu install to /var as it is debian policy that all
files under /usr be managed by a debian package; as rubygems installs
additional files (the gems) outside of the packaging, it is moved to
/var [1]. This is the cause for the disputed location of binaries in
/var/lib/gems/1.8/bin [2], although in Wheezy and later,
/usr/local/bin will be used.


Yes, this is on Ubuntu 10.10. 
 
Historically the versions of Rubygems shipped with Debian and Ubuntu
were too old and had too many bugs for reliable use with Chef, so
we've recommended installing Rubygems from source. The default knife
bootstrap template installs Rubygems from source [3], which defaults
to installing in /usr/lib.


Ok, make sense: that's what I usually do. This server was setup before my move to Chef.

 
The "correct" installation method becomes a matter of preference. If
you prefer debian packages, you could modify a bootstrap template from
the one included for installing on Ubuntu 10.04 (Lucid) using our apt
repository [4]. You can create custom bootstrap templates and specify
them to the knife bootstrap command using the '-d DISTRO' flag.
Additional information on where to locate these files is available on
the wiki:

http://wiki.opscode.com/display/chef/Knife+Bootstrap


Good to know: with only one node (that will soon be rebuild) it does not make much sense, but in the future it can be usefull.

For the record, I've fixed my problem by simply adding:

   SetEnv GEM_PATH /var/lib/gems/1.8:$GEM_PATH

in /etc/apache2/mods-enabled/passenger.conf

Thanks a lot for all the references!

Benoit




Archive powered by MHonArc 2.6.16.

§