forging great modules: standards, tools and patterns - puppetconf 2013

84
Forging Great Modules: Standards, Tools and Patterns Ryan Coleman Product Owner | Puppet Labs @ryanycoleman Friday, August 23, 13

Post on 18-Oct-2014

3.508 views

Category:

Technology


2 download

DESCRIPTION

"Forging Great Modules: Standards, Tools and Patterns" by Ryan Coleman, Product Owner, Puppet Labs. Presentation Overview: Your entire datacenter doesn't need to be lovingly hand-crafted Puppet manifests. Focus your time and energy on the specific, business enabling challenges. Puppet Labs runs the Puppet Forge, a community-driven collection of modules that let you do anything from build an entire OpenStack PaaS to provide you with an awesome new resource type. Come learn what the Forge is all about, where it's headed and how to build the next great module that will live amongst the 1300+ contributed by your peers. Ryan will cover the following and a little more. - What the Puppet Forge is and what you'll find there. - Module Design Patterns (e.g., parameter naming & puppet-lint) - Module Testing Frameworks and Practical Examples (e.g., rspec-puppet) - Iterative Development Tools and Practices - Forge Publishing Workflows (e.g., versioning & github) Speaker Bio: Ryan is a product owner at Puppet Labs, responsible for the Puppet Forge. He used Puppet at Penn State to keep up with demands in Penn State's central infrastructure teams before joining Puppet Labs as a professional services engineer. He has tackled building services like Shibboleth, MIT Kerberos, Samba and Zimbra across distributed environments on top of IBM's GPFS file system and would love to chat with you about solving problems with Puppet.

TRANSCRIPT

Page 1: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

Forging Great Modules: Standards, Tools and PatternsRyan ColemanProduct Owner | Puppet Labs @ryanycoleman

Friday, August 23, 13

Page 2: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Outline

• What’s Forge & What’s There

• Where the Forge is Going

• Module Writing Practices and Tips

Friday, August 23, 13

Page 3: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

What is the Puppet Forge?Just the basics

Friday, August 23, 13

Page 4: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf #PuppetCampFriday, August 23, 13

Page 5: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf #PuppetCamp

$ puppet help module

Friday, August 23, 13

Page 6: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf #PuppetCampFriday, August 23, 13

Page 7: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf #PuppetCampFriday, August 23, 13

Page 8: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Friday, August 23, 13

Page 9: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

The Puppet Forge TeamProfessional Blacksmiths

Friday, August 23, 13

Page 10: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Ryan ColemanProduct Owner

Friday, August 23, 13

Page 11: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Melinda CampbellUser Experience Designer

Friday, August 23, 13

Page 12: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Alex DreyerPieter Van De BrugenForge Engineering

Friday, August 23, 13

Page 13: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Hunter HaugenAshley PenneyForge Module Engineering

Friday, August 23, 13

Page 14: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

Recent UpdatesSlowly but surely, we’re getting there!

Friday, August 23, 13

Page 15: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Friday, August 23, 13

Page 16: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Friday, August 23, 13

Page 17: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Friday, August 23, 13

Page 18: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Friday, August 23, 13

Page 19: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Top Ten Search Terms

Friday, August 23, 13

Page 20: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Puppet Labs Module Engineering

Friday, August 23, 13

Page 21: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

Coming Soonto a forge near you

Friday, August 23, 13

Page 22: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Quality Over Quantity

Friday, August 23, 13

Page 23: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Friday, August 23, 13

Page 24: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

• Module Quality Design Jam

• Friday 4:20 - 6:00

• Hunt (Mezzanine Level)

• http://sched.co/17fAJn7

Friday, August 23, 13

Page 25: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Friday, August 23, 13

Page 26: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Tools built with the Forge API

• Geppetto IDE

• librarian-puppet

• `puppet module`

• R10K

• MaestroDev Blacksmith

Friday, August 23, 13

Page 27: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

Email me or talk to me about the API!

[email protected]

Friday, August 23, 13

Page 28: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Email [email protected] for a Travis-driven preview

Friday, August 23, 13

Page 29: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

GitHub Flavored

Markdown on Forge!

Friday, August 23, 13

Page 30: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Supported Puppet Labs

Modules

Friday, August 23, 13

Page 31: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

The Puppet Forge Extended FamilyArtisan and Apprentice Blacksmiths

Friday, August 23, 13

Page 32: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Friday, August 23, 13

Page 33: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Friday, August 23, 13

Page 34: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf #PuppetCampFriday, August 23, 13

Page 35: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf #PuppetCampFriday, August 23, 13

Page 36: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Friday, August 23, 13

Page 37: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Friday, August 23, 13

Page 38: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Friday, August 23, 13

Page 39: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Friday, August 23, 13

Page 40: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Friday, August 23, 13

Page 41: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Friday, August 23, 13

Page 42: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

CLI! Ruby Code!Functions!

Oh My!

Friday, August 23, 13

Page 43: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

Development Tools

Friday, August 23, 13

Page 44: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

Friday, August 23, 13

Page 45: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

TextMate w/Puppet!

Friday, August 23, 13

Page 46: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Vim

• vim-pathogen or vundle (for plugins)

• snipmate (like TextMate)

• tabular

• syntastic

• mv-vim-puppet

Friday, August 23, 13

Page 47: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

Module Design PatternsSome thoughts to guide you in the right direction

Friday, August 23, 13

Page 48: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Keep it modular

Friday, August 23, 13

Page 49: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

An Example: PuppetDB

Friday, August 23, 13

Page 50: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

Class Layout and Namingthe boring stuff

Friday, August 23, 13

Page 51: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Text

http://ruth-tay.deviantart.com/art/Hydra-121089045

Friday, August 23, 13

Page 52: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

Public vs (pseudo) Private Classes

Friday, August 23, 13

Page 53: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Private classes should be discrete

Friday, August 23, 13

Page 54: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Public classes are for parameters,

validation and interacting with private classes.

Friday, August 23, 13

Page 55: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

https://github.com/stdmod/puppet-modulesA community-driven effort to standardize on param names

Friday, August 23, 13

Page 56: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

Friday, August 23, 13

Page 57: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf #PuppetCamp

The Style Guide

Friday, August 23, 13

Page 58: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf #PuppetCampFriday, August 23, 13

Page 59: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf #PuppetCampFriday, August 23, 13

Page 60: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf #PuppetCampFriday, August 23, 13

Page 61: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf #PuppetCampFriday, August 23, 13

Page 62: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

Style Guide Update Soon!Email suggestions/feedback to [email protected]

Friday, August 23, 13

Page 63: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

Documentationthe most important part!

Friday, August 23, 13

Page 64: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Answer these questions

• What technology does your module manage?

• What does it intend to do?

• How does it do it? (impact on the system)

• How should one use it?

Friday, August 23, 13

Page 66: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

Module Testingbecome a mad scientist!

Friday, August 23, 13

Page 67: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

http://www.dsrsd.com/img/img_wwrw/Sewer_Web.png

Smoke Testing

Friday, August 23, 13

Page 68: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

puppet apply ./tests/apache.pp

Friday, August 23, 13

Page 69: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

http://www.pieterg.com/Media/277

Unit Testing

Friday, August 23, 13

Page 70: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Friday, August 23, 13

Page 71: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Friday, August 23, 13

Page 72: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf http://robots.thoughtbot.com/post/33771089985/rspec-integration-tests-with-capybara

Integration Testing

Friday, August 23, 13

Page 73: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Friday, August 23, 13

Page 74: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

Versioning & Releasing

Friday, August 23, 13

Page 75: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Semantic Versioning

• Based on Major.Minor.Patch scheme

• X.0.0 Major version for breaking change

• 0.X.0 Minor version for new non-breaking functionality

• 0.0.X Patch version for backwards compatible bug fixes

Friday, August 23, 13

Page 76: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

Data In-ModulesOverview & Call To Action

Friday, August 23, 13

Page 77: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Params.pp Meet

Hiera Data

./data/operatingsystem/Amazon.yaml

Friday, August 23, 13

Page 78: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Why put Hiera in modules?

• Eliminate the params.pp pattern

• Allow for swappable data sets

• Introspect data in ruby code

• ??? <--- we need your help

Friday, August 23, 13

Page 79: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

http://links.puppetlabs.com/bgtm

Friday, August 23, 13

Page 80: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

Friday, August 23, 13

Page 81: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Network Too!

Friday, August 23, 13

Page 82: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

• forge.puppetlabs.com/puppetlabs/gce_compute

• certname == GCE project ID

Friday, August 23, 13

Page 83: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

Thank YouRyan ColemanProduct Owner | Puppet Labs@ryanycoleman

Collaborate. Automate. Ship.

Friday, August 23, 13

Page 84: Forging Great Modules: Standards, Tools and Patterns - PuppetConf 2013

puppetconf.com #puppetconf

Don’t Forget...• Beginners Guide to Writing Modules!

• links.puppetlabs.com/bgtm

• Design Jam on Module Quality

• http://sched.co/16C7ET3

• Spend your GCE Credit with our Module!

• http://forge.puppetlabs.com/puppetlabs/gce_compute

• forge.puppetlabs.com Ryan ColemanProduct Owner | Puppet Forge@[email protected]

Friday, August 23, 13