• Save
Chef in the cloud and on the ground   code freeze 2012
Upcoming SlideShare
Loading in...5
×
 

Chef in the cloud and on the ground code freeze 2012

on

  • 3,167 views

Using Chef throughout the development process: in local machines, in public clouds, and in private clouds.

Using Chef throughout the development process: in local machines, in public clouds, and in private clouds.

Statistics

Views

Total Views
3,167
Views on SlideShare
3,149
Embed Views
18

Actions

Likes
5
Downloads
0
Comments
0

3 Embeds 18

http://coderwall.com 12
http://a0.twimg.com 5
http://localhost 1

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Chef in the cloud and on the ground   code freeze 2012 Chef in the cloud and on the ground code freeze 2012 Presentation Transcript

  • CHEF IN THE CLOUD AND ON THE GROUND Michael T. Nygard Relevance, Inc. michael.nygard@thinkrelevance.com @mtnygard © 2011-2012 Michael T. Nygard, All Rights Reserved.Thursday, January 12, 12
  • Infrastructure As CodeThursday, January 12, 12
  • Infrastructure As Code ChefThursday, January 12, 12
  • Infrastructure As Code Chef Development ModelsThursday, January 12, 12
  • Infrastructure As Code Chef Development Models Deployment ModelsThursday, January 12, 12
  • Infrastructure as CodeThursday, January 12, 12
  • Infrastructure as Code • Desired stateThursday, January 12, 12
  • Infrastructure as Code • Desired state • Transformations to achieve itThursday, January 12, 12
  • Infrastructure as Code • Desired state • Transformations to achieve it • As text filesThursday, January 12, 12
  • Infrastructure as Code • Desired state • Transformations to achieve it • As text files • In version controlThursday, January 12, 12
  • Infrastructure as Code • Desired state • Transformations to achieve it • As text files • In version control • Testable and reproducibleThursday, January 12, 12
  • Chef Basics Cookbook Cookbook metadata 1..* * * * * Resource Recipe Attribute Template Library Provider * * Resource Ruby SourceThursday, January 12, 12
  • Cookbook: Git git metadata.json metadata.rb README.rdoc recipes default.rb server.rb templates default sv-git-daemon-log-run.erb sv-git-daemon-run.erbThursday, January 12, 12
  • Cookbook: Git metadata.rb metadata.rbThursday, January 12, 12
  • metadata.rb maintainer "Opscode, Inc." maintainer_email "cookbooks@opscode.com" license "Apache 2.0" description "Installs git and/or set…" long_description IO.read(File.join( File.dirname(__FILE__), README.rdoc)) version "0.9.0" recipe "git", "Installs git" recipe "git::server", "Sets up a runit_service for git daemon" cont…Thursday, January 12, 12
  • metadata.rb … %w{ ubuntu debian arch}.each do |os| supports os end %w{ runit }.each do |cb| depends cb endThursday, January 12, 12
  • Cookbook: Git git metadata.json metadata.rb metadata.rb README.rdoc recipes default.rb server.rb templates default sv-git-daemon-log-run.erb sv-git-daemon-run.erbThursday, January 12, 12
  • Cookbook: Git git metadata.json metadata.rb README.rdoc recipes default.rb server.rb templates default sv-git-daemon-log-run.erb sv-git-daemon-run.erbThursday, January 12, 12
  • Cookbook: Git recipes/default.rb default.rbThursday, January 12, 12
  • recipes/default.rb case node[:platform] when "debian", "ubuntu" package "git-core" else package "git" endThursday, January 12, 12
  • Cookbook: Git git metadata.json metadata.rb README.rdoc recipes default.rb recipes/default.rb server.rb templates default sv-git-daemon-log-run.erb sv-git-daemon-run.erbThursday, January 12, 12
  • Cookbook: Git recipes/server.rb server.rbThursday, January 12, 12
  • recipes/server.rb include_recipe "git" directory "/srv/git" do owner "root" group "root" mode 0755 end cont…Thursday, January 12, 12
  • recipes/server.rb … case node[:platform] when "debian", "ubuntu" include_recipe "runit" runit_service "git-daemon" else log "Platform requires setting up …" log "Hint: /usr/bin/git daemon --export…" endThursday, January 12, 12
  • Cookbook: Git git metadata.json metadata.rb README.rdoc recipes default.rb recipes/default.rb server.rb templates default sv-git-daemon-log-run.erb sv-git-daemon-run.erbThursday, January 12, 12
  • How do cookbooks get applied to servers ?Thursday, January 12, 12
  • Runlist Executes On Node Runlist Recipe or Role includes includes Recipe Role declares overrides Resource uses AttributeThursday, January 12, 12
  • Example Runlist (from a role file) name "dev_env_bamboo" description "Continuous Integration server" run_list "recipe[aws]", "recipe[xfs]", "recipe[bamboo]", "recipe[bamboo::crowd_authentication]", "recipe[bamboo::ebs_volume]", "recipe[build_dependencies]", "recipe[maven]", "recipe[maven3]", "recipe[bamboo::post_maven_bamboo]", "recipe[bamboo::start]", "recipe[iptables::ci_instance]"Thursday, January 12, 12
  • Where do you keep installation binaries ?Thursday, January 12, 12
  • Remote file resource remote_file "crowd" do path "/tmp/crowd.tar.gz" source "http://downloads.atlassian.com/…/ atlassian-crowd-2.3.3.tar.gz" checksum "dcc486625e96925…" endThursday, January 12, 12
  • Have a sandbox!Thursday, January 12, 12
  • Where do I find cookbooks ?Thursday, January 12, 12
  • Many available on github cookbooks.opscode.comThursday, January 12, 12
  • Throughout Development Cycle Local DevelopmentThursday, January 12, 12
  • Throughout Development Cycle Local Development Single App (solo)Thursday, January 12, 12
  • Throughout Development Cycle Local Development Single App (solo) Server Based RolloutThursday, January 12, 12
  • Local DevelopmentThursday, January 12, 12
  • Local DevelopmentThursday, January 12, 12
  • VagrantThursday, January 12, 12
  • Vagrant Builds virtual machines from a text file and some Chef cookbooks.Thursday, January 12, 12
  • Vagrant Project rstudio-spike Vagrantfile README.md Gemfile cookbooks apt rstudioThursday, January 12, 12
  • Vagrant Project Vagrantfile VagrantfileThursday, January 12, 12
  • Vagrantfile Vagrant::Config.run do |config| config.vm.box = "lucid64" config.vm.box_url = "http://files.vagrantup.com/lucid64.box" config.vm.forward_port "http", 8787, 8787 config.vm.provision :chef_solo do |chef| chef.cookbooks_path = "cookbooks" chef.add_recipe "rstudio" chef.add_recipe "mysql::server" chef.json.merge!({ :mysql => {:server_root_password => "foo" } }) end endThursday, January 12, 12
  • Vagrant Project rstudio-spike Vagrantfile Vagrantfile README.md Gemfile cookbooks apt rstudioThursday, January 12, 12
  • BenefitsThursday, January 12, 12
  • Benefits Version control dev environmentThursday, January 12, 12
  • Benefits Version control dev environment Share configs across teamThursday, January 12, 12
  • Benefits Version control dev environment Share configs across team Recreate project or client setupThursday, January 12, 12
  • Benefits Version control dev environment Share configs across team Recreate project or client setup Keep host environment cleanThursday, January 12, 12
  • “Base Box”Thursday, January 12, 12
  • “Base Box” OS Image + Vagrant configsThursday, January 12, 12
  • Download Base BoxesThursday, January 12, 12
  • Make Base BoxesThursday, January 12, 12
  • Solo DeploymentThursday, January 12, 12
  • Solo DeploymentThursday, January 12, 12
  • Chef SoloThursday, January 12, 12
  • Chef Solo Runs cookbooks, with attributes, on a node.Thursday, January 12, 12
  • chef-solo $ sudo chef-solo -c solo.rb -j node.json … INFO: *** Chef 0.10.4 *** … INFO: Setting the run_list to ["recipe[rstudio]"] from JSON … INFO: Run List is [recipe[rstudio]] … INFO: Run List expands to [rstudio] … INFO: Starting Chef Run for lucid64.hsd1.ca.comcast.net. … … INFO: Processing package[r-base] action install (rstudio::default line 18) -- many lines of output -- … INFO: Processing dpkg_package[rstudio-server] action install (rstudio::default line 46) … INFO: dpkg_package[rstudio-server] installed version 0.94.84 … INFO: Chef Run complete in 238.033898 seconds … INFO: Running report handlers … INFO: Report handlers completeThursday, January 12, 12
  • solo.rb file_cache_path "/var/chef-solo" cookbook_path ["/var/chef/cookbooks", "/var/chef/site-cookbooks"]Thursday, January 12, 12
  • node.json { "mysql": { "server_root_password": "foo" }, "run_list": ["recipe[rstudio]"] }Thursday, January 12, 12
  • BenefitsThursday, January 12, 12
  • Benefits Self-contained bundleThursday, January 12, 12
  • Benefits Self-contained bundle Can run from tarball at URLThursday, January 12, 12
  • Benefits Self-contained bundle Can run from tarball at URL Easy setup; no extra infrastructureThursday, January 12, 12
  • Server-Based DeploymentThursday, January 12, 12
  • Chef ServerThursday, January 12, 12
  • Chef Server Client-server polling Searchable via API Authenticated and encrypted Centralized managementThursday, January 12, 12
  • Chef Server Chef Client poll cookbook recipes upload roles attributes Operator Chef ServerThursday, January 12, 12
  • Server Based Search API access to Lucene search Nodes, roles, or data bags Can be used from recipes on clientsThursday, January 12, 12
  • Example: Automatic Nagios Config 1. Search for nodes in the environment 2. Generate Nagios config files with information about nodes.Thursday, January 12, 12
  • Data Bags JSON data Held on server Access via APIThursday, January 12, 12
  • Example: Database Credentials begin bamboo_app = Chef::DataBagItem.load(:apps, :bamboo) Chef::Log.info("Loaded… apps[#{bamboo_app[id]}]") rescue Chef::Log.fatal("Could not find #{:bamboo}… ") raise endThursday, January 12, 12
  • Chef Server in EC2Thursday, January 12, 12
  • Challenges No long-lived identity Must use EBS for server Authentication of new nodesThursday, January 12, 12
  • Example: EC2 + ELB + AS Elastic load balancer app1 app2 extra instances ami with chef Autoscale Group client db chef-serverThursday, January 12, 12
  • Chef in Private CloudsThursday, January 12, 12
  • Chef + OpenStack: Automation 2 Ways 1. Build the platform itself 2. Build nodes in the platformThursday, January 12, 12
  • Other Options Hosted Chef: Chef Server as a Service www.opscode.comThursday, January 12, 12
  • Other Options Hosted Chef: Chef Server as a Service Private Chef: Like Hosted Chef, as an appliance behind your firewall www.opscode.comThursday, January 12, 12
  • CHEF IN THE CLOUD AND ON THE GROUND Michael T. Nygard Relevance, Inc. michael.nygard@thinkrelevance.com @mtnygard © 2011-2012 Michael T. Nygard, All Rights Reserved.Thursday, January 12, 12
  • Resources Chef http://wiki.opscode.com Vagrant http://www.vagrantup.com/ CloudFormation http://bit.ly/mPFFJGThursday, January 12, 12