Organizing cookbook files on chef server


#1

I wanted to be able to create sub directories in files/defaults of a cookbook
or

be able to create directories in files/ for different environments.


More detail:

The reason I was looking to do so is we do weekly (or so) releases of a java
app, and everything in the cookbook will stay the same except a ROOT.war file.

I wanted a way to roll this out in steps, first to stage and then to production
(and was hoping I would not have to update the cookbook version every week.

I could have the files named differently and use the source command to rename
them, but that just didn’t seem as clean.

Thanks for any advice!


#2

On Wed, Mar 14, 2012 at 1:09 PM, bwright@hwahomewarranty.com wrote:

I wanted to be able to create sub directories in files/defaults of a cookbook
or

be able to create directories in files/ for different environments.


More detail:

The reason I was looking to do so is we do weekly (or so) releases of a java
app, and everything in the cookbook will stay the same except a ROOT.war file.

I wanted a way to roll this out in steps, first to stage and then to production
(and was hoping I would not have to update the cookbook version every week.

I could have the files named differently and use the source command to rename
them, but that just didn’t seem as clean.

Thanks for any advice!

You really shouldn’t store war files in your files directory. Chef is
not a general purpose distribution point. Additionally if you’re using
git for your VCS, you’re unnecessarily bloating the repo history. Git
never throws anything away.

The better solution here, and one that I’ve used to great success, is
to version your artifacts and set a version number at the environment
level as an attribute. Use remote_file to grab the artifact from an
internal distribution point (we used a private S3 bucket). If your
artifacts are environment specific (something you should ideally get
away from), you can use directories that match environment names and
make that part of the remote_file source path.


#3

just add this to cron to run whenever you want:

/usr/local/bin/chef-client

On Mar 14, 2012, at 1:54 PM, John E. Vincent (lusis) wrote:

On Wed, Mar 14, 2012 at 1:09 PM, bwright@hwahomewarranty.com wrote:

I wanted to be able to create sub directories in files/defaults of a cookbook
or

be able to create directories in files/ for different environments.


More detail:

The reason I was looking to do so is we do weekly (or so) releases of a java
app, and everything in the cookbook will stay the same except a ROOT.war file.

I wanted a way to roll this out in steps, first to stage and then to production
(and was hoping I would not have to update the cookbook version every week.

I could have the files named differently and use the source command to rename
them, but that just didn’t seem as clean.

Thanks for any advice!

You really shouldn’t store war files in your files directory. Chef is
not a general purpose distribution point. Additionally if you’re using
git for your VCS, you’re unnecessarily bloating the repo history. Git
never throws anything away.

The better solution here, and one that I’ve used to great success, is
to version your artifacts and set a version number at the environment
level as an attribute. Use remote_file to grab the artifact from an
internal distribution point (we used a private S3 bucket). If your
artifacts are environment specific (something you should ideally get
away from), you can use directories that match environment names and
make that part of the remote_file source path.

Jeremy Winters
646-543-0082
jeremy.winters@full360.com