chef_gem clarification

Hi,

I am having an issue where I am trying to do things “right”. I have a server I
am building but the mysql gem is not installed. So I am using chef_gem to
install it. However, I have other cookbooks that need to run before chef_gem
(mainly one that installs a compiler). I have tried to use the include_recipe
to do this, but that didn’t seem to do the trick.

Any help would be appreciated.

Geoff

Have you looked at using the build-essential cookbook as well?
If you set it's node['build_essential']['compiletime'] = true then
you can have the compilers before the mysql chef_gem is installed in
compile time.

ref: http://community.opscode.com/cookbooks/build-essential

-M

On Tue, May 7, 2013 at 2:05 PM, geoffreyowen@stratalux.com wrote:

Hi,

I am having an issue where I am trying to do things "right". I have a server I
am building but the mysql gem is not installed. So I am using chef_gem to
install it. However, I have other cookbooks that need to run before chef_gem
(mainly one that installs a compiler). I have tried to use the include_recipe
to do this, but that didn't seem to do the trick.

Any help would be appreciated.

Geoff

Thanks Mike! That will do the trick!!

Geoff

On 5/7/13 1:09 PM, "Mike" miketheman@gmail.com wrote:

Have you looked at using the build-essential cookbook as well?
If you set it's node['build_essential']['compiletime'] = true then
you can have the compilers before the mysql chef_gem is installed in
compile time.

ref: http://community.opscode.com/cookbooks/build-essential

-M

On Tue, May 7, 2013 at 2:05 PM, geoffreyowen@stratalux.com wrote:

Hi,

I am having an issue where I am trying to do things "right". I have a
server I
am building but the mysql gem is not installed. So I am using chef_gem
to
install it. However, I have other cookbooks that need to run before
chef_gem
(mainly one that installs a compiler). I have tried to use the
include_recipe
to do this, but that didn't seem to do the trick.

Any help would be appreciated.

Geoff

I am having an issue where I am trying to do things "right". I have a server I
am building but the mysql gem is not installed. So I am using chef_gem to
install it. However, I have other cookbooks that need to run before chef_gem
(mainly one that installs a compiler). I have tried to use the include_recipe
to do this, but that didn't seem to do the trick.

You may not want chef_gem but gem_package

chef_gem installs the gem for use by Chef, not your system-wide Ruby.

Good point Jeff!

Thank you!

Geoff

On 5/7/13 1:58 PM, "Jeff Blaine" jblaine@kickflop.net wrote:

I am having an issue where I am trying to do things "right". I have a
server I
am building but the mysql gem is not installed. So I am using chef_gem
to
install it. However, I have other cookbooks that need to run before
chef_gem
(mainly one that installs a compiler). I have tried to use the
include_recipe
to do this, but that didn't seem to do the trick.

You may not want chef_gem but gem_package

gem_package Resource

chef_gem installs the gem for use by Chef, not your system-wide Ruby.

Revisiting this "old" thread, take a look at the mysql::ruby recipe which does all this.
https://github.com/opscode-cookbooks/mysql/blob/master/recipes/ruby.rb

Thanks,
Matt Ray
Senior Technical Evangelist :: Opscode
512.731.2218 :: matt@opscode.com
mattray :: GitHub :: IRC :: Twitter


From: Geoff Owen
Sent: Tuesday, May 07, 2013 4:30 PM
To: Jeff Blaine; chef@lists.opscode.com
Subject: [chef] Re: chef_gem clarification

Good point Jeff!

Thank you!

Geoff

On 5/7/13 1:58 PM, "Jeff Blaine" jblaine@kickflop.net wrote:

I am having an issue where I am trying to do things "right". I have a
server I
am building but the mysql gem is not installed. So I am using chef_gem
to
install it. However, I have other cookbooks that need to run before
chef_gem
(mainly one that installs a compiler). I have tried to use the
include_recipe
to do this, but that didn't seem to do the trick.

You may not want chef_gem but gem_package

gem_package Resource

chef_gem installs the gem for use by Chef, not your system-wide Ruby.

Matt,

Wow, thanks a lot! Totally what I was looking for! I can't tell you how much I appreciate this!

Thanks again,

Geoff

On May 11, 2013, at 10:08 AM, Matt Ray matt@opscode.com wrote:

Revisiting this "old" thread, take a look at the mysql::ruby recipe which does all this.
https://github.com/opscode-cookbooks/mysql/blob/master/recipes/ruby.rb

Thanks,
Matt Ray
Senior Technical Evangelist :: Opscode
512.731.2218 :: matt@opscode.com
mattray :: GitHub :: IRC :: Twitter


From: Geoff Owen
Sent: Tuesday, May 07, 2013 4:30 PM
To: Jeff Blaine; chef@lists.opscode.com
Subject: [chef] Re: chef_gem clarification

Good point Jeff!

Thank you!

Geoff

On 5/7/13 1:58 PM, "Jeff Blaine" jblaine@kickflop.net wrote:

I am having an issue where I am trying to do things "right". I have a
server I
am building but the mysql gem is not installed. So I am using chef_gem
to
install it. However, I have other cookbooks that need to run before
chef_gem
(mainly one that installs a compiler). I have tried to use the
include_recipe
to do this, but that didn't seem to do the trick.

You may not want chef_gem but gem_package

gem_package Resource

chef_gem installs the gem for use by Chef, not your system-wide Ruby.

Just expanding on Jeff's point: chef_gem and gem_package have different
purposes.

chef_gem installs the gem in chef's private ruby, so chef can connect to
MySQL. This is useful to set up the admin user's password and other initial
setup, during the chef run, for example.

Then gem_package will install the mysql gem so it's available on your
system ruby, for various scripts or applications, once the system is
provisioned.

Mat

On Saturday, May 11, 2013, Geoff Owen wrote:

Matt,

Wow, thanks a lot! Totally what I was looking for! I can't tell you how
much I appreciate this!

Thanks again,

Geoff

On May 11, 2013, at 10:08 AM, Matt Ray matt@opscode.com wrote:

Revisiting this "old" thread, take a look at the mysql::ruby recipe
which does all this.
https://github.com/opscode-cookbooks/mysql/blob/master/recipes/ruby.rb

Thanks,
Matt Ray
Senior Technical Evangelist :: Opscode
512.731.2218 :: matt@opscode.com
mattray :: GitHub :: IRC :: Twitter


From: Geoff Owen
Sent: Tuesday, May 07, 2013 4:30 PM
To: Jeff Blaine; chef@lists.opscode.com
Subject: [chef] Re: chef_gem clarification

Good point Jeff!

Thank you!

Geoff

On 5/7/13 1:58 PM, "Jeff Blaine" jblaine@kickflop.net wrote:

I am having an issue where I am trying to do things "right". I have a
server I
am building but the mysql gem is not installed. So I am using chef_gem
to
install it. However, I have other cookbooks that need to run before
chef_gem
(mainly one that installs a compiler). I have tried to use the
include_recipe
to do this, but that didn't seem to do the trick.

You may not want chef_gem but gem_package

gem_package Resource

chef_gem installs the gem for use by Chef, not your system-wide Ruby.

--

--

I'm the founder of Rock Solid Ops Inc, a web consultancy.

My main fields of expertise are Ruby on Rails web development, DevOps and a
bit of mobile. If you need help scaling, understanding, securing or
managing your web infrastructure (Rails or not), get in touch!

Connect with me and read testimonials on my
LinkedInhttp://ca.linkedin.com/in/mathieumartin/,
follow me on twitter @webmat http://twitter.com/webmat, or check out my
blog at programblings.comhttp://www.programblings.com?utm_source=email+signature
.

If you're a tech person, the following may make sense to you.

I'm the author of
git_remote_branchhttps://rubygems.org/gems/git_remote_branch.
A tool that's been helping common mortals like me share git branches for 5
years. Downloaded 50 000 times.

I've also contributed to some of the popular libraries in the Rails, jQuery
and PhoneGap ecosystems:

paperclip, active_admin, jquery-ujs, jquery-rails, kaminari, AssetSync,
phonegap-plugin-facebook-connect, shoulda, woulda, jeweler.

If you visit them on GitHub, you'll see my face in the "Contributors"
section :slight_smile: