forging great modules: standards, tools and patterns - puppetconf 2013
Post on 18-Oct-2014
3.508 views
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
Forging Great Modules: Standards, Tools and PatternsRyan ColemanProduct Owner | Puppet Labs @ryanycoleman
Friday, August 23, 13
puppetconf.com #puppetconf
Outline
• What’s Forge & What’s There
• Where the Forge is Going
• Module Writing Practices and Tips
Friday, August 23, 13
What is the Puppet Forge?Just the basics
Friday, August 23, 13
puppetconf.com #puppetconf #PuppetCampFriday, August 23, 13
puppetconf.com #puppetconf #PuppetCamp
$ puppet help module
Friday, August 23, 13
puppetconf.com #puppetconf #PuppetCampFriday, August 23, 13
puppetconf.com #puppetconf #PuppetCampFriday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
The Puppet Forge TeamProfessional Blacksmiths
Friday, August 23, 13
puppetconf.com #puppetconf
Ryan ColemanProduct Owner
Friday, August 23, 13
puppetconf.com #puppetconf
Melinda CampbellUser Experience Designer
Friday, August 23, 13
puppetconf.com #puppetconf
Alex DreyerPieter Van De BrugenForge Engineering
Friday, August 23, 13
puppetconf.com #puppetconf
Hunter HaugenAshley PenneyForge Module Engineering
Friday, August 23, 13
Recent UpdatesSlowly but surely, we’re getting there!
Friday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
puppetconf.com #puppetconf
Top Ten Search Terms
Friday, August 23, 13
puppetconf.com #puppetconf
Puppet Labs Module Engineering
Friday, August 23, 13
Coming Soonto a forge near you
Friday, August 23, 13
puppetconf.com #puppetconf
Quality Over Quantity
Friday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
puppetconf.com #puppetconf
• Module Quality Design Jam
• Friday 4:20 - 6:00
• Hunt (Mezzanine Level)
• http://sched.co/17fAJn7
Friday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
puppetconf.com #puppetconf
Tools built with the Forge API
• Geppetto IDE
• librarian-puppet
• `puppet module`
• R10K
• MaestroDev Blacksmith
Friday, August 23, 13
Email me or talk to me about the API!
Friday, August 23, 13
puppetconf.com #puppetconf
Email [email protected] for a Travis-driven preview
Friday, August 23, 13
puppetconf.com #puppetconf
GitHub Flavored
Markdown on Forge!
Friday, August 23, 13
puppetconf.com #puppetconf
Supported Puppet Labs
Modules
Friday, August 23, 13
The Puppet Forge Extended FamilyArtisan and Apprentice Blacksmiths
Friday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
puppetconf.com #puppetconf #PuppetCampFriday, August 23, 13
puppetconf.com #puppetconf #PuppetCampFriday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
puppetconf.com #puppetconf
CLI! Ruby Code!Functions!
Oh My!
Friday, August 23, 13
Development Tools
Friday, August 23, 13
Friday, August 23, 13
puppetconf.com #puppetconf
TextMate w/Puppet!
Friday, August 23, 13
puppetconf.com #puppetconf
Vim
• vim-pathogen or vundle (for plugins)
• snipmate (like TextMate)
• tabular
• syntastic
• mv-vim-puppet
Friday, August 23, 13
Module Design PatternsSome thoughts to guide you in the right direction
Friday, August 23, 13
puppetconf.com #puppetconf
Keep it modular
Friday, August 23, 13
An Example: PuppetDB
Friday, August 23, 13
Class Layout and Namingthe boring stuff
Friday, August 23, 13
puppetconf.com #puppetconf
Text
http://ruth-tay.deviantart.com/art/Hydra-121089045
Friday, August 23, 13
Public vs (pseudo) Private Classes
Friday, August 23, 13
puppetconf.com #puppetconf
Private classes should be discrete
Friday, August 23, 13
puppetconf.com #puppetconf
Public classes are for parameters,
validation and interacting with private classes.
Friday, August 23, 13
https://github.com/stdmod/puppet-modulesA community-driven effort to standardize on param names
Friday, August 23, 13
Friday, August 23, 13
puppetconf.com #puppetconf #PuppetCamp
The Style Guide
Friday, August 23, 13
puppetconf.com #puppetconf #PuppetCampFriday, August 23, 13
puppetconf.com #puppetconf #PuppetCampFriday, August 23, 13
puppetconf.com #puppetconf #PuppetCampFriday, August 23, 13
puppetconf.com #puppetconf #PuppetCampFriday, August 23, 13
Style Guide Update Soon!Email suggestions/feedback to [email protected]
Friday, August 23, 13
Documentationthe most important part!
Friday, August 23, 13
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
http://docs.puppetlabs.com/puppet/3/reference/modules_documentation.html
Friday, August 23, 13
Module Testingbecome a mad scientist!
Friday, August 23, 13
puppetconf.com #puppetconf
http://www.dsrsd.com/img/img_wwrw/Sewer_Web.png
Smoke Testing
Friday, August 23, 13
puppetconf.com #puppetconf
puppet apply ./tests/apache.pp
Friday, August 23, 13
puppetconf.com #puppetconf
http://www.pieterg.com/Media/277
Unit Testing
Friday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
puppetconf.com #puppetconf http://robots.thoughtbot.com/post/33771089985/rspec-integration-tests-with-capybara
Integration Testing
Friday, August 23, 13
puppetconf.com #puppetconf
Friday, August 23, 13
Versioning & Releasing
Friday, August 23, 13
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
Data In-ModulesOverview & Call To Action
Friday, August 23, 13
puppetconf.com #puppetconf
Params.pp Meet
Hiera Data
./data/operatingsystem/Amazon.yaml
Friday, August 23, 13
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
http://links.puppetlabs.com/bgtm
Friday, August 23, 13
Friday, August 23, 13
puppetconf.com #puppetconf
Network Too!
Friday, August 23, 13
puppetconf.com #puppetconf
• forge.puppetlabs.com/puppetlabs/gce_compute
• certname == GCE project ID
•
Friday, August 23, 13
Thank YouRyan ColemanProduct Owner | Puppet Labs@ryanycoleman
Collaborate. Automate. Ship.
Friday, August 23, 13
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