0

I am trying to install chef recipes on air-gapped server I bundled gems listed in all recipes and prepared vendor/cache archive. Copying it into the server and running /opt/chef/embedded/bin/bunlde install --local successfully installed 233 gems but when i run chef-client -j boot.json it finds all gems and doesn't download but still run bundle install step and tries to access rubygems.org and fails

Running chef-client in debug mode doesn't reveal any gem name, its trying to download so i don't know what's missing. Is there anyway i can skip this step or know which gem is missing ?

Hassnain Alvi
  • 333
  • 6
  • 16
  • Can you update the question with relevant code (from recipe) that gets executed when you run `chef-client`? – seshadri_c Apr 05 '21 at 17:43
  • @seshadri_cits not the code its the chef built in steps Once the role related cookbooks are fetched the client start bundle install of cookbook gems a;though i have already installed gems through local bundle install It doesn't log me any missing gems as well – Hassnain Alvi Apr 06 '21 at 05:01
  • 2
    Some documentation on [client configuration](https://docs.chef.io/config_rb_client/) points to setting `rubygems_url` to a local RubyGems mirror in air-gapped environments. This is probably what you need. – seshadri_c Apr 06 '21 at 08:16

1 Answers1

1

Part of the run after loading the cookbooks is to install the gems required in the cookbook metadata.rb.

The client prepare a Gemfile and launch a bundle install to check if the necessary gems are installed and up to date, that's the behavior of bundler and why it tries to connect to rubygems.org.

As said in the comments, vendoring all the gems on each server is far from being efficient, you'd better have an internal gem repository and point your cient to it.

That's nearly what you did, get all gems from your recipes, install them on an internal machine and run gem server.

That can be tedious, and there's other approaches allowing to mirror rubygem internally more easily described here

Tensibai
  • 15,557
  • 1
  • 37
  • 57