cookbook 'chef-server', '= 2.0.1'
Installs and configures Chef Server 12
cookbook 'chef-server', '= 2.0.1', :supermarket
knife supermarket install chef-server
knife supermarket download chef-server
This cookbook configures a system to be a Chef Server. It will install
the appropriate platform-specific chef-server Omnibus package and
perform the initial configuration of Chef Server.
Omnibus-based Chef-Server Overview
To understand how this cookbook works it is useful to understand how a
Chef Server instance installed via Omnibus packages behaves.
Know an Omnibus
Omnibus allows you to build self-contained full-stack software
packages. We use Omnibus to to distribute the Chef Server bundled with
its dependencies such as Erlang, Ruby, PostgreSQL, RabbitMQ, and
Nginx. The result is a single package that can be installed on the
target system and configured.
Omnibus packages separate the installation step from the configuration
step. After an Omnibus package is installed, a configuration step must
be run before the installed system can be used. In particular, this
approach makes handling upgrades easier.
Configuring Chef Server
Chef Server is configured through the
/etc/chef-server/chef-server.rb file. Standalone single-server
configurations do not require custom configuration and can use the
default values for everything.
You can read all about Chef Server's
Applying configuration changes
chef-server-ctl reconfigure command reads the
/etc/chef-server/chef-server.rb file and applies the specified
configuration to the system. Any time you make a change to your
configuration, you need to run
chef-server-ctl reconfigure to apply
Omnibus-based Chef Server installs have a command line utility,
chef-server-ctl, which is used to operate the Chef Server. For
example, you can use
chef-server-ctl to start and stop individual
services, reconfigure the entire server, and tail server log files.
chef-server-ctl commands are documented below:
$ chef-server-ctl COMMAND
|Print a list of all the available chef-server-ctl commands.
|Shows the status of the Chef Server services.
|Start all the enabled Chef Server services.
|Stop all the enabled Chef Server services.
|Restart all the enabled chef server services.
|Follow the Chef Server logs for all services.
|Executes, chef-pedant, the integration test suite against the Chef Server installation. By default only a subset of tests are run, add the
--all flag to run the full test suite.
The status, start, stop, restart, and tail commands can optionally be
applied to a single service by adding the service name to the end of
the command line. For example, to get the status of the erchef
component of Chef Server, you can run:
chef-server-ctl status erchef
Chef Server Omnibus packages are available for the following platforms:
- CentOS 5 64-bit
- CentOS 6 64-bit
- Ubuntu 10.04, 10.10 64-bit
- Ubuntu 11.04, 11.10 64-bit
- Ubuntu 12.04, 12.10 64-bit
The attributes used by this cookbook are under the
chef-server name space.
|Fully qualified domain name that you want to use for accessing the Web UI and API.
|Configuration values to pass down to the underlying server config file (i.e.
|Location of the Omnibus package to install. This should not be set if you wish to pull the packages from the Omnitruck S3 bucket.
|SHA256 checksum of package referenced by
|Chef Server version to install. This value is ignored if
package_file is set.
|Indicates prerelease builds should be downloaded from Omnitruck. Prerelease builds come out in the weeks leading up to a major release. Prereleases offer an early preview of the next upcoming stable release and are intended for testers and advanced users. This value is ignored if
package_file is set.
|Indicates nightly builds should be downloaded from Omnitruck. Nightly builds of chef-server usually come out every night, but may be less frequent if there are no changes to the code, or the CI infrastructure is unable to create a build that day. The nightly builds are intended for testing only. This value is ignored if
package_file is set.
This section describes the recipes in the cookbook and how to use them
in your environment.
- Installs the appropriate platform-specific chef-server Omnibus package.
- Creates the initial
- Performs initial system configuration via
Omnibus package selection is done based on the following logic:
- If a value has been provided, the chef-server Omnibus package is
node['chef-server']['package_file']is unset (ie nil or empty string), the candidate package is retrieved from the Omnitruck REST API based on
node['chef-server']['version']AND the node platform, platform_version and architecture. By default the latest package is installed. If you would like to download pre-release or nightly builds set appropriate attribute to
This recipe converts a Chef Server installation into development mode
for easy hacking on the underlying server components. This recipe should
not be run on a production server.
This recipe will place checkouts for all of Chef Server's main
software components at
/opt/chef-server-dev/code. These component
checkouts will also be symlinked into the underlying Chef Server
installation. Changes made to component code will be reflected in the
running Chef Server instance (most often only after a restart of the
Bootstrap Chef (server) with Chef (solo)
The easiest way to get a Chef Server up and running is to install
chef-solo (via the chef-client Omnibus packages) and bootstrap the
system using this cookbook:
# install chef-solo
curl -L https://www.opscode.com/chef/install.sh | sudo bash
# create required bootstrap dirs/files
mkdir -p /var/chef/cache /var/chef/cookbooks/chef-server
# pull down this chef-server cookbook
wget -qO- https://github.com/opscode-cookbooks/chef-server/archive/master.tar.gz | tar xvzC /var/chef/cookbooks/chef-server --strip-components=1
# GO GO GO!!!
chef-solo -o 'recipe[chef-server::default]'
If you need more control over the final configuration of your Chef
Server instance you can create a JSON attributes file and set
underlying configuration via the
node['chef-server']['configuration'] attribute. For example, you can
disable the webui with the following configuration:
"run_list": [ "recipe[chef-server::default]" ]
}' > /tmp/no-webui.json
You would then pass this file to the initial chef-solo command:
chef-solo -j /tmp/no-webui.json
Demo Chef Server with Vagrant and Berkshelf
We <3 the wonderful open-source tools
Vagrant. You can take Chef Server for a spin
using the Berksfile and Vagrantfile that ship alongside this cookbook.
The only requirements for standing up a virtualized Chef Server are:
- VirtualBox - native packages exist for most platforms and can be downloaded from the VirtualBox downloads page.
- Vagrant 1.3.2+ - native packages exist for most platforms and can be downloaded from the Vagrant downloads page.
$ vagrant plugin install vagrant-berkshelf $ vagrant plugin install vagrant-omnibus
Once the pre-requisites are installed you can start the virtualized environment
with the following command:
$ vagrant up
Although things have only been tested with Vagrant's
everything should work with other providers like
You can easily SSH into the running VM using the
vagrant ssh command.
The VM can easily be stopped and deleted with the
command. Please see the official
Vagrant documentation for a more
in depth explanation of available commands.
The running Chef-Server components are accessible from the host machine
using the following URLs:
- Web UI: https://184.108.40.206/ (Note: Attempts to hit via straight http will be redirected to the Vagrant guest's internal hostname)
- Version Manifest: https://220.127.116.11/version
- Chef Server API (routing requires
X-OPS-USERIDHTTP header being properly set): https://18.104.22.168/
Note: It can be helpful to use the host workstation's /etc/hosts file to map
22.214.171.124 to chef-server-berkshelf.
Contribute to and Hack on Chef Server (including Erchef)
This cookbook ships with a recipe named
dev that will take any Chef
Server instance and flip it into development mode. If you want to use
the Vagrant-based environment referenced above, edit the
value in the
Vagrantfile to include an additional
recipe[chef-server::dev] run list item.
LICENSE AND AUTHORS
- Author: Seth Chisamore email@example.com
Copyright 2012, Opscode, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
This cookbook has no specified dependencies.