Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
AUTOMATE OR DIE!
Trotter Cashion / Strange Loop 2010
                        http://pinktentacle.com/images/irex2009_4_lar...
CO-FOUNDER
@CASHION




   http://www.charlesheflin.com/wp-content/uploads/2010/06/fail-whale.jpg
github.com/trotter




http://gems.github.com/octocat.png
AGENDA
THE MANUAL PROBLEM
CHEF SERVER VS. CHEF SOLO
COOKBOOK INTERNALS
GOING WAY BACK




         http://www.ameshistoricalsociety.org/identify/old_car1.jpg
FORD VS. THE OTHER GUYS
Pre-Ford (?-1907)     Model T (1915)


 $2,000 - $3,000          $850


  Made by hand        Asse...
BY 1930
  250 car companies had died




http://sdo210.files.wordpress.com/2010/05/grantwood-american-gothic-1930.jpg
SO WHAT ABOUT US?




       http://media.photobucket.com/image/nerds%20candy/civy1811/car002.jpg
Most Tech Companies are Essentially
American Auto Companies Pre-Ford
MYSQL




        http://www.dolphinsc.com/images/Dolphin.jpg
POSTGRES




http://images.buycostumes.com/mgen/merchandiser/32494.jpg
APACHE




   http://www.wallpapers-free.org/34/-/Apache_Longbow_Helicopter/
NGINX




http://www.allbestwallpapers.com/travel-kremlin_and_red_square_fireworks,_moscow,_russia_wallpapers.html
Memcached
Memcached
        Redis
Memcached
        Redis
           Mongodb
Memcached
        Redis
           Mongodb Riak
Memcached
        Redis
           Mongodb Riak

                   Cassandra
Memcached
        Redis
           Mongodb Riak

                       Cassandra


                Project Voldemort
Memcached
        Redis
           Mongodb Riak

       Ubuntu          Cassandra


                Project Voldemort
Memcached
        Redis         Redhat
           Mongodb Riak

       Ubuntu          Cassandra


                Project...
Memcached
        Redis           Redhat
   Solaris   Mongodb Riak

       Ubuntu          Cassandra


                Pro...
Memcached         iptables
        Redis           Redhat
   Solaris   Mongodb Riak

       Ubuntu          Cassandra


  ...
Memcached         iptables
        Redis           Redhat
   Solaris   Mongodb Riak

       Ubuntu             Cassandra
 ...
Memcached         iptables
        Redis         Redhat
  Solaris  Mongodb Riak
DNS Servers
       Ubuntu             Cass...
Memcached            iptables
        Redis           Redhat
  Solaris    Mongodb Riak
DNS Servers
       Ubuntu          ...
We Idolize the Artisan Sysadmin
... but what do we end up with?
SNOWFLAKES
     ... that become avalanches




http://www.enviro-bc.ca/wp-content/uploads/2009/04/bowlake-aval_clair-israe...
HEISENBUGS




http://osulibrary.oregonstate.edu/specialcollections/coll/nonspcoll/catalogue/portrait-heisenberg-600w.jpg
NO MORE MONEY!




      http://assets.troubledteenswizard.com/uploaded/WoW/nomoney1.jpg
We’re really left with two choices
Automate... or die.
Automation is not hard!
CFENGINE




http://hackedgadgets.com/wp-content/2/LEGO_V8_Engine_1.jpg
PUPPET




   http://www.flickr.com/photos/willemvelthoven/381608678/sizes/l/
CHEF!




   http://www.flickr.com/photos/venndiagram/4891510333/sizes/l/
WRITTEN BY




             http://www.opscode.com/
WRITTEN IN




     http://www.prestonlee.com/wp-content/uploads/2008/09/ruby.png
Two Delicious Flavors
SERVER




http://upload.wikimedia.org/wikipedia/commons/e/e0/Google%E2%80%99s_First_Production_Server.jpg
HOW IT WORKS
HOW IT WORKS

      Your
    Computer
HOW IT WORKS

              Your
            Computer




 Box to
Provision
HOW IT WORKS

              Your
            Computer




 Box to
                       Chef Server
Provision
HOW IT WORKS

               Your
             Computer
Prepare


  Box to
                        Chef Server
 Provision
HOW IT WORKS

                Your
              Computer
Prepare

             What now?
  Box to
                       ...
HOW IT WORKS

                Your
              Computer
Prepare                    Cookbooks

             What now?
  B...
HOW IT WORKS

                Your
              Computer
Prepare                    Cookbooks

             What now?
  B...
SOLO




http://www.pbs.org/parents/supersisters/han_solo-thumb-454x654.jpg
HOW IT WORKS
HOW IT WORKS


  Your
Computer
HOW IT WORKS


  Your         Box to
Computer      Provision
HOW IT WORKS

           Prepare
  Your                Box to
Computer             Provision
HOW IT WORKS

            Prepare
  Your                  Box to
Computer
           Cookbooks   Provision
HOW IT WORKS

            Prepare
  Your                  Box to
Computer
           Cookbooks   Provision
              G...
Chef Structure
CHEF HEIRARCHY
                         Node



       Roles                             Cookbooks



Cookbooks



     Re...
ROLES ARE REUSABLE!

 config/dev.json   config/db.json



           roles/db.rb
GETTING
              GOING




http://www.flickr.com/photos/seandreilinger/959864706/sizes/o/
WHAT YOU NEED
WHAT YOU NEED
           Ruby &
          Rubygems
WHAT YOU NEED
                      Ruby &
                     Rubygems



`gem install chef`   Chef Gem
WHAT YOU NEED
                                 Ruby &
                                Rubygems



     `gem install chef` ...
COOKBOOKS.OPSCODE.COM




                 http://cookbooks.opscode.com/
TERMINAL JUNKIES
TERMINAL JUNKIES
•spatula   search mysql
TERMINAL JUNKIES
•spatula   search mysql
•spatula   install mysql
TERMINAL JUNKIES
•spatula   search mysql
•spatula   install mysql
•spatula   show mysql
TERMINAL JUNKIES
•spatula     search mysql
•spatula     install mysql
•spatula     show mysql
•... knife   has similar fun...
GET THE BOX READY

                                ssh db-one.host “install ruby”
spatula prepare db-one.host =
          ...
GO GO GO!

                                 rsync repo to db-one.host

spatula cook db-one.host db = ssh db-one.host “sudo...
WITH CHEF SERVER
    install dependencies


       turn on client


  send cookbooks to client
DIGGING DEEPER




    http://media.photobucket.com/image/minecraft/bluekabal/roma/minesofroma.jpg
CHEF HEIRARCHY
                         Node



       Roles                             Cookbooks



Cookbooks



     Re...
A NODE
// ./config/db_one.json
{ "run_list": ["role[db]"] }


        Recipes and Roles go here
CHEF HEIRARCHY
                         Node



       Roles                             Cookbooks



Cookbooks



     Re...
A ROLE
# ./roles/db.rb
name "database"
description "Be a DB"
run_list [ "apache2", "mysql::server" ]
A ROLE
# ./roles/db.rb
name "database"
                            Recipes to run
description "Be a DB"
run_list [ "apache...
A ROLE
# ./roles/db.rb
name "database"
description "Be a DB"
run_list [ "apache2", "mysql::server" ]


  ./cookbooks/apach...
A ROLE
# ./roles/db.rb
name "database"
description "Be a DB"
run_list [ "apache2", "mysql::server" ]


                  ....
CHEF HEIRARCHY
                         Node



       Roles                             Cookbooks



Cookbooks



     Re...
ATTRIBUTES
# ./cookbooks/mysql/attributes/server.rb
default[:mysql][:server_debian_password]   =   secure_password
default...
OVERRIDING ATTRIBUTES
   Node
// ./config/db.json
{ "mysql": { "server_root_password": "beefcake" },
  "recipes": [ "mysql...
CHEF HEIRARCHY
                         Node



       Roles                             Cookbooks



Cookbooks



     Re...
THE RECIPE... PART 1
# ./cookbooks/mysql/recipes/server.rb
include_recipe "mysql::client"
THE RECIPE... PART 2
package "mysql-server" do
  action :install
end
THE RECIPE... PART 3
template "/etc/mysql/my.cnf" do
  source "my.cnf.erb"
  owner "root"
  group "root"
  mode "0644"
  n...
CHEF HEIRARCHY
                         Node



       Roles                             Cookbooks



Cookbooks



     Re...
A TEMPLATE SAMPLE
user            =   mysql
pid-file        =   /var/run/mysqld/mysqld.pid
socket          =   /var/run/my...
A TEMPLATE SAMPLE
user            =   mysql
pid-file        =   /var/run/mysqld/mysqld.pid
socket          =   /var/run/my...
A TEMPLATE SAMPLE
user            =   mysql
pid-file        =   /var/run/mysqld/mysqld.pid
socket          =   /var/run/my...
A TEMPLATE SAMPLE
user            =   mysql
pid-file        =   /var/run/mysqld/mysqld.pid
socket          =   /var/run/my...
ASSIGNING VARIABLES
template "/etc/mysql/my.cnf" do
  source "my.cnf.erb"
  owner "root"
  group "root"
  mode "0644"
  va...
CHEF HEIRARCHY
                         Node



       Roles                             Cookbooks



Cookbooks



     Re...
DEFINITIONS
define :apache_conf do
  dir = node[:apache][:dir]
  template "#{dir}/mods-available/#{params[:name]}.conf" do...
LET’S
                  WRAP
                  IT U P




http://www.flickr.com/photos/andresthor/3946773501/sizes/l/in/pho...
AUTOMATE EVERYTHING!!




            http://www.flickr.com/photos/kenfagerdotcom/3409813881/
Deploying == Provisioning
USE CHEF!!!!!




      http://www.flickr.com/photos/martin_borjesson/4083726805/sizes/o/
ON THE INTERNETS
ON THE INTERNETS
•twitter   - @cashion
ON THE INTERNETS
•twitter   - @cashion
•github    - http://github.com/trotter
ON THE INTERNETS
•twitter   - @cashion
•github    - http://github.com/trotter
•email   - cashion on the gmailz
DOMO ARIGATO




       http://www.flickr.com/photos/dancoulter/21042744/sizes/o/
RESOURCES
RESOURCES
• http://wiki.opscode.com/display/chef/Resources
RESOURCES
• http://wiki.opscode.com/display/chef/Resources

•#chef   on freenode
RESOURCES
• http://wiki.opscode.com/display/chef/Resources

•#chef   on freenode
•cashion@gmail.com
Automate or Die
Upcoming SlideShare
Loading in …5
×

Automate or Die

11,307 views

Published on

This talk was given at StrangeLoop 2010. It builds a case for devops and then gives a basic explanation of Chef.

Published in: Technology, Design
  • Be the first to comment

Automate or Die

  1. AUTOMATE OR DIE! Trotter Cashion / Strange Loop 2010 http://pinktentacle.com/images/irex2009_4_large.jpg
  2. CO-FOUNDER
  3. @CASHION http://www.charlesheflin.com/wp-content/uploads/2010/06/fail-whale.jpg
  4. github.com/trotter http://gems.github.com/octocat.png
  5. AGENDA
  6. THE MANUAL PROBLEM
  7. CHEF SERVER VS. CHEF SOLO
  8. COOKBOOK INTERNALS
  9. GOING WAY BACK http://www.ameshistoricalsociety.org/identify/old_car1.jpg
  10. FORD VS. THE OTHER GUYS Pre-Ford (?-1907) Model T (1915) $2,000 - $3,000 $850 Made by hand Assembly Line 12.5 hours to build 1.5 hours
  11. BY 1930 250 car companies had died http://sdo210.files.wordpress.com/2010/05/grantwood-american-gothic-1930.jpg
  12. SO WHAT ABOUT US? http://media.photobucket.com/image/nerds%20candy/civy1811/car002.jpg
  13. Most Tech Companies are Essentially American Auto Companies Pre-Ford
  14. MYSQL http://www.dolphinsc.com/images/Dolphin.jpg
  15. POSTGRES http://images.buycostumes.com/mgen/merchandiser/32494.jpg
  16. APACHE http://www.wallpapers-free.org/34/-/Apache_Longbow_Helicopter/
  17. NGINX http://www.allbestwallpapers.com/travel-kremlin_and_red_square_fireworks,_moscow,_russia_wallpapers.html
  18. Memcached
  19. Memcached Redis
  20. Memcached Redis Mongodb
  21. Memcached Redis Mongodb Riak
  22. Memcached Redis Mongodb Riak Cassandra
  23. Memcached Redis Mongodb Riak Cassandra Project Voldemort
  24. Memcached Redis Mongodb Riak Ubuntu Cassandra Project Voldemort
  25. Memcached Redis Redhat Mongodb Riak Ubuntu Cassandra Project Voldemort
  26. Memcached Redis Redhat Solaris Mongodb Riak Ubuntu Cassandra Project Voldemort
  27. Memcached iptables Redis Redhat Solaris Mongodb Riak Ubuntu Cassandra Project Voldemort
  28. Memcached iptables Redis Redhat Solaris Mongodb Riak Ubuntu Cassandra sshd Project Voldemort
  29. Memcached iptables Redis Redhat Solaris Mongodb Riak DNS Servers Ubuntu Cassandra sshd Project Voldemort
  30. Memcached iptables Redis Redhat Solaris Mongodb Riak DNS Servers Ubuntu Cassandra sshd TCP/IP internals Project Voldemort
  31. We Idolize the Artisan Sysadmin
  32. ... but what do we end up with?
  33. SNOWFLAKES ... that become avalanches http://www.enviro-bc.ca/wp-content/uploads/2009/04/bowlake-aval_clair-israelson.jpg
  34. HEISENBUGS http://osulibrary.oregonstate.edu/specialcollections/coll/nonspcoll/catalogue/portrait-heisenberg-600w.jpg
  35. NO MORE MONEY! http://assets.troubledteenswizard.com/uploaded/WoW/nomoney1.jpg
  36. We’re really left with two choices
  37. Automate... or die.
  38. Automation is not hard!
  39. CFENGINE http://hackedgadgets.com/wp-content/2/LEGO_V8_Engine_1.jpg
  40. PUPPET http://www.flickr.com/photos/willemvelthoven/381608678/sizes/l/
  41. CHEF! http://www.flickr.com/photos/venndiagram/4891510333/sizes/l/
  42. WRITTEN BY http://www.opscode.com/
  43. WRITTEN IN http://www.prestonlee.com/wp-content/uploads/2008/09/ruby.png
  44. Two Delicious Flavors
  45. SERVER http://upload.wikimedia.org/wikipedia/commons/e/e0/Google%E2%80%99s_First_Production_Server.jpg
  46. HOW IT WORKS
  47. HOW IT WORKS Your Computer
  48. HOW IT WORKS Your Computer Box to Provision
  49. HOW IT WORKS Your Computer Box to Chef Server Provision
  50. HOW IT WORKS Your Computer Prepare Box to Chef Server Provision
  51. HOW IT WORKS Your Computer Prepare What now? Box to Chef Server Provision
  52. HOW IT WORKS Your Computer Prepare Cookbooks What now? Box to Chef Server Provision
  53. HOW IT WORKS Your Computer Prepare Cookbooks What now? Box to Chef Server Provision Run!
  54. SOLO http://www.pbs.org/parents/supersisters/han_solo-thumb-454x654.jpg
  55. HOW IT WORKS
  56. HOW IT WORKS Your Computer
  57. HOW IT WORKS Your Box to Computer Provision
  58. HOW IT WORKS Prepare Your Box to Computer Provision
  59. HOW IT WORKS Prepare Your Box to Computer Cookbooks Provision
  60. HOW IT WORKS Prepare Your Box to Computer Cookbooks Provision Go!
  61. Chef Structure
  62. CHEF HEIRARCHY Node Roles Cookbooks Cookbooks Recipes Attributes Templates Definitions
  63. ROLES ARE REUSABLE! config/dev.json config/db.json roles/db.rb
  64. GETTING GOING http://www.flickr.com/photos/seandreilinger/959864706/sizes/o/
  65. WHAT YOU NEED
  66. WHAT YOU NEED Ruby & Rubygems
  67. WHAT YOU NEED Ruby & Rubygems `gem install chef` Chef Gem
  68. WHAT YOU NEED Ruby & Rubygems `gem install chef` Chef Gem `git clone http://github.com/ Chef Repo opscode/chef-repo.git`
  69. COOKBOOKS.OPSCODE.COM http://cookbooks.opscode.com/
  70. TERMINAL JUNKIES
  71. TERMINAL JUNKIES •spatula search mysql
  72. TERMINAL JUNKIES •spatula search mysql •spatula install mysql
  73. TERMINAL JUNKIES •spatula search mysql •spatula install mysql •spatula show mysql
  74. TERMINAL JUNKIES •spatula search mysql •spatula install mysql •spatula show mysql •... knife has similar functionality
  75. GET THE BOX READY ssh db-one.host “install ruby” spatula prepare db-one.host = ssh db-one.host “install chef”
  76. GO GO GO! rsync repo to db-one.host spatula cook db-one.host db = ssh db-one.host “sudo chef-solo -c config/solo.rb -j config/db.json”
  77. WITH CHEF SERVER install dependencies turn on client send cookbooks to client
  78. DIGGING DEEPER http://media.photobucket.com/image/minecraft/bluekabal/roma/minesofroma.jpg
  79. CHEF HEIRARCHY Node Roles Cookbooks Cookbooks Recipes Attributes Templates Definitions
  80. A NODE // ./config/db_one.json { "run_list": ["role[db]"] } Recipes and Roles go here
  81. CHEF HEIRARCHY Node Roles Cookbooks Cookbooks Recipes Attributes Templates Definitions
  82. A ROLE # ./roles/db.rb name "database" description "Be a DB" run_list [ "apache2", "mysql::server" ]
  83. A ROLE # ./roles/db.rb name "database" Recipes to run description "Be a DB" run_list [ "apache2", "mysql::server" ]
  84. A ROLE # ./roles/db.rb name "database" description "Be a DB" run_list [ "apache2", "mysql::server" ] ./cookbooks/apache2/recipes/default.rb
  85. A ROLE # ./roles/db.rb name "database" description "Be a DB" run_list [ "apache2", "mysql::server" ] ./cookbooks/mysql/recipes/server.rb
  86. CHEF HEIRARCHY Node Roles Cookbooks Cookbooks Recipes Attributes Templates Definitions
  87. ATTRIBUTES # ./cookbooks/mysql/attributes/server.rb default[:mysql][:server_debian_password] = secure_password default[:mysql][:server_root_password] = secure_password default[:mysql][:server_repl_password] = secure_password default[:mysql][:bind_address] = ipaddress default[:mysql][:datadir] = "/var/lib/mysql" # Tunables default[:mysql][:tunable][:key_buffer] = "250M" default[:mysql][:tunable][:max_connections] = "800" default[:mysql][:tunable][:wait_timeout] = "180"
  88. OVERRIDING ATTRIBUTES Node // ./config/db.json { "mysql": { "server_root_password": "beefcake" },   "recipes": [ "mysql" ] } Role # ./roles/db.rb name "database" description "Be a DB" run_list [ "mysql::server" ] default_attributes :mysql => { :server_root_password => "beefcake" }
  89. CHEF HEIRARCHY Node Roles Cookbooks Cookbooks Recipes Attributes Templates Definitions
  90. THE RECIPE... PART 1 # ./cookbooks/mysql/recipes/server.rb include_recipe "mysql::client"
  91. THE RECIPE... PART 2 package "mysql-server" do action :install end
  92. THE RECIPE... PART 3 template "/etc/mysql/my.cnf" do source "my.cnf.erb" owner "root" group "root" mode "0644" notifies :restart, resources(:service => "mysql"), :immediately end
  93. CHEF HEIRARCHY Node Roles Cookbooks Cookbooks Recipes Attributes Templates Definitions
  94. A TEMPLATE SAMPLE user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock datadir = <%= @datadir %> bind-address = <%= @node[:mysql][:bind_address] %>
  95. A TEMPLATE SAMPLE user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock datadir = <%= @datadir %> bind-address = <%= @node[:mysql][:bind_address] %> OMG, ERB!!
  96. A TEMPLATE SAMPLE user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock datadir = <%= @datadir %> bind-address = <%= @node[:mysql][:bind_address] %> From Attributes
  97. A TEMPLATE SAMPLE user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock datadir = <%= @datadir %> From Template bind-address = <%= @node[:mysql][:bind_address] %>
  98. ASSIGNING VARIABLES template "/etc/mysql/my.cnf" do source "my.cnf.erb" owner "root" group "root" mode "0644" variables :datadir => “/var/lib/mysql” end
  99. CHEF HEIRARCHY Node Roles Cookbooks Cookbooks Recipes Attributes Templates Definitions
  100. DEFINITIONS define :apache_conf do dir = node[:apache][:dir] template "#{dir}/mods-available/#{params[:name]}.conf" do source "mods/#{params[:name]}.conf.erb" notifies :restart, resources(:service => "apache2") end end # In your recipe apache_conf "mod_ssl"
  101. LET’S WRAP IT U P http://www.flickr.com/photos/andresthor/3946773501/sizes/l/in/photostream/
  102. AUTOMATE EVERYTHING!! http://www.flickr.com/photos/kenfagerdotcom/3409813881/
  103. Deploying == Provisioning
  104. USE CHEF!!!!! http://www.flickr.com/photos/martin_borjesson/4083726805/sizes/o/
  105. ON THE INTERNETS
  106. ON THE INTERNETS •twitter - @cashion
  107. ON THE INTERNETS •twitter - @cashion •github - http://github.com/trotter
  108. ON THE INTERNETS •twitter - @cashion •github - http://github.com/trotter •email - cashion on the gmailz
  109. DOMO ARIGATO http://www.flickr.com/photos/dancoulter/21042744/sizes/o/
  110. RESOURCES
  111. RESOURCES • http://wiki.opscode.com/display/chef/Resources
  112. RESOURCES • http://wiki.opscode.com/display/chef/Resources •#chef on freenode
  113. RESOURCES • http://wiki.opscode.com/display/chef/Resources •#chef on freenode •cashion@gmail.com

×