loading table of contents...

4.1.6.3. Chef

As already mentioned earlier, Chef is used as the provisioning tool of choice to fully automate the deployment process of CoreMedia applications. Chef is a widely adopted configuration management framework, that has a steadily growing community and provides free installation instructions (cookbooks) for almost any kind of applications or infrastructures.

To learn more about the Chef configuration management tool please refer to the official Chef documentation at https://docs.chef.io/.

Chef Repository

The CoreMedia Blueprint workspace provides a Chef infrastructure to manage a complex CoreMedia installation. The parts of the infrastructure are grouped as a Chef repository, a directory layout convention required to work with chef-server, the central management facility for complex deployments. The chef-repo directory is located at boxes/chef/chef-repo and consists of the following subdirectories:

  • cookbooks, the logical deployment unit for Chef recipes.

  • roles, a Chef construct to bundle recipe executions together with configuration attributes.

  • data_bags containing data files structured as JSON files.

  • environments a further topology based grouping construct of Chef.

The chef-repo directory contains README.md files which are part of the official chef-repo template. They contain instructions how to use the different constructs.

[Note]Note

For the development setup with Vagrant, chef-solo is currently used as the provisioner, because it is easier to start with. The chef-repo though, is prepared to use with chef-server. To work with both environments, there are extra recipes, that use the chef-server search capabilities to dynamically connect nodes applications by querying nodes by their roles. These recipes have the suffix _override and cannot be used together with Vagrant.

Cookbooks

The chef-repo directory contains all necessary cookbooks to set up a CoreMedia installation. This includes third-party community cookbooks from the official Chef Supermarket site. The cookbooks found there are being released regularly and CoreMedia strives to update the dependencies in the workspace for every distribution release of CoreMedia Blueprint.

In the boxes/chef/chef-repo/cookbooks directory you will find cookbooks provided by CoreMedia:

  • The blueprint-yum cookbook configures the yum package management.

  • The coremedia cookbook handles the deployment and configuration of all CoreMedia applications.

  • The psdash cookbook installs and configures the PSDash processes dashboard. This cookbook is primary for development purposes, where quick insights into the log files or the basic system statistics are helpful. The dashboard can be accessed at http://localhost:8999.

CoreMedia Cookbook

The coremedia cookbook is located at boxes/chef/chef-repo/cookbooks/coremedia and contains the full spectrum of Chef constructs, this includes:

  • recipes as the installation instructions to be executed by chef.

  • attributes containing the default configuration attributes for all recipes.

  • resources (lightweight resources LWR) to compose new recipes from. Currently there are resources for configuration, content, probedog and workflows. For a more detailed description view the boxes/chef/chef-repo/cookbooks/coremedia/README.md file written in markdown syntax, a common standard for cookbook documentation.

  • providers (lightweight providers LWP), the implementation of the LWRs.

  • definitions as a macroized recipe, to reduce the repetitive declaration of Chef resources in every recipe.

  • libraries for concrete ruby implementation of Chef APIs.

  • templates to render files with parameters to disk.

The recipes of the coremedia cookbook install either logical units of deployment or configure infrastructure or third-party services.

The recipes installing CoreMedia services are very similar, they all contain one or more package resources installing the service and tool RPMs and a service resource responsible for the lifecycle of the service. If present, a probedog resource watches the availability of the service after it has been (re-)started.

In more complex recipes, the content_management_server or the workflow_server recipe, for instance, the additional resources and providers (LWRP) are being used to either import and publish content or upload workflows. The reference about the configuration possibilities of those recipes can also be found in the README.md file.

The configuration resource is responsible for configuring the CoreMedia services and tools. It represents a Chef facade for the configuration properties files located below /etc/coremedia on the target machine and triggers the reconfiguration process when necessary.

By default, all Chef attributes, together with all information gathered by Chefs inspection tool ohai are merged together into one JSON data structure for each Chef node. By defining additional attributes either in roles or environments, you can extend this set. The configuration resource accesses all attributes found below the nested hash at node['coremedia']['configuration'] and compares the ones required for an application with the ones found currently on disk. If both sets don't match, the resource will trigger the reconfiguration of the resource.

All keys listed in the packages/src/main/filters/default-deployment.properties file are available for configuration. If, for example, you may want to change the value of the JVM heap size of the Content Management Server, you need to set your desired value with the key configure.CMS_HEAP. In the boxes/chef/vagrant-chef-repo/roles/management.rb, you can see, how it is done for the vagrant deployment.

Roles

Recipes that should run together on one node are grouped together with attributes into Chef roles. In the boxes/chef/vagrant-chef-repo/roles directory, you find roles configured only for the Vagrant development setup.