evertrue / zookeeper-cookbook

Chef cookbook for installing and managing Zookeeper.

Home Page:https://supermarket.chef.io/cookbooks/zookeeper

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ruby-dev libraries

goldforg opened this issue · comments

In case you don't have Ruby libraries this cookbook won't work.
So basically to not do that by myself
package 'ruby1.9.3-dev' could be added.

Since Chef includes its own Ruby, it might be better to rely on that, instead?

Don't know much about that, but on Ubuntu 14 LTS this need Ruby headers

@goldforg what about it requires Ruby headers? Where do you see a failure? We test on Ubuntu 14.04 all the time, and have been using this cookbook successfully as-is for some time now.

@jeffbyrnes @goldforg is right.
On 14.04.2 LTS (GNU/Linux 3.13.0-53-generic x86_64) this cookbook will not run standalone.

Here's some log output

54.69.97.72     Provided configuration options:
54.69.97.72             --with-opt-dir
54.69.97.72             --with-opt-include
54.69.97.72             --without-opt-include=${opt-dir}/include
54.69.97.72             --with-opt-lib
54.69.97.72             --without-opt-lib=${opt-dir}/lib
54.69.97.72             --with-make-prog
54.69.97.72             --without-make-prog
54.69.97.72             --srcdir=.
54.69.97.72             --curdir
54.69.97.72             --ruby=/opt/chef/embedded/bin/ruby
54.69.97.72     extconf.rb:51:in `safe_sh': command failed! ./configure --prefix=/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/zookeeper-1.4.10/ext --with-pic --without-cppunit --disable-dependency-tracking  2>&1 (RuntimeError)
54.69.97.72             from extconf.rb:75:in `block (2 levels) in <main>'
54.69.97.72             from extconf.rb:71:in `chdir'
54.69.97.72             from extconf.rb:71:in `block in <main>'
54.69.97.72             from extconf.rb:55:in `chdir'
54.69.97.72             from extconf.rb:55:in `<main>'
54.69.97.72
54.69.97.72     extconf failed, exit code 1
54.69.97.72
54.69.97.72     Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/zookeeper-1.4.10 for inspection.
54.69.97.72     Results logged to /opt/chef/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/zookeeper-1.4.10/gem_make.out
54.69.97.72     ---- End output of /opt/chef/embedded/bin/gem install zookeeper -q --no-rdoc --no-ri -v "1.4.10" ----
54.69.97.72     Ran /opt/chef/embedded/bin/gem install zookeeper -q --no-rdoc --no-ri -v "1.4.10" returned 1
54.69.97.72
54.69.97.72     Cookbook Trace:
54.69.97.72     ---------------
54.69.97.72     /var/chef/cache/cookbooks/zookeeper/providers/default.rb:38:in `block (2 levels) in class_from_file'
54.69.97.72     /var/chef/cache/cookbooks/zookeeper/providers/default.rb:37:in `each'
54.69.97.72     /var/chef/cache/cookbooks/zookeeper/providers/default.rb:37:in `block in class_from_file'
54.69.97.72
54.69.97.72     Resource Declaration:
54.69.97.72     ---------------------
54.69.97.72     # In /var/chef/cache/cookbooks/stack-zookeeper/recipes/default.rb
54.69.97.72
54.69.97.72      27: zookeeper '3.4.6' do
54.69.97.72      28:   user     'zookeeper'
54.69.97.72      29:   mirror   'http://www.poolsaboveground.com/apache/zookeeper'
54.69.97.72      30:   checksum '01b3938547cd620dc4c93efe07c0360411f4a66962a70500b163b59014046994'
54.69.97.72      31:   action   :install
54.69.97.72      32: end
54.69.97.72      33:
54.69.97.72
54.69.97.72     Compiled Resource:
54.69.97.72     ------------------
54.69.97.72     # Declared in /var/chef/cache/cookbooks/stack-zookeeper/recipes/default.rb:27:in `from_file'
54.69.97.72
54.69.97.72     zookeeper("3.4.6") do
54.69.97.72       action [:install]
54.69.97.72       retries 0
54.69.97.72       retry_delay 2
54.69.97.72       default_guard_interpreter :default
54.69.97.72       declared_type :zookeeper
54.69.97.72       cookbook_name "stack-zookeeper"
54.69.97.72       recipe_name "default"
54.69.97.72       user "zookeeper"
54.69.97.72       mirror "http://www.poolsaboveground.com/apache/zookeeper"
54.69.97.72       checksum "01b3938547cd620dc4c93efe07c0360411f4a66962a70500b163b59014046994"
54.69.97.72       version "3.4.6"
54.69.97.72       install_dir "/opt/zookeeper"
54.69.97.72       data_dir "/var/lib/zookeeper"
54.69.97.72     end

I'll try to see what I can find.

Simply including package 'ruby1.9.3-dev' doesn't help as well, it will not find the package by default and I don't like the idea of including Ruby on an instance that doesn't need it anyway.

This appears to actually be a failure with the chef_gem[zookeeper] resource, which you can find at lines 82–84 of the zookeeper provider.

So… installing Ruby in any fashion isn’t going to help here, as there already is an installation of Ruby present (Chef’s) that’s being used. I’ll do a test run of the latest version of this cookbook, but we make heavy use of it, and have not had any trouble.

Just did a Test Kitchen run on 14.04 with no issues. Running 12.04 & the CentOS builds now (which I don’t recall if they work, anyway).

Not sure if this is related, but I can't get a kitchen converge to work for 14.04.... what I am seeing is that for whatever reason, the apt recipe never fires at compile time, which results in the compile time execution of build-essentials to fail.

No reason I see that apt isn't executing... zookeeper::install recipe appears to be setting the compile time flag and including apt correctly.

EDIT: Seems to be a result of prior includes of apt::default. If I remove the reference from the .kitchen.yml, things converge just fine. I still need to figure out how to get around this, as my base cookbook will be responsible for running apt::default.

Very odd. @KensoDev @goldforg any chance either of you can provide some more info on how you’re wrapping this cookbook?

I'm also seeing this when I try and wrap the cookbook. Using the default hashicorp ubuntu14.04 image.

https://gist.github.com/spuder/97ca889744825c3d3c63

The key lines are

             Error executing action `install` on resource 'chef_gem[zookeeper]'
             ================================================================================

             Mixlib::ShellOut::ShellCommandFailed
             ------------------------------------
             Expected process to exit with [0], but received '1'
             ---- Begin output of /opt/chef/embedded/bin/gem install zookeeper -q --no-rdoc --no-ri -v "1.4.11" ----
             STDOUT: Building native extensions.  This could take a while...
             STDERR: ERROR:  Error installing zookeeper:
                ERROR: Failed to build gem native extension.

I'm guessing simple bakes ruby into your golden images?

@spuder I don’t work at Simple, actually, and as for boxes, I use Chef’s Bento boxes, which are very minimal, and don’t include Ruby AFAIK.

That said, chef_gem uses the Chef-supplied Ruby, so this isn’t an issue of having or not having Ruby (since you do, b/c Chef brings it).

To debug this, I would log in to your test instance and try to /opt/chef/embedded/bin/gem install zookeeper yourself, and see what it complains about. It probably wants a library or some such.

Adding ruby to my wrapper cookbook fixes the problem

package 'ruby' do
  action :install
end

package 'ruby-dev' do
  action :install
end

package 'build-essential' do
  action :install
end

zookeeper "#{node[:zookeeper][:version]}" do
  user        node[:zookeeper][:user]
  mirror      node[:zookeeper][:mirror]
  checksum    node[:zookeeper][:checksum]
  data_dir    node[:zookeeper][:config][:dataDir]
  action      :install
end

if node[:zookeeper][:env_vars]
  file "#{node[:zookeeper][:config_dir]}/zookeeper-env.sh" do
    owner node[:zookeeper][:user]
    content exports_config node[:zookeeper][:env_vars]
  end
end

zookeeper_config "#{node[:zookeeper][:config_dir]}/#{node[:zookeeper][:conf_file]}" do
  config node[:zookeeper][:config]
  user   node[:zookeeper][:user]
  action :render
end

@spuder I wager it’s probably the ruby-dev package that’s really fixing things up. The odd part, is that copy of Ruby isn’t what’s being used to install the zookeeper gem.

What image are you using, exactly?

This is inside my kitchen vm, using the default vm that kitchen points to out of the box.

I can get you my whole cookbook if you want to reproduce this.

---
driver:
  name: vagrant

provisioner:
  name: chef_solo

platforms:
  - name: ubuntu-14.04
    run_list:
      - recipe[apt]
  # - name: centos-7.1

suites:
  - name: default
    run_list:
      - recipe[nd-zookeeper::default]
    attributes:
      java:
        jdk_version: 7

@spuder this is so odd, because this cookbook itself uses that exact same image for testing, and works just fine.

Closing due to lack of activity.