Skip to content

Latest commit

 

History

History
144 lines (108 loc) · 12.1 KB

cf-health-check.md

File metadata and controls

144 lines (108 loc) · 12.1 KB

CFEngine Health Check

Purpose: Provide CFEngineers with a compact checklist for assessing CFEngine health.

Bibliography This document is based on the following best-practice guides:

Contributors:

  • Aleksey Tsalolikhin
  • Nick Anderson
  • Neil Watson
  • Joe Moore

Writing Policy

Thinking CFEngine

Style

Make and Use Libraries

Document

  • Always document the intention of your promises using "comment" attribute.
  • Use "promisees" to document who or what will be impacted by your promises.
  • Use "meta" promises and attributes to document metadata such as who wrote the code, when, etc. (e.g. meta => { "author=John Smith", "version="2.0" }; )

Classes Promises

  • Classify your system before making changes to it. (Put class bundles first in bundlesequence.)
  • Put classes in common bundles when you need to use them in multiple bundles. When should classes be in common bundles?

Variables Promises

Commands Promises

Files Promises

Collaborating with others

Handling secrets

Smart system administration

Misc.

Quality Control / Testing

  • Use editor plugins to provide syntax highlighting to catch errors early.
  • Use a pre-commit hook to catch errors early. Or use automated testing of policy (Jenkins, etc.) before distributing it. Check syntax with cf-promises
  • Try to test formally, including unit tests.
  • Test on multiple architectures. Use reporting for scale.

Making Changes to Production

Preparation

Execution

Hub health

  • Run your CFEngine Postgres database on a dedicated SSD for best performance.
  • Set "splaytime" to reduce load on your hub.
  • Monitor Hub server utilization to make sure it's within normal parameters with room to spare.
  • Have more than one hub in case your hub dies or has hardware issues, of the same grade of hardware so it can handle full production load.
  • Make CFEngine policy servers in redundant pairs. http://evolvethinking.com/cfengine-best-practices-deployment-upgrades-and-scaling/
  • Clean up your hub to remove entries for nodes that have been decommissioned (to improve hub performance and increase readability for humans).
  • Try to stay up to date on your CFEngine software version as the software is continously improved.
  • Don't install CFEngine RPM onto an image and then "bake" and deploy the image; same key on nodes = management headaches and hub performance issues.

Upgrades

Using CFEngine

TODO

When this document settles down, open a pull request to https://github.com/cfengine/documentation/ in https://github.com/cfengine/documentation/tree/master/guide/writing-and-serving-policy