About ChefDK

[edit on GitHub]

Note

Chef Workstation gives you everything you need to get started with Chef — ad hoc remote execution, remote scanning, configuration tasks, cookbook creation tools as well as robust dependency and testing software — all in one easy-to-install package. Chef Workstation replaces ChefDK, combining all the existing features with new features, such as ad-hoc task support and the new Chef Workstation desktop application. Chef will continue to maintain ChefDK, but new development will take place in Chef Workstation without backporting features.

The Chef Development Kit is a package that contains everything that is needed to start using Chef:

  • chef-client
  • chef and knife command line tools
  • Testing tools such as Test Kitchen, ChefSpec, Cookstyle, and Foodcritic
  • InSpec
  • Everything else needed to author cookbooks and upload them to the Chef server

Getting Started

Chef is a systems and cloud infrastructure automation framework that makes it easy to deploy servers and applications to any physical, virtual, or cloud location, no matter the size of the infrastructure. Each organization is comprised of one (or more) ChefDK installations, a single server, and every node that will be configured and maintained by the Chef Client. Cookbooks (and recipes) are used to tell the chef-client how each node in your organization should be configured. The chef-client (which is installed on every node) does the actual configuration.

About Workflow

The Chef development kit defines a common workflow for cookbook development:

  1. Create a skeleton cookbook. This is a cookbook with the standard files already included. The package manager is often Berkshelf, which is included as part of the Chef development kit, plus a revision control system, typically git. Berkshelf helps manage cookbooks and cookbook dependencies.
  2. Create a virtual machine environment using Test Kitchen. This is the environment that will be used to develop the cookbook, including the location in which automated testing and debugging of that cookbook will be done as it is being developed.
  3. Write the recipes for the cookbook and debug those recipes as they are being written. This is typically an iterative process, where cookbook are tested as they are developed, bugs are fixed quickly, and then cookbooks are tested again. A text editor—Sublime Text, vim, TextMate, EditPad, or any other preferred text editor—is used to author the files in the cookbook.
  4. Perform acceptance tests. These tests are not done in a development environment, but rather are done against a full Chef server using an environment that matches the production environment as closely as possible.
  5. When the cookbooks pass all the acceptance tests and have been verified to work in the desired manner, deploy the cookbooks to the production environment.

Tools

The Chef development kit installs a collection of tools and libraries into a single directory structure, which makes it easier to manage any dependencies these tools may have on each other and the dependencies that Chef has on Ruby.

The most important tools included in the Chef development kit are:

Tool Description
Berkshelf A dependency manager for cookbooks.
chef A workflow tool for Chef.
chef-client The agent that runs Chef.
chef-vault Use to encrypt data bag items using the public keys of a list of nodes. This allows only those nodes to decrypt the encrypted values.
ChefSpec A unit testing framework that tests resources locally.
Cookstyle A Rubocop-based style-checking tool for writing clean cookbooks.
Delivery CLI A command-line tool for continuous delivery workflow. Is used to setup and execute phase jobs on a Chef Automate server.
Fauxhai A gem for mocking Ohai data in ChefSpec tests.
Foodcritic A lint tool for static analysis of recipe code.
Test Kitchen An integration testing framework tool that tests cookbooks across platforms.
kitchen-dokken A test-kitchen plugin that provides a driver, transport, and provisioner for rapid cookbook testing and container development using Docker and Chef.
kitchen-vagrant A Kitchen driver for Vagrant.
knife-spork A workflow plugin for knife that helps groups of people work together in the same chef-repo and Chef server.
Ruby The reference language for Chef.

ChefDK Tools

The following tools are available only in the Chef development kit:

chef (executable) | Policyfiles

Community Tools

The following tools have been developed by members of the Chef community. These tools are considered to be a useful part of the Chef workflow and have been packaged as part of the Chef development kit. (They are all available independently of the Chef development kit, as well.) The use of these tools as part of your workflow is recommended, but at the same time is completely optional. Use them in the way that makes sense for your organization:

Berkshelf | Chef Vault | ChefSpec | FoodCritic | Test Kitchen | kitchen-vagrant | Cookstyle