Chef

Table Of Contents

About the Chef Server

The Chef server acts as a hub for configuration data. The Chef server stores cookbooks, the policies that are applied to nodes, and metadata that describes each registered node that is being managed by the chef-client. Nodes use the chef-client to ask the Chef server for configuration details, such as recipes, templates, and file distributions. The chef-client then does as much of the configuration work as possible on the nodes themselves (and not on the Chef server). This scalable approach distributes the configuration effort throughout the organization.

Components

Starting with the release of Chef 11.x, the front-end for the Chef server is written using Erlang, which is a programming language that first appeared in 1986, was open sourced in 1998, and is excellent with critical enterprise concerns like concurrency, fault-tolerance, and distributed environments. The Chef server can scale to the size of any enterprise and is sometimes referred to as Erchef.

The following diagram shows the various components that are part of a Chef server deployment and how they relate to one another.

_images/server_components.png
Component Description
Bookshelf

Bookshelf is used to store cookbook content—files, templates, and so on—that have been uploaded to the Chef server as part of a cookbook version. Cookbook content is stored by content checksum. If two different cookbooks or different versions of the same cookbook include the same file or template, Bookshelf will store that file only once. The cookbook content managed by Bookshelf is stored in flat files and is separated from the Chef server and search index repositories.

All cookbooks are stored in a dedicated repository.

WebUI chef-server-webui is a Ruby on Rails 3.0 application that hosts the web interface for the Chef server.
Erchef

Erchef is a complete rewrite of the core API for the Chef server, which allows it to be faster and more scalable than previous versions. The API itself is still compatible with the original Ruby-based Chef server, which means that cookbooks and recipes that were authored for the Ruby-based Chef server will continue to work on the Erlang-based Chef server. The chef-client is still written in Ruby.

Note

Even though the Chef server is authored in Erlang, writing code in Erlang is NOT a requirement for using Chef.

Message Queues

Messages are sent to the Search Index using the following components:

  1. RabbitMQ is used as the message queue for the Chef server. All items that will be added to the search index repository are first added to a queue.
  2. chef-expander is used to pull messages from the RabbitMQ queue, process them into the required format, and then post them to chef-solr for indexing.
  3. chef-solr wraps Apache Solr and exposes its REST API for indexing and search.

All messages are added to a dedicated search index repository.

Nginx Nginx is an open-source HTTP and reverse proxy server that is used as the front-end load balancer for the Chef server. All requests to the Chef server API are routed through Nginx.
PostgreSQL PostgreSQL is the data storage repository for the Chef server.

For the hosted Chef server, these components are mostly transparent because of the hosted interface for the Chef server. When the Chef server is deployed on-premises, these relationships can be more complex, depending on how the machines on which the Chef server will run need to be deployed.

Common Features

Each type of Chef server provides the following features:

Feature Description
Chef Server API The Chef server API is used to provide access to objects on the Chef server.
Data Bags A data bag is a global variable that is stored as JSON data and is accessible from a Chef server.
Environments An environment is a way to map an organization’s real-life workflow to what can be configured and managed when using Chef server.
Node Objects The node object consists of the run-list and node attributes, which is a JSON file that is stored on the Chef server. The chef-client gets a copy of the node object from the Chef server during each chef-client run and places an updated copy on the Chef server at the end of each chef-client run.
Roles A role is a way to define certain patterns and processes that exist across nodes in an organization as belonging to a single job function.
Search Search indexes allow queries to be made for any type of data that is indexed by the Chef server, including data bags (and data bag items), environments, nodes, and roles.
Chef Supermarket Chef Supermarket is the new community site for Chef, located at https://supermarket.getchef.com.

Premium Features

The following premium feature are available for use with the Chef server:

Feature Description
Chef Analytics Chef analytics provides real-time visibility into what is happening on the Chef server, including what’s changing, who made those changes, and when they occurred. Actions details are tracked on the Chef server and are visible to users from the Chef analytics web user interface.
Chef HA Availability supports out-of-the-box and custom high availability scenarios, including using DRBD and Amazon Web Services.
Chef Manage The Chef management console web user interface is used to manage objects that are stored on the Chef server, including data bags, attributes, run-lists, roles, environments, and cookbooks. Additionally, reports are views into what happened during every chef-client run that has occurred across all of the nodes that are under management by Chef.
Chef Push Jobs Chef push jobs allows jobs to be run against nodes independently of a chef-client run. A job is an action or a command to be executed against a subset of nodes; the nodes against which a job is run are determined by the results of a search query made to the Chef server.
Chef Replication Chef replication provides a way to asynchronously distribute cookbook, environment, role, and data bag data from a single, primary Chef server to one (or more) replicas of that Chef server.
Reporting The Chef reporting feature of the Chef server is used to keep track of what happened during the execution of chef-client runs across all of the infrastructure being managed by Chef. Reports can be generated for the entire organization and they can be generated for specific nodes.

The install subcommand is used to install premium features of the Chef server: Chef management console, Chef analytics, chef-client run reporting, high availability configurations, Chef push jobs, and Chef server replication.

This subcommand has the following syntax:

$ chef-server-ctl install name_of_premium_feature

where name_of_premium_feature represents the command line value associated with the premium feature: