Rails back to basics: Introduction to Chef
Roy Cruz
Rails back to basics: Roy Cruz
Ruby on Rails Developer in
Growth Acceleration Partners
rcruz@weaegap.com
facebook.com/railscostarica
Rails back to basics: Agenda
Rails back to basics: What is Chef?
Chef is a systems and cloud infrastructure automation framework that makes it easy to deploy servers and applications to any physical or virtual, no matter the size of the infrastructure. It automates how applications are configured, deployed, and managed across your network, no matter its size.
Rails back to basics: What is Chef?
Rails back to basics: What is Chef?
Rails back to basics: What is Chef?
Rails back to basics: What is Chef?
Chef Server
Workstation
Node
chef-client
run-list
knife
Rails back to basics: Definitions
A workstation is a computer that is configured to run knife, to synchronize with the chef-repo, and interact with a single Chef server. The workstation is the location from which most users will do most of their work.
Nodes represents the servers in the infrastructure, can be physical or virtual.
Rails back to basics: Definitions
Rails back to basics: Definitions
Configuration files that describe resources and their desire state.
Recipes can:
Rails back to basics: Definitions
package 'apache2'
service 'apache2' do
action [:start, :enable]
end
template '/var/www/html/index.html' do
source 'index.html.erb'
endRails back to basics: Definitions
A cookbook defines a scenario and contains everything that is required to support that scenario:
Rails back to basics: Definitions
.
├── Berksfile
├── chefignore
├── metadata.json
├── metadata.rb
├── README.md
├── recipes
│ └── default.rb
└── templates
└── default
└── index.html.erb
Rails back to basics: Definitions
A run-list defines all of the configuration settings that are necessary for a node to be put into the desired state. A run-list is:
Rails back to basics: Definitions
Roles represent the types of servers in your infrastructure Load Balancer, Application Server, Database Cache, Database, Monitoring.
Roles may include a list of Chef configuration files that should be applied (this is called run-list) , also it should include data attributes necessary for configuring infrastructure.
Rails back to basics: Definitions
Rails back to basics: Commands
Knife is a command-line tool that provides an interface between a local chef-repo and the Chef server. Knife helps users to manage:
A chef-client is an agent that runs locally on every node that is under management by Chef. When a chef-client is run, it will perform all of the steps that are required to bring the node into the expected state.
Rails back to basics: Commands
1. Registering and authenticating the node with the Chef server
2. Building the node object
3. Synchronizing cookbooks
4. Compiling the resource collection by loading each of the required cookbooks
5. Taking the appropriate and required actions to configure the node
6. Looking for exceptions and notifications, handling each as required
Rails back to basics: Commands
Rails back to basics: Questions?
Harvey, N. (n.d.). Chef Fundamentals Module 1. Retrieved March 15, 2015, from https://learn.chef.io/screencasts/fundi-webinar-week-1/
About Knife. (n.d.). Retrieved March 15, 2015, from https://docs.chef.io/knife.html
Chef-client. (n.d.). Retrieved March 15, 2015, from https://docs.chef.io/chef_client.html
Workstations. (n.d.). Retrieved March 15, 2015, from https://docs.chef.io/workstation.html
Rails back to basics: Sources
All about Chef. (n.d.). Retrieved March 15, 2015, from http://docs.chef.io/
About Nodes. (n.d.). Retrieved March 15, 2015, from https://docs.chef.io/nodes.html
About Cookbooks. (n.d.). Retrieved March 15, 2015, from https://docs.chef.io/cookbooks.html
About Roles. (n.d.). Retrieved March 15, 2015, from https://docs.chef.io/roles.html
Rails back to basics: Sources
Networking 101: Puppet and Chef. (n.d.). Retrieved March 15, 2015, from https://www.youtube.com/watch?v=B5assieBDy8
Marschall, M. (2013). Chef Infrastructure Automation Cookbook. Packt Publishing.
Rails back to basics: Sources