• This repository has been archived on 14/Jul/2021
  • Stars
    star
    384
  • Rank 111,726 (Top 3 %)
  • Language
    Ruby
  • License
    Apache License 2.0
  • Created over 10 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

DEPRECATED: A streamlined development and deployment workflow for Chef Infra platform.

ChefDK

Build Status Docker Stars Docker Pulls

Umbrella Project: Chef Workstation

WARNING

ChefDK is now EOL and will receive no further updates. It has been replaced with Chef Workstation. Download Chef Workstation for the latest features and tools.

ChefDK brings Chef Infra Client and the development tools developed by the Chef Community together and acts as the consistent interface to this awesomeness. This awesomeness is composed of:

This repository contains the code for the chef command. The full package is built with omnibus. Project and component build definitions are in the omnibus directory in this repository.

Installation

You can get the latest release of ChefDK from the downloads page.

On macOS, you can also use homebrew-cask to brew cask install chef/chef/chefdk.

Once you install the package, the chef-client suite, berks, kitchen, and this application (chef) will be symlinked into your system bin directory, ready to use.

Pre-release Candidates

The following commands will download the latest ChefDK package from the current channel. The current channel holds builds that have passed testing and are candidates for release. More information about flags supported by install.sh available here: https://docs.chef.io/api_omnitruck.html

Linux and macOS

In a terminal, run:

curl https://omnitruck.chef.io/install.sh | sudo bash -s -- -c current -P chefdk

To download a specific version, append the -v flag. EG, -v 0.9.0.

Windows

Open up a Powershell command prompt as Administrator and run:

. { iwr -useb https://omnitruck.chef.io/install.ps1 } | iex; install -channel current -project chefdk

To download a specific version, append the -version flag. EG, -version 0.9.0.

Usage

For help with Berkshelf, Test Kitchen, ChefSpec, [Foodcritic][], Delivery CLI or Push Jobs Client, visit those projects' homepages for documentation and guides. For help with chef-client and knife, visit the Chef documentation and Learn Chef.

The chef Command

Our goal is for chef to become a workflow tool that builds on the ideas of Berkshelf to provide an awesome experience that encourages quick iteration and testing (and makes those things easy) and provides a way to easily, reliably, and repeatably roll out new automation code to your infrastructure.

While we've got a long way to go before we reach that goal we do have some helpful bits of functionality already included in the chef command:

chef generate

The generate subcommand generates skeleton Chef Infra code layouts so you can skip repetitive boilerplate and get down to automating your infrastructure quickly. Unlike other generators, it only generates the minimum required files when creating a cookbook so you can focus on the task at hand without getting overwhelmed by stuff you don't need.

The following generators are built-in:

  • chef generate cookbook Creates a single cookbook.
  • chef generate recipe Creates a new recipe file in an existing cookbook.
  • chef generate attribute Creates a new attributes file in an existing cookbook.
  • chef generate template Creates a new template file in an existing cookbook. Use the -s SOURCE option to copy a source file's content to populate the template.
  • chef generate file Creates a new cookbook file in an existing cookbook. Supports the -s SOURCE option similar to template.

The chef generate command also accepts additional --generator-arg key=value pairs that can be used to supply ad-hoc data to a generator cookbook. For example, you might specify --generator-arg database=mysql and then only write a template for recipes/mysql.rb if context.database == 'mysql'.

chef gem

chef gem is a wrapper command that manages installation and updating of rubygems for the Ruby installation embedded in the ChefDK package. This allows you to install knife plugins, Test Kitchen drivers, and other Ruby applications that are not packaged with ChefDK.

Gems are installed to a .chefdk directory in your home directory; any executables included with a gem you install will be created in ~/.chefdk/gem/ruby/2.1.0/bin. You can run these executables with chef exec, or use chef shell-init to add ChefDK's paths to your environment. Those commands are documented below.

chef exec

chef exec <command> runs any arbitrary shell command with the PATH environment variable and the ruby environment variables (GEM_HOME, GEM_PATH, etc.) setup to point at the embedded ChefDK omnibus environment.

chef shell-init

chef shell-init SHELL_NAME emits shell commands that modify your environment to make ChefDK your primary ruby. It supports bash, zsh, fish and PowerShell (posh). For more information to help you decide if this is desirable and instructions, see "Using ChefDK as Your Primary Development Environment" below.

chef install

chef install reads a Policyfile.rb document, which contains a run_list and optional cookbook version constraints, finds a set of cookbooks that provide the desired recipes and meet dependency constraints, and emits a Policyfile.lock.json describing the expanded run list and locked cookbook set. The Policyfile.lock.json can be used to install the cookbooks on another machine. The policy lock can be uploaded to a Chef Infra Server (via the chef push command) to apply the expanded run list and locked cookbook set to nodes in your infrastructure. See the POLICYFILE_README.md for further details.

chef push

chef push POLICY_GROUP uploads a Policyfile.lock.json along with the cookbooks it references to a Chef Infra Server. The policy lock is applied to a POLICY_GROUP, which is a set of nodes that share the same run list and cookbook set. This command operates in compatibility mode and has the same caveats as chef install. See the POLICYFILE_README.md for further details.

chef update

chef update updates a Policyfile.lock.json with the latest cookbooks from upstream sources. It supports an --attributes flag which will cause only attributes from the Policyfile.rb to be updated.

chef diff

chef diff shows an itemized diff between Policyfile locks. It can compare Policyfile locks from local disk, git, and/or the Chef Infra Server, based on the options given.

chef verify

chef verify tests the embedded applications. By default it runs a quick "smoke test" to verify that the embedded applications are installed correctly and can run basic commands. As an end user this is probably all you'll ever need, but verify can also optionally run unit and integration tests by supplying the --unit and --integration flags, respectively.

You can also focus on a specific suite of tests by passing it as an argument. For example chef verify git will only run the smoke tests for the git suite.

WARNING: The integration tests will do dangerous things like start HTTP servers with access to your filesystem and even create users and groups if run with sufficient privileges. The tests may also be sensitive to your machine's configuration. If you choose to run these, we recommend to only run them on dedicated, isolated hosts (we do this in our build cluster to verify each build).

Using ChefDK as Your Primary Development Environment

By default, ChefDK only adds a few select applications to your PATH and packages them in such a way that they are isolated from any other Ruby development tools you have on your system. If you're happily using your system ruby, rvm, rbenv, chruby or any other development environment, you can continue to do so. Just ensure that the ChefDK provided applications appear first in your PATH before any gem-installed versions and you're good to go.

If you'd like to use ChefDK as your primary Ruby/Chef Infra development environment, however, you can do so by initializing your shell with ChefDK's environment.

To try it temporarily, in a new terminal session, run:

eval "$(chef shell-init SHELL_NAME)"

where SHELL_NAME is the name of your shell (usually bash, but zsh is also common). This modifies your PATH and GEM_* environment variables to include ChefDK's paths (run without the eval to see the generated code). Now your default ruby and associated tools will be the ones from ChefDK:

which ruby
# => /opt/chefdk/embedded/bin/ruby

To add ChefDK to your shell's environment permanently, add the initialization step to your shell's profile:

echo 'eval "$(chef shell-init SHELL_NAME)"' >> ~/.YOUR_SHELL_PROFILE

Where YOUR_SHELL_PROFILE is ~/.bash_profile for most bash users, ~/.zshrc for zsh, and ~/.bashrc on Ubuntu.

Powershell

You can use chef shell-init with PowerShell on Windows.

To try it in your current session:

chef shell-init powershell | Invoke-Expression

To enable it permanently:

"chef shell-init powershell | Invoke-Expression" >> $PROFILE

Fish

chef shell-init also supports fish.

To try it:

eval (chef shell-init fish)

To permanently enable:

echo 'eval (chef shell-init SHELL_NAME)' >> ~/.config/fish/config.fish

Uninstallation Instructions

macOS

You can uninstall ChefDK on Mac using the below commands.

First, remove the main package files:

# Remove the installed files
sudo rm -rf /opt/chefdk

# Remove the system installation entry
sudo pkgutil --forget com.getchef.pkg.chefdk

Next, remove the symlinks which the ChefDK installs:

# Symlinks are in /usr/local/bin
ls -la /usr/local/bin | egrep '/opt/chefdk' | awk '{ print $9 }' | sudo xargs -I % rm -f /usr/local/bin/%

Windows

You can use Add / Remove Programs on Windows to remove the Chef Development Kit from your system.

RHEL

You can use rpm to uninstall ChefDK on RHEL based systems:

rpm -qa *chefdk*
yum remove <package>
rm -rf /opt/chefdk
rm -rf ~/.chefdk

Ubuntu

You can use dpkg to uninstall ChefDK on Ubuntu based systems:

dpkg --list | grep chefdk # or dpkg --status chefdk

# Purge chefdk from the system.
# see man dkpg for details
dpkg -P chefdk

Contributing

For information on contributing to this project see https://github.com/chef/chef/blob/master/CONTRIBUTING.md

For ChefDK Developers

See the Development Guide for how to get started with development on the ChefDK itself, as well as details on how dependencies, packaging, and building works.


More Repositories

1

cookbooks

DEPRECATED: This repository has been split up into separate repositories by cookbook under the "opscode-cookbooks" organization.
1,495
star
2

chef-repo

DEPRECATED: Use of this repository is deprecated. We recommend using the chef generate repo command that comes with ChefDK.
859
star
3

vagrant-omnibus

A Vagrant plugin that ensures the desired version of Chef is installed via the platform-specific Omnibus packages.
Ruby
551
star
4

devops-kungfu

Chef Style DevOps Kung fu
JavaScript
528
star
5

chef-provisioning

A library for creating machines and infrastructures idempotently in Chef.
Ruby
524
star
6

windows

Development repository for Chef Cookbook windows
Ruby
252
star
7

chef-fundamentals

DEPRECATED: Chef Fundamentals training materials
CSS
205
star
8

database

DEPRECATED: Development repository for Chef database cookbook
Ruby
186
star
9

chef-client

Development repository for Chef Client cookbook
Ruby
175
star
10

stove

DEPRECATED: A utility for packaging and releasing Chef cookbooks
Ruby
168
star
11

minitest-chef-handler

Run minitest suites after your Chef recipes to check the status of your system.
Ruby
164
star
12

knife-rackspace

Chef knife plug-in for Rackspace
Ruby
153
star
13

chef-rfc

Public RFCs for Chef and related projects
Ruby
148
star
14

chef-provisioning-aws

AWS driver and resources for Chef that uses the AWS SDK
Ruby
142
star
15

sudo

Development repository for sudo cookbook
Ruby
117
star
16

build-essential

Development repository for build-essential Chef Cookbook
Ruby
116
star
17

chef-api

DEPRECATED: A tiny Chef API client with minimal dependencies
Ruby
107
star
18

chef-provisioning-docker

Docker provisioner for chef-provisioning
Ruby
93
star
19

erchef

DEPRECATED: Erlang based Chef Server top-level OTP release project
Erlang
89
star
20

knife-acl

knife plugin for working with ACLs on Chef Server
Ruby
81
star
21

delivery-cli

The command line tool for the workflow capabilities in Chef Automate.
Rust
80
star
22

knife-linode

DEPRECATED: Chef knife plug-in for Linode
Ruby
78
star
23

omnibus-chef

Omnibus packaging for Chef
77
star
24

chef-web-docs-2016

DEPRECATED - All The Documentation
HTML
75
star
25

omnibus_updater

DEPRECATED: Chef cookbook to update the omnibus packaged Chef client
Ruby
74
star
26

openssl

Development repository for openssl cookbook
Ruby
74
star
27

terraform-provisioner-inspec

Terraform InSpec Provisioner Plugin
Go
68
star
28

rails-quick-start

DEPRECATED: Repository used with the Chef Rails Quick Start Guide
HTML
63
star
29

ubuntu

Development repository for Chef Cookbook ubuntu
Ruby
61
star
30

chef-vault

chef-vault cookbook
Ruby
61
star
31

route53

DEPRECATED: Provides resources for adding and removing records from Amazon Route53
Ruby
60
star
32

knife-container

DEPRECATED: Container support for Chef's Knife Command
Ruby
57
star
33

audit

Audit Cookbook for Chef Compliance
Ruby
57
star
34

chef-provisioning-fog

Fog driver for Chef Provisioning
Ruby
54
star
35

chef_nginx

Chef Software support NGINX cookbook
Ruby
53
star
36

quick-reference

quick reference documentation
52
star
37

ohai

Development repository for Chef Cookbook ohai
Ruby
49
star
38

chef_handler

DEPRECATED: Development repository for Chef Cookbook chef_handler
Ruby
49
star
39

dmg

Development repository for dmg Chef cookbook
Ruby
45
star
40

omnibus-chef-server

Deprecated: Omnibus packaging for Opscode Chef Server (OSC 11.x only).
Ruby
44
star
41

inspec-aws-old

[Deprecated] This is integrated in InSpec 2.0 now
Ruby
42
star
42

django-quick-start

DEPRECATED: Django Quick Start Guide Chef Repository
40
star
43

hubot

DEPRECATED: Chef cookbook for deploying and managing an instance of Github's Hubot.
Ruby
40
star
44

httpd

DEPRECATED: Library cookbook with Apache httpd primitives
Ruby
39
star
45

aws_native_chef_server

Cloudformation templates for building a scalable cloud-native Chef Server on AWS
Shell
37
star
46

delivery-truck

DEPRECATED: Delivery build cb for pipelines
Ruby
36
star
47

bluepill

Development repository for bluepill Chef Cookbook
Ruby
35
star
48

unicorn

DEPRECATED: Development repository for Chef Cookbook unicorn
Ruby
34
star
49

chef-server-cluster

DEPRECATED: Chef Cookbook to manage Chef Clusters
Ruby
33
star
50

opscode-packages

Packages of Opscode Software for various platforms
Ruby
33
star
51

openstack-chef-repo

DEPRECATED: Chef Repository for OpenStack
Ruby
32
star
52

cookbook-guide

Chef Technical Alliances guide for writing quality cookbooks
Ruby
31
star
53

tar

Deprecated: Chef cookbook for tar packages
Ruby
31
star
54

audit-cis

DEPRECATED: Recipes to perform chef audit mode check for CIS Benchmarks
Ruby
31
star
55

omnibus

Prepares a machine to be an Omnibus builder. ┬──┬◡ノ(° -°ノ)
Ruby
28
star
56

libarchive

Deprecated: A library cookbook for manipulating archive files
Ruby
28
star
57

resource

DEPRECATED: Easier, More Powerful Chef Resources
27
star
58

chef-sugar

Ruby
27
star
59

ruby

DEPRECATED: Chef Cookbook for Managing Ruby from Packages
Ruby
27
star
60

locale

Chef cookbook to configure the system locale on Linux systems
Ruby
26
star
61

chef-server-webui

DEPRECATED: Web Interface to Open Source Chef Server 11
JavaScript
24
star
62

private-chef-administration

DEPRECATED: Private Chef Administration Guide
Python
24
star
63

bookshelf

DEPRECATED: Minimal S3 Clone
Erlang
24
star
64

opscode-agent

Opscode Agent, providing RESTful and AMQP access to Chef and Ohai
Ruby
23
star
65

pantry-chef-repo

A Chef Repository For Pantry
Shell
22
star
66

habitat

Chef Cookbook for Habitat
Ruby
22
star
67

chef-provisioning-vagrant

Vagrant provisioner for chef-provisioning
Ruby
22
star
68

microsoft_azure

Windows Azure Cookbook for Chef
Ruby
21
star
69

chef-init

PID1 for your Chef containers
Ruby
21
star
70

knife-opc

Knife plugin for managing Chef Server Organizations
Ruby
21
star
71

zsh

DEPRECATED: Development repository for Chef Cookbook zsh
Ruby
21
star
72

push-jobs-cookbook

Development repository for Chef Cookbook push-jobs
Ruby
21
star
73

chef-provisioning-azure

DEPRECATED: Azure driver for chef-provisioning!
Ruby
21
star
74

delivery-cluster

DEPRECATED: Deployment cookbook for standing up Delivery clusters using chef-provisioning.
Ruby
20
star
75

gunicorn

DEPRECATED: Development repository for Chef Cookbook gunicorn
Ruby
20
star
76

dsc

DEPRECATED: Preview of PowerShell Desired State Configuration (DSC) integration with the Chef DSL
Ruby
19
star
77

cis-el7-l1-hardening

Hardening cookbook for CIS Level 1 for RHEL 7 based operating systems
Ruby
19
star
78

logwatch

Development repository for Chef Cookbook logwatch
Ruby
19
star
79

ec-metal

Chef Provisioning-based tool for creating, managing and testing Enterprise Chef HA clusters
Ruby
19
star
80

inspec-vmware

InSpec VMware Resource Pack (Incubation)
Ruby
19
star
81

whitelist-node-attrs

Look here:
Ruby
18
star
82

java-quick-start

DEPRECATED: Chef Java Quick Start Guide
18
star
83

community-summits

Wikis to capture notes for Community Summits
18
star
84

whitelist-node-attrs-cookbook

DEPRECATED: Development repository for whitelist-node-attrs cookbook
Ruby
18
star
85

activemq

Development repository for activemq Chef Cookbook
Ruby
18
star
86

chef-server-cloudformation-templates

Collection of AWS Cloudformation templates for installing Chef Server 12 on EC2
17
star
87

php-quick-start

DEPRECATED: PHP quickstart guide for Chef
17
star
88

knife-eucalyptus

Chef knife plug-in for Eucalyptus
Ruby
16
star
89

lambda_ebs_snapshot

Terraform config for automatic EBS snapshots
HCL
16
star
90

knife-push

knife commands for Chef Push Jobs
Ruby
16
star
91

opscode-pushy-server

Chef Push Jobs Server
Erlang
16
star
92

chef-provisioning-ssh

Provision Machines Via SSH or WinRM Using Chef Provisioning
Ruby
15
star
93

automeck

Streamlines setting up and using meck-based mocks
Erlang
15
star
94

compat_resource

Cookbook to bring some features from future Chef to earlier versions
Ruby
15
star
95

chef-container

Official build definitions for Chef's Docker images
Ruby
14
star
96

chef_wm

DEPRECATED repository. Now lives in chef-server.
Erlang
14
star
97

opscode-omnibus

Deprecated: Omnibus packaging for Chef Server - Use Chef Server Instead
Ruby
14
star
98

win32-sound

A Ruby library for playing and controlling sounds on MS Windows.
Ruby
13
star
99

chef-pedant

DEPRECATED Integration Test Suite for Chef Sever - replaced with oc-chef-pedant
Ruby
13
star
100

chef-server-solo-install

Bootstrap a Chef Server via Chef Solo
Ruby
13
star