Two chef nodes (two environments) on one machine

chef

We are resource limited here, and want our qa and staging environments on one machine.

We are going to run separate binaries and confs for our app & supporting services.

According to chef docs it is possible to have a single machine be two nodes. It just never explains how.

Much appreciated!

Best Answer

You'll need to execute chef client with an alternative configuration. The default config file and directory is /etc/chef/client.rb. You could use that one for one of the nodes / environments. Let's assume that will be "staging". You should probably make sure the node and environment are set up for the proper values:

node_name "mynode.staging"
environment "staging"

The other you could create such as /etc/chef/qa/client.rb for your qa configuration. In order to avoid conflict, you'll need to change the various configuration values for Chef that point in /etc/chef, and /var/chef.

See the Chef Configuration Settings wiki page for a complete list of configuration settings you can modify.

You should use the node_name and environment values similar to the staging environment. When you run chef, specify the alternative configuration file.

chef-client -c /etc/chef/qa/client.rb

Related Topic