7. “Chef is a systems and cloud
infrastructure automation
framework that makes it easy to
deploy servers and applications
to any physical, virtual, or cloud
location, no matter the size of the
infrastructure.”
http://docs.chef.io/
35. Bugs (Foodcritic)
• They are hard to track down
• Foodcritic – static analysis of cookbooks
– Doesn’t find everything, similar to jshint
– Give examples of errors it finds
38. Resources
Mobile phone graphic - Created by James Fenton from the Noun Project
Chef graphic - Created by Juan Pablo Bravo from the Noun Project
Terminal graphic - Created by useiconic.com from the Noun Project
40. Other Ideas
• Combining Chef with Docker or Vagrant to
setup reproducible local dev environments
• Chef can be used to automate setting up
your next workstation
Editor's Notes
Formerly “Opscode” now just “Chef”
“Opscode” is still a good qualifier for Google searches like using “p5” while searching for “processing” the language
I will try to use “Opscode” when I’m talking about the company that manages Chef. And I’ll say “Chef” when I mean the framework.
- I think a good way to initially evaluate a framework is to figure out what problem it solves.
Installing the latest version of Node.js
Advanced Package Manager doesn’t have latest node. Have you use NodeSource’s node.js version maintained by Chris Lea’s PPA (personal package archive).
Or installing io.js
Now think about doing all that (apt, ppa, installing, etc.) on every environment (dev, stage, prod which is possibly multiple servers).
What if you have to reinstall your applications because your server dies? What if you need to setup more servers to handle load?
Audience poll
- how many people have had to setup a new computer?
- how many people have at least 5 pieces of software that they would install after getting a new computer from IT? 10? 20?
- the right version of git?
- 1password
- mamp (and if not, then apache/nginx mysql)
- rvm
- nvm
- What if you are a front-end dev
- Performance matters
- Recently lots of extreme techniques for performance improvements as I talked about in my last presentation about images in RWD
- one of the more recent front-end architecture performance strategies is inlining critical path css
- SYN ACK (rwnd cwnd – number of segments sent in next request)
depending on your setup since at least linux kernel version of 2.6.39 (2.6.33 and up you can adjust initrwnd – broadcast value of rwnd)
You have ~14k in the first request
Before 2.6.39 you had ~5k
Even if you don’t inline css, modern browsers make ~6 requests per domain at a single time. Making sure you’re on the right kernel version impacts front-end performance (there are lots of perf optimizations before this).
What programs are installed, and which versions?
What are the characteristics of my machines?
State not status. Chef isn’t meant for real-time status monitoring.
Basically three types of actors in Chef
Workstation (local comp), Chef Server (manages nodes, cookbooks, environments, data_bags, and roles), and nodes (the servers)
Workstation ----- to --- chef server via Knife
Workstation ----- to --- nodes via chef-client
When a node updates with the Chef server it is called “convergence”.
First setup your local machine
Workstation needs to have Ruby installed
Ran into issues using their update script while using rvm. Had to update as a gem.
Install ChefDK (development kit) locally on your workstation
Installs everything that you need to develop Chef
Workstation is setup
Now need to setup node
- Manual install means provisioning the server in ec2. Later show example of provisioning, bootstrapping, and converging node in one step.
- Installs it’s own version of Ruby (won’t conflict)
Installs chef-client on the node which is used to communicate with the Chef Server
The Chef Server can be run either on your own server or hosted by Opscode.
Need somewhere to store your cookbooks so that nodes can access them
Authentication
Chef uses public/private key authentication
When you start with Chef Manage starter kit you get some private keys in order to communicate between your workstation and Chef server.
Then a cookbook
Recipes – contains the instructions for the cookbook. These files are written in Ruby and for the most part contain a list of Resources or groups of actions to take on the server.
Metadata.rb – This is where dependencies are listed. Also, contains versioning information.
Explanatory information about the cookbook including licensing and contact info. Useful when working with Supermarket (github for cookbooks).
Files – static files that can be manipulated via the cookbook_file resource (ie. authorized_keys file)
Templates – similar to files but can be dynamically created using ERB templating (Erubis implementation).
There are other folders and files we won’t cover today
The Chef Server can be run either on your own server or hosted by Opscode.
Autopilot
one step server creation and deploy
The Chef Server can be run either on your own server or hosted by Opscode.