Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consul::install_binary should not install compilers on host #169

Closed
dpkp opened this issue May 5, 2015 · 14 comments
Closed

consul::install_binary should not install compilers on host #169

dpkp opened this issue May 5, 2015 · 14 comments
Assignees
Milestone

Comments

@dpkp
Copy link
Contributor

dpkp commented May 5, 2015

I'd like to avoid installing compilers and other build tools on production servers. But the ::install_binary recipe causes compilers and other tools to get installed via apt (testing on ubuntu 12.04). It looks like this is caused by the libarchive cookbook dependency, which compiles the libarchive library as part of the ruby gem install. Due to the compiler install, I can't use the cookbook to install consul on production servers...

> kitchen converge default-ubuntu-1204
...
       Recipe: build-essential::_debian
         * apt_package[autoconf] action install
           - install version 2.68-1ubuntu2 of package autoconf
         * apt_package[binutils-doc] action install
           - install version 2.22-6ubuntu1.3 of package binutils-doc
         * apt_package[bison] action install
           - install version 1:2.5.dfsg-2.1 of package bison
         * apt_package[build-essential] action install (up to date)
         * apt_package[flex] action install
           - install version 2.5.35-10ubuntu3 of package flex
         * apt_package[gettext] action install
           - install version 0.18.1.1-5ubuntu3 of package gettext
         * apt_package[ncurses-dev] action install
           - install version (none) of package ncurses-dev
...
@rsteube
Copy link

rsteube commented May 6, 2015

+1
ark might be an alternative

@rsteube
Copy link

rsteube commented May 6, 2015

Here's an example for install_binary.rb, which includes download, extraction and symbolic link (but with different folder structure in opt):

include_recipe 'ark'
ark 'consul' do
  url Chef::Consul.remote_url(node)
  version node['consul']['version']
  strip_components 0
  prefix_root '/opt'
  prefix_home '/opt'
  has_binaries ['consul/consul']
end

Simple extraction with current folder structure can be done like this:

include_recipe 'ark'
ark 'consul' do
  url Chef::Consul.remote_url(node)
  path Chef::Consul.install_path(node)
  creates 'consul'
  action :cherry_pick
end

@ewr
Copy link
Contributor

ewr commented May 14, 2015

👍 to using something other than libarchive. I just discovered this morning that chef runs on several of my nodes have been broken for a while, but they were failing via libarchive during the compile phase and were therefore not far enough to have installed the handlers that would have alerted me.

@dpkp
Copy link
Contributor Author

dpkp commented May 14, 2015

ewr: I think that is worth opening a separate issue! (or possibly add to #170 ?)

@johnbellone
Copy link
Contributor

I'll revisit this in the 1.0 release that's on the develop branch. Right now it is using libarchive but maybe @reset and I can figure a way out to not yank in build-essentials.

@reset
Copy link
Contributor

reset commented Jun 16, 2015

@johnbellone the ark cookbook is a mess in it's own way. The libarchive cookbook contains the only lwrp for managing archives that I know of which is actually idempotent, but seems to be having issues on some machines. We can triage those issues or come up with a pure ruby way to get the same behaviour that libarchive is giving us.

@ewr
Copy link
Contributor

ewr commented Jun 16, 2015

It doesn't look like they've followed through on pushing it to Supermarket, but this Ooyala tarball cookbook is an attempt to handle unarchiving via just built-in Ruby bits:

https://github.com/ooyala/tarball-chef-cookbook
http://engineering.ooyala.com/blog/stop-bashing-tarballs-chef

@reset
Copy link
Contributor

reset commented Jun 16, 2015

@ewr they're on the right track with the pure Ruby approach but unfortunately it's only for tarballs 😦. Libarchive (the c library) identifies what compression mechanism was used and then rolls with it. That, portability, and idempotency are the keys that we need.

@ewr
Copy link
Contributor

ewr commented Jun 16, 2015

I was going to say "yeah, but the Consul binaries are just tarballs", but they aren't: they're zip files.

So, carry on...

@johnbellone
Copy link
Contributor

@reset Yeah we spoke about ark cookbook last time. I am wondering if we can get by using ffi-libarchive - does that still need development headers?

@johnbellone
Copy link
Contributor

I have a test branch locally and I'll see if I can wire in ffi-libarchive. Any objects @reset?

@reset
Copy link
Contributor

reset commented Jul 1, 2015

@johnbellone not at all - just need to make sure it's actually idempotent. I do that in the libarchive cookbook by reading the contents of the archive and comparing to what is on disk before performing any extractions.

@johnbellone
Copy link
Contributor

I am closing this since @reset merged the above commit. This no longer requires build-essentials and merely requires libarchive.

@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants