modern module development

30
Modern Module Development Morgan Haskel | Puppet Labs @KnittyNerd

Upload: morgan

Post on 15-Jul-2015

406 views

Category:

Technology


0 download

TRANSCRIPT

Modern Module Development

Morgan Haskel | Puppet Labs @KnittyNerd

Definitions

• ‘Module’ - code to install and configure a single piece of software

• ‘Roles and Profiles’ - code to compose modules in a more site-specific manner

How Did We Get Here?

• Before the forge

• Early forge

• Today

What Now?

• Deploying a new technology != writing a new module

• Start with the Puppet Forge

• Check GitHub

Module Evaluation

Supported Modules

• Extensively tested

• Platform compatibility

• Widely used

• Actively maintained

Approved Modules• Nominated by module authors or community

members

• Nominations reviewed by modules team

• Checked for functionality and following best practices

• Evaluated against comparable modules

• Nominate a module you love today!

Module Scoring System

• Lint checking

• Puppet compatibility

• Metadata checking

• Community ratings

Does It Work For You?

• Check the module documentation

• See if the module can generate your existing configuration

• How customizable is it?

Other Checks

• Is the module actively maintained?

• Are issues and pull requests responded to?

• Can the module get you close to your configuration?

• Does the module follow best practices?

Starting From Scratch

Write The Module You Want

• Writing generic modules is hard

• Iterative development helps

• You don’t have to do it alone

Scoping, Scoping, Scoping

• Only manage a single thing

• Avoid monolithic modules

• Tighter scope == greater flexibility

Checking Your Work

• Unit and acceptance tests for all new modules

• Unit tests for most new features

• Acceptance tests for new big features

• Lower overhead

• Verify against catalog

• Test for compilation

• Exercise parameters

• More overhead

• Verify against running system

• Full path test of software

• Check for config correctness

Unit Tests Acceptance Tests

Danger Zone

Do not run acceptance tests anywhere but on a test system or virtual machine.

Acceptance tests occasionally have bugs that can be very destructive (rm -rf /)

Upkeep• Test new code and

updates to existing code

• Regression tests are important

Documentation

• Especially important with shared code

• Don’t forget in code comments

Life After ReleaseModule work isn’t done yet.

puppet-community

• GitHub organization

• Modules and tooling maintained by and for the Puppet community

• Reach out to @daenney and @hirojin if you need more information!

Development Toolkit

• Brand New Puppet Language Style Guide

• Consistency with ModuleSync

• #puppet-dev on freenode

Roles and Profiles

Putting It All Together

When in doubt, add additional layers of abstraction.

• Each node has a single role

• Each role is composed of one or many profiles

• Each profile is composed of other profiles or modules

An Example

Improving the Ecosystem

Find and get involved in a local Puppet User Group!

Links!• Nominate approved: https://tickets.puppetlabs.com/browse/

MODULES/component/12141

• Style Guide: https://docs.puppetlabs.com/guides/style_guide.html

• ModuleSync: https://github.com/puppetlabs/modulesync

• puppet-community: http://puppet-community.github.io/

• Roles and Profiles: http://www.craigdunn.org/2012/05/239/

• Puppet User Group: http://puppetlabs.com/community/PUG

Questions?