Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

poise-appenv (1) Versions 1.0.0

Helper library to configure application-specific environment settings

Policyfile
Berkshelf
Knife
cookbook 'poise-appenv', '~> 1.0.0', :supermarket
cookbook 'poise-appenv', '~> 1.0.0'
knife supermarket install poise-appenv
knife supermarket download poise-appenv
README
Dependencies
Quality 29%

poise-appenv

Build Status

Quick Start

Attributes

In your [default attributes file](test/cookbooks/poise-appenv_test/attributes/default.rb#L19)
configure the name of the cookbook that determines your application environment:

default['poise-appenv']['cookbook'] = 'role-myapp'

Then create one attribute file for each [app_environment](test/cookbooks/poise-appenv_test/attributes/prod.rb#L19-L20)
with a header like:

include_attribute 'role-myapp'
return unless node.app_environment?('prod')

This header will prevent executing the file unless the app_environment
matches the given name(s). Put any shared attributes on the default.rb file
and per-app_environment attribute in the relevant file.

Recipes

The cookbook specified in node['poise-appenv']['cookbook'] is used to determine
which app_environment we are in. Each recipe within the cookbook maps to an
app_environment of that name, so adding role-myapp::prod to the run list
will mark the node as being in the prod app_environment. If you add plain
role-myapp to the run list, it will use the name of the chef_environment.

To accomplish this you need to create stub recipes like [recipes/prod.rb](test/cookbooks/poise-appenv_test/recipes/prod.rb)
which just include the default recipe:

include_recipe 'role-myapp'

The default recipe should contain the normal code for installing your application,
generally this will be one more include_recipe to other cookbooks.

Application Environments

Application environments offer a way to have different node attributes applied
via a cookbook. Combined with role or environment cookbooks
this lets you separate the varying configuration of an application in different
deployment scenarios from the code to install the application.

As a concrete example, imagine you have two Chef environments; prod and test.
You run a cluster of servers in each environment with your application installed.
Now you want to launch a new cluster in your test environment running an
experimental build and divert some portion of traffic to it. You could create
a new Chef environment by copying the existing test one, but almost all the
settings will be the same, only the version to deploy and similar attributes
need to be overridden for the new servers. Application environments give you
a way to apply those customizations.

Reference

node.app_environment(cookbook=nil)

node.app_environment returns the name of the detected application environment
based on the given or configured cookbook. Note that this is a method, not a
node attribute.

node.app_environment?(*names)

node.app_environment? returns true if the current application environment
is any of the given names.

node['poise-appenv']['cookbook']

node['poise-appenv']['cookbook'] is a node attribute used to configure which
cookbook is searched for to determine the current application environment.

Why?

Why not just use Chef environments? Sometimes you want to deploy slightly
different applications in the same Chef environment. An example would be
launching a new branch of your code in the test environment. You could copy the
Chef environment and tweak the settings you want, but this results in a lot of
duplicated configuration which is error prone and difficult to update.
Additionally, even though it is slightly different, this hypothetical new
application cluster is still semantically in the "test" environment, and
currently Chef environments don't have any kind of heirarchical relationship.

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

Collaborator Number Metric
            

1.0.0 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

1.0.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Foodcritic Metric
            

1.0.0 failed this metric

FC064: Ensure issues_url is set in metadata: poise-appenv/metadata.rb:1
FC065: Ensure source_url is set in metadata: poise-appenv/metadata.rb:1
FC066: Ensure chef_version is set in metadata: poise-appenv/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: poise-appenv/metadata.rb:1
FC069: Ensure standardized license defined in metadata: poise-appenv/metadata.rb:1
Run with Foodcritic Version 16.3.0 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

No Binaries Metric
            

1.0.0 passed this metric

Supported Platforms Metric
            

1.0.0 failed this metric

poise-appenv should declare what platform(s) it supports.

Testing File Metric
            

1.0.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

1.0.0 passed this metric