Coder Social home page Coder Social logo

Allow seeding of Data about chef-zero HOT 7 CLOSED

chef avatar chef commented on July 27, 2024
Allow seeding of Data

from chef-zero.

Comments (7)

jkeiser avatar jkeiser commented on July 27, 2024

In general, what you do is create a chef repository with a knife.rb, with toplevel directories like data_bags, environments, roles, cookbooks, nodes, etc. (all are optional). Then make a knife.rb that specifies chef_repo_path = . After this, you can get the data into chef-zero in one of two ways:

  1. Add chef_server_url="http://127.0.0.1:8889" to the knife.rb, and type "knife upload /" from that directory.
  2. Install the latest knife-essentials, and run "knife serve", which spins up a chef-zero pointed directly at your directory. This is almost certainly what you actually want. knife serve will even put modified objects (like the ohai data from the node) back into the chef repo so that future runs of chef-zero will see it.

Fletcher is using the "knife serve" classes to bring up VMs in test-kitchen.

from chef-zero.

jkeiser avatar jkeiser commented on July 27, 2024

@andrewgross a simple way to see knife serve in action:

gem install knife-essentials
cd /playground
knife serve

from chef-zero.

jkeiser avatar jkeiser commented on July 27, 2024

@fnichol can probably help, seeing as he's doing something pretty similar to what you're trying to do.

from chef-zero.

andrewgross avatar andrewgross commented on July 27, 2024

@jkeiser Thanks for the response. At the moment I am trying to script up my Make/Rake files around having each cookbook as a separate repo. Instead of uploading my top level information in to Chef Zero and having it be a pan-cookbook server, my goal is to have it stand up for particular Vagrant run.

Ideal Workflow:

  1. Start CZ
  2. Dump only data needed for Vagrant run into CZ via Berkshelf and Knife
  3. Start my fake EC2 API server
  4. Run Vagrant as Chef-Client
  5. Do Chef things with my cookbooks, libraries etc
  6. Teardown Vagrant, EC2 API and CZ
  7. Push my changes from local to staging

It is certainly possible to have the Chef Zero server encompass multiple cookbooks, but then I feel like I will be introducing a shared state between developing on supposedly separate cookbooks. Obviously still in the planning stage, but I just wanted to try to explain my thought process.

from chef-zero.

jkeiser avatar jkeiser commented on July 27, 2024

I'm not sure what you mean by having the Chef Zero server encompass multiple cookbooks being a bad thing. If the cookbooks have dependencies, you will need to load the dependencies into the server, making it a multiple cookbook server.

Regardless, one way or the other you will have to tell Chef Zero exactly which cookbooks, roles, environments, etc. you want. In your original proposal you suggested passing a directory for cookbooks, roles, environments and data_bags; that's exactly what a Chef repository looks like. If you have these directories already, then you can you can set up a knife.rb and use "knife serve."

Not sure if I'm helping you here. Is what I'm saying making sense? Does it solve the problem you are trying to solve, or is there something more we ought to support?

from chef-zero.

andrewgross avatar andrewgross commented on July 27, 2024

Hey,

Sorry, it can be a bit tricky to express things relating to Chef since there are so many ways to do things. At the moment I think I can satisfy my problem by using Ridley to dump data into Chef-Zero in preparation for a Berkshelf/Vagrant run. While Knife is awesome, it is heavily tied in to doing cookbook development as part of a larger overarching Chef repo, something I cannot guarantee in this use case.

I am actually starting to think the sort of thing I want to do will be better suited to be woven into part of Berkshelf. If it turns out that there really is a need to have a way to seed data, instead of just some automated way of uploading it (my current problem) then I can double back and work on this.

from chef-zero.

jkeiser avatar jkeiser commented on July 27, 2024

knife upload and knife serve will both work if you have the directories you were talking about at the beginning. I still think knife serve is what you want.

from chef-zero.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.