littlechef
littlechef copied to clipboard
Use Berkshelf to manage cookbooks
Hi,
I'm using Berkshelf (http://berkshelf.com) to manage my Vagrant boxes, this might be very helpful to use with little chef.
In short what it does:
- manages your opscode cookbooks
- manages your external cookbooks
- automatic downloads your cookbooks
When running fix node:X little chef could do a berks install --path=cookbooks
to install public cookbooks, in the Berksfile you can add more private cookbooks (from a specified path ex. private-cookbooks).
In the end you don't have to take care of downloading those public cookbooks, adding them to your git repo etc..
It's a concept of an idea.
Hi, so you don't mean to add a new command as in fix fetch_cookbook:apache2
, but instead do it on-the-fly when fixing a node, if the needed cookbooks are not there?
Yes indeed, cfr. with a gemfile in Ruby. You don't have to do in manually. But it's just a concept of an idea. It seems that librarian does some same things.. https://github.com/applicationsonline/librarian-chef
I'd love to see Berkshelf support too. Pre-deploy and post-deploy hooks could be a great way to solve this. https://groups.google.com/forum/#!topic/littlechef/--kVZxtDTy0
I have integrated Berkshelf 3 + littlechef successfully. Caveat here is that I am not a Berkshelf expert.
The correct thing seems to be to run 'berks vendor' before any 'fix' -- pulling down cookbooks in parallel on nodes seems a bit strange.
It relies on running a script before every fix however (not a pre-deploy hook yet). My script is:
#!/bin/bash
bundle install --gemfile=deploys/Gemfile
rm -rf cookbooks
BUNDLE_GEMFILE=deploys/Gemfile bundle exec berks vendor cookbooks
(The separate Gemfile is because I ran into issues with putting Berkshelf into a gemfile with the Chef 10.18 gem...)
I'd prefer:
-
vendor
directory instead of 'cookbooks' directory (this could be configurable inconfig.rb
? Littlechef currently only looks atcookbooks
andsite-cookbooks
) - predeploy hook integrates with Littlechef so I don't have to run this script manually as part of our orchestration
These both seem possible -- what do people think?
Cool!
Regarding your two points, the first one is easily solvable by adding vendor
to cookbook_paths
. Or only in the case that berkshelf is being used. But why do you want to have vendor and cookbooks? Don't you completely "transfer" ownership of /cookbooks
to berkshelf?
The second one, well, predeploy hooks are not yet implemented. They can be implemented relatively easily though. This surely is a use case for it.
An alternative is to build berkshelf support into LittleChef itself.
Yeah the vendor
cookbooks
comment is a good point.
I think I prefer integrated Berkshelf support though my script doesn't really point to a general path to that (requires a Ruby environment with Berkshelf installed). Littlechef is primarily a Python/Fabric setup and I'm not confident that we have a way to integrate that.
I'll take a stab at implementing predeploy hooks and let you know how it goes.
Sure, but your script "integrates" with Ruby just as loosely as LC would do. And there is a precedent: knife integration to create metadata.json on the fly out of metadata.rb
It is admittedly not very clean, but it does the job. So either way, predeploy hooks would also work. Keep us posted!
Hi, what is the current status of Berkshelf integration?
I see that it should be simple as explained here, but for me berks doesn't kick-in while running fix node:whatever.
Any idea on what's in going on?
Fixes are being worked on in #231