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

Use Berkshelf to manage cookbooks #166

Open
jverdeyen opened this issue Jun 7, 2013 · 9 comments
Open

Use Berkshelf to manage cookbooks #166

jverdeyen opened this issue Jun 7, 2013 · 9 comments

Comments

@jverdeyen
Copy link

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.

@tobami
Copy link
Owner

tobami commented Jun 10, 2013

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?

@jverdeyen
Copy link
Author

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

@drye
Copy link

drye commented Jul 4, 2013

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

@tildedave
Copy link
Contributor

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 in config.rb? Littlechef currently only looks at cookbooks and site-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?

@tobami
Copy link
Owner

tobami commented Feb 10, 2014

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.

@tildedave
Copy link
Contributor

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.

@tobami
Copy link
Owner

tobami commented Feb 11, 2014

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!

@gionn
Copy link

gionn commented Feb 3, 2015

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?

@tobami
Copy link
Owner

tobami commented Feb 3, 2015

Fixes are being worked on in #231

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants