My Nodes have no internet access at all. We have no permission to set up a local gems mirror. All gems install needs to be from the chef server.
When chef runs, now, it invokes 'bundler install' (chef/lib/chef/cookbook/gem_installer.rb -- L51) with no options.
How do we kill the bundler run or force it into a local or standalone setup so that it will not initiate a connection out? (installing from local directory is okay, as long as we can force it per-gem to a different location)
Anyone else run this in a strict enterprise setting with strong firewalls and rules around software promotion? I worry that this is challenging for chef.
This didn't seem to help, but I may have the dir contents (just a gem) wrong:
/opt/chef/embedded/bin/bundle \ config \ local.chef-vault /var/chef/cache/cookbooks/gem-chef-vault/files/default/
okay. So a submodule checkout in files can work:
cd ~/chef-repo git submodule add \ https://github.com/chef/chef-vault.git \ local-cookbooks/gem-chef-vault/files/default/chef-vault
note above that since chef will join all the cookbook dirs, your reference in bundler is still .../cookbooks/... .
Hmm. Difficult to change /root/.bundle/config before the gem download starts. This, for instance, isn't winning the race:
template /root/.bundle/config do action :nothing end.run_action(:create)
bobbitting the routine at [Line 49] (https://github.com/chef/chef/blob/master/lib/chef/cookbook/gem_installer.rb#L49) (||true) shuts off the gem grab, but then we're back to a failure when the included third-party cookbook 'requires' the (not yet installed) gem during compilation -- and the r=/r.run_action(:install) bit can't seem to run yet ... right where I think it was supposed-to.
even if I could light up a cheap empty gem repo on the chef box:
mkdir -p /var/opt/opscode/nginx/html/repo/gems /opt/opscode/embedded/bin/gem \ generate_index \ -d /var/opt/opscode/nginx/html/repo/
:::::::::::::: /var/opt/opscode/nginx/etc/addon.d/99-gem-mirror_external.conf :::::::::::::: location "/repo/" { }
(restart withchef-server-ctl restart
).... and point the nodes at that location
knife ssh 'name:victim2' -- \ chef-client --config-option 'rubygems_url=http://chef/repo/'
it still dies - at 'requires' so I'm thinking the URL isn't relevant.
our current strategy, if we're still going with chef in the enterprise, is code like the following:
##3p_something::default.rb: chef_gem 'something' do # install in compile source '/some/local/file.gem' clear_sources true compile_time true include_default_source false action :nothing end.run__action (:install) # include_recipe 'something'
Ideally we want to pre-seed the required gem in before the included recipe blindly grabs something off the web, so we get something verifiable, consistent and repeatable (of course; and updating file.gem is another effort we accept in that regard).
It seems to look like chef issues 3456 but not completely, or docker issue 682 or chef-vault issue 61 and 63: our issue is that this all happens autocraptically when the 'gem' line in metadata.rb is read.