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.

Infrastructure as Code (BBWorld/DevCon13)

5,665 views

Published on

My presentation on Infrastructure as Code from BBWorld/DevCon 2013 in Las Vegas

Published in: Technology

Infrastructure as Code (BBWorld/DevCon13)

  1. 1. Infrastructure as Code Mike McGarr, Director of Learn DevOps Blackboard, Inc.
  2. 2. ABOUT ME Mike McGarr Director of Learn DevOps Blackboard Inc. michael.mcgarr@blackboard.com I have been at Blackboard for 8 months. Software Engineer for 12+ years Founder of the DC Continuous Integration, Delivery and Deployment Meetup
  3. 3. LEARN DEVOPS TEAM Purpose: Provide development support to the rest of Learn‟s Product Development (PD) team. Includes: • Build/Release Engineering • Manage Enterprise Applications • Manage Data Center • Help desk for PD
  4. 4. ENTERPRISE APPLICATIONS Problems: • Manually managed • Little/No Version Control • No history/context
  5. 5. DATA CENTER Problems: • Few knew how to run CM • Fewer knew how to fix CM tool • Lots of firefighting to resolve CM issues
  6. 6. FIREFIGHTING
  7. 7. INFRASTRUCTURE AS CODE Automate the creation and maintenance of servers (to the farthest extent possible) • Build from source control • Utilize open source tools • Ensure testability A practice popularized by the DevOps movement.
  8. 8. TOOLS
  9. 9. CONFIGURATION SYNCHRONIZATION http://martinfowler.com/bliki/ConfigurationSynchronization.html
  10. 10. CONFIGURATION DRIFT http://kief.com/configuration-drift.html
  11. 11. NO MANUAL CHANGES http://www.agileweboperations.com/devops-protocol-no-manual-changes
  12. 12. PHOENIX SERVERS http://martinfowler.com/bliki/PhoenixServer.html
  13. 13. IMMUTABLE SERVERS http://martinfowler.com/bliki/ImmutableServer.html
  14. 14. REMINDER: CULTURE FIRST
  15. 15. Simple Example Infrastructure as Code
  16. 16. BUILD A JENKINS SERVER
  17. 17. CHEF‟S ARCHITECTURE
  18. 18. CREATE COOKBOOK http://youtu.be/Yu3--aljnJ0
  19. 19. VAGRANT $> vagrant box add $> vagrant init $> vagrant up $> vagrant ssh $> vagrant provision $> vagrant suspend $> vagrant destroy
  20. 20. VAGRANT UP http://youtu.be/I0Kd7mzEOD4
  21. 21. USE CHEF http://youtu.be/UhXWrQvwsyE
  22. 22. INSTALLING JENKINS
  23. 23. INSTALL JDK VIA CHEF 1. Include Java default recipe (recipe/default.rb) 2. Add cookbook dependency (metadata.rb) 3. Download Java cookbook 4. Run „vagrant provision‟
  24. 24. INSTALL JDK http://youtu.be/Pt7cg3oa4Hs 0% http://youtu.be/Pt7cg3oa4Hs
  25. 25. ADD JENKINS USER http://youtu.be/2VhvHXPKR6M
  26. 26. REUSE LIBRARIES
  27. 27. SECURITY templates/defaults/port_jenkins.erb recipes/default.rb
  28. 28. YUM REPOSITORY recipes/default.rb
  29. 29. INSTALL PACKAGE
  30. 30. SERVICE IS RUNNING
  31. 31. LEARN CHEF
  32. 32. Software Server Craftsmen
  33. 33. CONFIGURATION WORKFLOW
  34. 34. VERSION CONTROL https://www.youtube.com/watch?v=ZDR433b0HJY $> git init $> git add . $> git commit –m “new commit” $> git remote add git:git@... $> git push origin master Chef/Puppet Server is not Version Control!!
  35. 35. DEPENDENCY MANAGEMENT Tools: Berkshelf librarian-chef
  36. 36. UNIT TESTING chefspec (ruby gem) https://github.com/acrmp/chefspec Test a cookbook fast and from anywhere spec/default_spec.rb
  37. 37. CONTINUOUS TESTING guard (ruby gem) https://github.com/guard/guard When a local file changes, then run unit tests. Guardfile
  38. 38. INTEGRATION TESTING test kitchen (ruby gem) https://github.com/opscode/test-kitchen Run and test cookbook in Vagrant or LXC container. .kitchen.yml
  39. 39. STATIC ANALYSIS foodcritic (ruby gem) http://acrmp.github.io/foodcritic/ Style guide and find defects in cookbook source code.
  40. 40. CONTINUOUS INTEGRATION Jenkins (Java app) When a change is checked in, then run tests and deploy to Chef Server.
  41. 41. Best Practices Infrastructure as Code
  42. 42. FORWARD ONLY
  43. 43. AVOID SCRIPTING
  44. 44. SEPARATE CONFIG FROM DATA
  45. 45. USE & BUILD PACKAGES https://github.com/jordansissel/fpm
  46. 46. LEARN TO PROGRAM Ops acting like developers… Learn the language! Learn the environment: • rvm • rbenv • gems • bundler
  47. 47. THANK YOU! Mike McGarr Director of Learn DevOps Blackboard Inc. michael.mcgarr@blackboard.com @jmichaelmcgarr http://earlyandoften.wordpress.com

×