Chef-Solo to Chef-Zero

A common workflow I use is…

  1. Change my cookbook
  2. Run ‘berks package’ to build a complete tarball of my cookbook with all dependencies
  3. SCP to a server
  4. Run ‘sudo chef-solo -o “recipe[my-fancy-cookbook::default]" -r cookbooks-1409688848.tar.gz’ to test the cookbook
  5. Repeat

Is this workflow possible with chef-client in local mode? Can I pass chef-client a tarball that was created by the ‘berks package’ command?

Thanks!

On Tuesday, September 2, 2014 at 2:07 PM, Durfee, Bernie (GE Global Research) wrote:

A common workflow I use is…

  1. Change my cookbook
  2. Run ‘berks package’ to build a complete tarball of my cookbook with all dependencies
  3. SCP to a server
  4. Run ‘sudo chef-solo -o “recipe[my-fancy-cookbook::default]" -r cookbooks-1409688848.tar.gz’ to test the cookbook
  5. Repeat

Is this workflow possible with chef-client in local mode? Can I pass chef-client a tarball that was created by the ‘berks package’ command?

Thanks!

You’d probably use berks vendor to get your cookbook set into a directory and rsync that over instead of shipping a tar archive. You’d have the same basic flow, slightly different commands.

--
Daniel DeLeo

That's exactly the workflow chef-runner was made for:

The tools prepares all cookbooks locally using e.g. Berkshelf, uploads
them to the server via rsync (very fast), and finally runs Chef Solo.

-Mathias

On Tue, Sep 2, 2014 at 11:12 PM, Daniel DeLeo dan@kallistec.com wrote:

On Tuesday, September 2, 2014 at 2:07 PM, Durfee, Bernie (GE Global Research) wrote:

A common workflow I use is…

  1. Change my cookbook
  2. Run ‘berks package’ to build a complete tarball of my cookbook with all dependencies
  3. SCP to a server
  4. Run ‘sudo chef-solo -o “recipe[my-fancy-cookbook::default]" -r cookbooks-1409688848.tar.gz’ to test the cookbook
  5. Repeat

Is this workflow possible with chef-client in local mode? Can I pass chef-client a tarball that was created by the ‘berks package’ command?

Thanks!

You’d probably use berks vendor to get your cookbook set into a directory and rsync that over instead of shipping a tar archive. You’d have the same basic flow, slightly different commands.

--
Daniel DeLeo

Thanks Mathias!

I like this and am going to use it. But from what I understand chef-solo
is going to be replaced at some point by chef-client running in local mode.

Are there plans to get chef-runner working with chef-client local mode?

Bernie

On 9/2/14, 5:15 PM, "Mathias Lafeldt" mathias.lafeldt@gmail.com wrote:

That's exactly the workflow chef-runner was made for:

GitHub - mlafeldt/chef-runner: The fastest way to run Chef cookbooks

The tools prepares all cookbooks locally using e.g. Berkshelf, uploads
them to the server via rsync (very fast), and finally runs Chef Solo.

-Mathias

On Tue, Sep 2, 2014 at 11:12 PM, Daniel DeLeo dan@kallistec.com wrote:

On Tuesday, September 2, 2014 at 2:07 PM, Durfee, Bernie (GE Global
Research) wrote:

A common workflow I use isŠ

  1. Change my cookbook
  2. Run Œberks package¹ to build a complete tarball of my cookbook with
    all dependencies
  3. SCP to a server
  4. Run Œsudo chef-solo -o ³recipe[my-fancy-cookbook::default]" -r
    cookbooks-1409688848.tar.gz¹ to test the cookbook
  5. Repeat

Is this workflow possible with chef-client in local mode? Can I pass
chef-client a tarball that was created by the Œberks package¹ command?

Thanks!

You¹d probably use berks vendor to get your cookbook set into a
directory and rsync that over instead of shipping a tar archive. You¹d
have the same basic flow, slightly different commands.

--
Daniel DeLeo

Thanks Daniel, I¹ll give it a try.

Bernie

On 9/2/14, 5:12 PM, "Daniel DeLeo" dan@kallistec.com wrote:

On Tuesday, September 2, 2014 at 2:07 PM, Durfee, Bernie (GE Global
Research) wrote:

A common workflow I use isŠ

  1. Change my cookbook
  2. Run Œberks package¹ to build a complete tarball of my cookbook with
    all dependencies
  3. SCP to a server
  4. Run Œsudo chef-solo -o ³recipe[my-fancy-cookbook::default]" -r
    cookbooks-1409688848.tar.gz¹ to test the cookbook
  5. Repeat

Is this workflow possible with chef-client in local mode? Can I pass
chef-client a tarball that was created by the Œberks package¹ command?

Thanks!

You¹d probably use berks vendor to get your cookbook set into a
directory and rsync that over instead of shipping a tar archive. You¹d
have the same basic flow, slightly different commands.

--
Daniel DeLeo

On Tue, Sep 2, 2014 at 11:52 PM, Durfee, Bernie (GE Global Research)
bernie.durfee@ge.com wrote:

Thanks Mathias!

I like this and am going to use it. But from what I understand chef-solo
is going to be replaced at some point by chef-client running in local mode.

Are there plans to get chef-runner working with chef-client local mode?

Bernie

Absolutely. In fact, it's already on my list of planned features. I
specifically designed chef-runner's code base to support multiple
provisioners. I guess I'm going to make chef-client local mode
optional when I come around to implementing it, and later make it the
new default, replacing chef-solo.

If you experience any problems or have ideas for improvements, feel
free to open a ticket at

-Mathias

chef-metal has an interesting variant on this ... if your cookbook can be
served by a local chef-zero, it will serve up your local repository
directory directly, making for a very tight edit > converge > edit >
converge loop. You can replicate the effect with:

Setup:

cd
knife serve
ssh -R 8889:localhost:8889
set up /etc/chef/client.rb with "chef_server_url http://localhost:8889"

Debug cycle:

chef-client

chef-client
...

Now anytime you run chef-client on the remote machine, it will immediately
pick up the latest cookbook from your local directory without any copying
or vendoring or whatnot.

It can't be done directly with berkshelf, but if you berks vendor to your
repository directory, you can edit the cookbook there and reflect the
changes back when you are done.

On Tue, Sep 2, 2014 at 2:07 PM, Durfee, Bernie (GE Global Research) <
bernie.durfee@ge.com> wrote:

A common workflow I use is…

  1. Change my cookbook
  2. Run ‘berks package’ to build a complete tarball of my cookbook with
    all dependencies
  3. SCP to a server
  4. Run ‘sudo chef-solo -o “recipe[my-fancy-cookbook::default]" -r
    cookbooks-1409688848.tar.gz’ to test the cookbook
  5. Repeat

Is this workflow possible with chef-client in local mode? Can I pass
chef-client a tarball that was created by the ‘berks package’ command?

Thanks!