Are you trying to build cookbooks within your organization but are unclear about how to get your coworkers involved? Maybe you've learned the Chef primitives and architecture but you're not sure how to distill that knowledge into patterns that others can follow? In this collaborative workshop, we will spend the day working together to craft a community cookbook from scratch using both Chef and community resources. In the process, we'll learn some key patterns of DevOps practices.
3. TA's
4 Robb Kidd
4 Matt Stratton
4 David Echols
4 Stephen Lauck
4 Bill Meyer
✨ Crafting Reusable Cookbooks #chefconf✨ 3
4. Communication
4 Jennifer Davis Twitter: @sig je
4 Ian Henry Twitter: @Eeyun___
Hashtag: #chefconf
✨ Crafting Reusable Cookbooks #chefconf✨ 4
5. Feedback
4 Constructive feedback
4 What did you find helpful?
4 What would you like to see more/less of?
4 Was there anything you found unclear?
✨ Crafting Reusable Cookbooks #chefconf✨ 5
6. Why are we here?
✨ Crafting Reusable Cookbooks #chefconf✨ 6
7. Expectations
4 Code of Conduct
4 Safe space to share experiences, learn from each
other.
4 Learn effective patterns for developing reusable
cookbooks.
✨ Crafting Reusable Cookbooks #chefconf✨ 7
12. Tools
Accelerators of culture that if used effectively can
enhance and support a culture of collaboration and
affinity.
✨ Crafting Reusable Cookbooks #chefconf✨ 12
13. Team
4 Common purpose
4 Defined beliefs
4 Empowered
✨ Crafting Reusable Cookbooks #chefconf✨ 13
14. Diversity in Teams
4 Professional
4 Personal
4 Goals
4 Cognitive Styles
✨ Crafting Reusable Cookbooks #chefconf✨ 14
15. Critical Habits for Teams
4 Code Review
4 Pairing
✨ Crafting Reusable Cookbooks #chefconf✨ 15
16. Code Review
4 Max 90 minutes in one setting
✨ Crafting Reusable Cookbooks #chefconf✨ 16
17. Pairing
4 Agile software development
4 2 people work together on 1 workstation
4 Driver - writes code
4 Observer - reviews each line
4 Roles switch frequently
✨ Crafting Reusable Cookbooks #chefconf✨ 17
19. Team Activity 1
4 Meet your team!
4 What are motivations?
4 What are objectives?
4 Skills? Gaps in skills?
4 git, chef, docker, continuous integration,
continuous delivery
If you haven't filled out the skills assessment please do✨ Crafting Reusable Cookbooks #chefconf✨ 19
20. Local Development Environment (LDE)
4 Consistent set of tools across the team
4 Ability to quickly onboard new engineers
✨ Crafting Reusable Cookbooks #chefconf✨ 20
21. Team Activity 2
4 Share with your team:
4 Do you have a team common local development
environment?
4 What current tools are you using in chef
development?
Time: 10 minutes
✨ Crafting Reusable Cookbooks #chefconf✨ 21
23. Introduction to Lab 1
4 Log into node and configure git
4 Create GitHub identity if you don't have one
already.
4 Set up GitHub keys.
4 Share team tools from Activity 2.
✨ Crafting Reusable Cookbooks #chefconf✨ 23
25. Supermarket
4 Community site with a number of cookbooks
Class Supermarket: https://
supermarket.reusablechef.com
✨ Crafting Reusable Cookbooks #chefconf✨ 25
26. Chef DK
4 Chef development kit
4 Includes a number of utilities and software to
facilitate cookbook creation
4 Free download off of the website
✨ Crafting Reusable Cookbooks #chefconf✨ 26
38. MongoDB terminology
4 document - basic unit of data for MongoDB, ordered
set of keys with associated values
4 collection - group of documents. analogous to table.
4 instance - MongoDB can host multiple independent
databases, each of which can have its own
collections.
✨ Crafting Reusable Cookbooks #chefconf✨ 38
44. Issue Management
4 Should be clear where to file bugs, request features.
4 Should be regularly groomed
✨ Crafting Reusable Cookbooks #chefconf✨ 44
45. Clear and Specific Licensing
For reusable cookbooks across the community
4 Apache 2.0
4 GNU Public License 2.0
4 GNU Public License 3.0
4 MIT
✨ Crafting Reusable Cookbooks #chefconf✨ 45
46. Multiple Collaborators
4 More than 1 person with the ability to release new
cookbooks
4 More than 1 person with ability to merge pull
requests
✨ Crafting Reusable Cookbooks #chefconf✨ 46
47. Test Everything
4 Use integration tests
4 Assert the state of the converged node to ensure
it's in the desired state
✨ Crafting Reusable Cookbooks #chefconf✨ 47
48. Foodcritic and Rubocop
4 Chef and Ruby linters pass cleanly
✨ Crafting Reusable Cookbooks #chefconf✨ 48
71. Reading Rubocop Output
Inspecting 8 files
CWCWCCCC
4 . means that the file contains no issues
4 C means a issue with convention
4 W means a warning
4 E means an error
4 F means an fatal error
✨ Crafting Reusable Cookbooks #chefconf✨ 71
77. ServerSpec
4 Tests to verify servers functionality
4 Resource types
4 Package, service, user, and many others
4 Integrates with Test Kitchen
4 http://serverspec.org
✨ Crafting Reusable Cookbooks #chefconf✨ 77
78. ServerSpec Generic Form
describe "<subject>" do
it "<description>" do
expect(thing).to eq result
end
end
✨ Crafting Reusable Cookbooks #chefconf✨ 78
79. ServerSpec Potential Tests
4 Is the service running?
4 Is the port accessible?
4 Is the expected content being served?
✨ Crafting Reusable Cookbooks #chefconf✨ 79
80. ServerSpec Example
describe 'apache' do
it "is installed" do
expect(package 'httpd').to be_installed
end
it "is running" do
expect(service 'httpd').to be_running
end
end
✨ Crafting Reusable Cookbooks #chefconf✨ 80
81. Reading ServerSpec Output
app::default
httpd service is running
Finished in 0.26429 seconds (files took 0.7166 seconds to load)
1 example, 0 failures
✨ Crafting Reusable Cookbooks #chefconf✨ 81
82. InSpec
4 infrastructure specification
4 open-source testing framework for infrastructure
4 human and machine readable
4 compliance, security, and policy requirements
4 Based off of ServerSpec
✨ Crafting Reusable Cookbooks #chefconf✨ 82
84. InSpec Example Run
$ inspec exec test.rb
.
Finished in 0.00901 seconds (files took 0.98501 seconds to load)
1 example, 0 failures
✨ Crafting Reusable Cookbooks #chefconf✨ 84
88. More info on InSpec
https://github.com/chef/inspec/blob/master/docs/
ctl_inspec.rst
✨ Crafting Reusable Cookbooks #chefconf✨ 88
89. InSpec Audit Rules
4 lots of resources to facilitate auditing nodes
✨ Crafting Reusable Cookbooks #chefconf✨ 89
90. InSpec host resource example
describe host('example.com', port: 80, proto: 'tcp') do
it { should be_reachable }
end
✨ Crafting Reusable Cookbooks #chefconf✨ 90
91. InSpec login_defs resource example
describe login_defs do
its('PASS_MAX_DAYS') { should eq '180' }
its('PASS_MIN_DAYS') { should eq '1' }
its('PASS_MIN_LEN') { should eq '15' }
its('PASS_WARN_AGE') { should eq '30' }
end
✨ Crafting Reusable Cookbooks #chefconf✨ 91
92. Introduction to Lab 5
Add Ubuntu platform to the mongodb cookbook.
Clean any rubocop and foodcritic issues reported.
Add tests to MongoDB cookbook.
Lab 5
✨ Crafting Reusable Cookbooks #chefconf✨ 92
94. Community Cookbooks
Community driven.
* Some managed by Chef. https://github.com/chef-
cookbooks
* Some partner managed.
✨ Crafting Reusable Cookbooks #chefconf✨ 94
96. Travis
4 free (for Open Source projects)
4 build files available
✨ Crafting Reusable Cookbooks #chefconf✨ 96
97. Chef Managed Community Cookbooks
CI
4 cookstyle (included with chef dk) https://github.com/
chef/cookstyle
4 allows for consistent rubocop testing across
cookbooks
4 use travis
✨ Crafting Reusable Cookbooks #chefconf✨ 97
98. Travis Sample
4 Tomcat Travis configuration
4 sudo: required (required when using docker with
travis)
4 limits branch to master
4 matrix set of platforms to test
4 script tests to be run
✨ Crafting Reusable Cookbooks #chefconf✨ 98