[chef] Re: Confused about environments.


Chronological Thread 
  • From: Morgan Blackthorne < >
  • To: " " < >
  • Subject: [chef] Re: Confused about environments.
  • Date: Fri, 14 Feb 2014 18:18:57 -0800

Again, you're focusing on how to get there rather than stating where you need to go and why.

And yes, the tooling around Chef is in flux. Best practices are still evolving. This is something Chef is aware of and aiming to address via gap coverage and documentation as they head towards Chef 12. The Chef 10 standard of knife cookbook upload clearly doesn't cut it-- but. Chef doesn't maintain any of the extra tools currently, they are all third party. (And I think for the most part, that's the way they intend it to maintain but they may contribute resources to shore up projects.) Again, that's something they want to nail down process wise for 12, where a clear process for uploading and testing can be defined, abstracted from the tooling used (ie, librarian vs berkshelf, vagrant vs chef-zero vs vagabond, BAtS vs chefspec, etc),

In the meantime, the bigger picture you can convey, the better quality architectural advice you will be given.

On Friday, February 14, 2014, Douglas Garstang < "> > wrote:
Morgan,

Less attempts would be made to try and fit square pegs into square holes if I had a body of knowledge to learn from. Some published best practices would be most beneficial.

One of the problems I am trying to solve is to make cookbooks less fragile. Cookbook development is in a high state of flux. An attribute defined in a role may be used by more than one cookbook. Changing that reference has the potential to break multiple cookbooks.What is the correct approach here? Is the best practice to make single references to some common attributes or to duplicate them? Again, some best practices guidelines would be helpful.

I'll use the example of a mysql server. Currently it's defined once per location, because that made the most sense at the time. If I change it name in the role, the cookbooks that use it break. I could use chef search instead but that doesn't work with vagrant and chef solo as far as I know. If I tested in a full chef server environment, I would need to bring up the mysql server and every other node required just to test that the attributes were filled out correctly.

You could of course say 'don't do that'. Don't touch the mysql attribute. Ok, but it's just an example of how the cookbooks are coupled. The same mistake could easily be made with any other attribute at any time. I am trying to decouple the cookbooks.

Another issue is that test kitchen, as far as I can tell again, does not work with roles. You must take all the attributes from your role and manually transcribe it into the kitchen.yml file, which in my mind ins't a very good test. That is not going to catch errors like the mysql example mentioned above.


Douglas.


On Fri, Feb 14, 2014 at 3:19 PM, Morgan Blackthorne < > wrote:
You're usually the one talking about (or bitching about) corner cases in #chef. I think what you might need to do is take a step back, itemize your goals, and ask the best way to achieve them. Because it seems like you're trying to fit a round peg in a square hole, and the solution isn't just to hammer at it, it's to see if you need to change your approach.

Comments from someone who had you on ignore for a while because you couldn't get past the fact that Chef was written in Ruby. You're asking more reasonable questions these days, but I'm not sure you're using chef in ways it's intended for.


On Friday, February 14, 2014, Douglas Garstang < > wrote:
Matthew,

Since we have one chef-repo per cookbook, it seemed to make perfect sense to put the environment into the cookbook. I've since realised that's not going to work as updating the environment from one cookbook blows updates from the previous one away.

I'm trying to find a way to decouple the attributes between cookbooks. See my subsequent post on that. It seems like environments are no better than roles for that. We need one big nasty json file in our main per location. 

Doug.


On Fri, Feb 14, 2014 at 2:28 PM, Matthew Moretti < > wrote:

From your email it sounded like you were putting your environment file inside a cookbook? I might’ve misunderstood you , but if that’s the case, that’s probably not right. Most people keep their environments in a directory in their chef-repo and then they’re uploaded using knife environment from file

-Matt Moretti



On Fri, Feb 14, 2014 at 4:50 PM, Douglas Garstang < > wrote:
Ok, the plot thickens.

(bitcasa-prod) Douglass-Mac-mini:~ knife-eu2 environment show eu2-prod
chef_type:           environment
cookbook_versions:
default_attributes:
description:
json_class:          Chef::Environment
name:                eu2-prod
override_attributes:

The data isn't even on the server. :( No default and no override attributes. I'm obviously not uploading the data correctly.

Doug.



On Fri, Feb 14, 2014 at 1:40 PM, Douglas Garstang < > wrote:
I'm missing an important detail with chef environments. I created an environment called 'eu2-prod' with the knife command, and can view and edit it.

In my cookbook I have created the environments directory into which I have deposited an environment file called 'eu2-prod.json'. It looks like this:

{
  "name": "eu2-prod",
  "description": "",
  "cookbook_versions": {
  },
  "json_class": "Chef::Environment",
  "chef_type": "environment",
  "default_attributes": {
  },
  "override_attributes": {
  }
}

All this has been uploaded to the chef server. However, when the client runs, it can't find the data from the eu2-prod environment. 


--
--
~*~ StormeRider ~*~

"Every world needs its heroes [...] They inspire us to be better than we are. And they protect from the darkness that's just around the corner."

(from Smallville Season 6x1: "Zod")

On why I hate the phrase "that's so lame"... http://bit.ly/Ps3uSS




Archive powered by MHonArc 2.6.16.

§