infrastructure as code (bbworld/devcon13)

47
Infrastructur e as Code Mike McGarr, Director of Learn DevOps Blackboard, Inc.

Upload: mike-mcgarr

Post on 10-May-2015

2.143 views

Category:

Technology


4 download

DESCRIPTION

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

TRANSCRIPT

  • 1.Infrastructure as Code Mike McGarr, Director of Learn DevOps Blackboard, Inc.

2. ABOUT ME Mike McGarr Director of Learn DevOps Blackboard Inc. [email protected] I have been at Blackboard for 8 months. Software Engineer for 12+ years Founder of the DC Continuous Integration, Delivery and Deployment Meetup 3. LEARN DEVOPS TEAM Purpose: Provide development support to the rest of Learns Product Development (PD) team. Includes: Build/Release Engineering Manage Enterprise Applications Manage Data Center Help desk for PD 4. ENTERPRISE APPLICATIONS Problems: Manually managed Little/No Version Control No history/context 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. FIREFIGHTING 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. TOOLS 9. CONFIGURATION SYNCHRONIZATION http://martinfowler.com/bliki/ConfigurationSynchronization.html 10. CONFIGURATION DRIFT http://kief.com/configuration-drift.html 11. NO MANUAL CHANGES http://www.agileweboperations.com/devops-protocol-no-manual-changes 12. PHOENIX SERVERS http://martinfowler.com/bliki/PhoenixServer.html 13. IMMUTABLE SERVERS http://martinfowler.com/bliki/ImmutableServer.html 14. REMINDER: CULTURE FIRST 15. Simple Example Infrastructure as Code 16. BUILD A JENKINS SERVER 17. CHEFS ARCHITECTURE 18. CREATE COOKBOOK http://youtu.be/Yu3--aljnJ0 19. VAGRANT $> vagrant box add $> vagrant init $> vagrant up $> vagrant ssh $> vagrant provision $> vagrant suspend $> vagrant destroy 20. VAGRANT UP http://youtu.be/I0Kd7mzEOD4 21. USE CHEF http://youtu.be/UhXWrQvwsyE 22. INSTALLING JENKINS 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. INSTALL JDK http://youtu.be/Pt7cg3oa4Hs 0% http://youtu.be/Pt7cg3oa4Hs 25. ADD JENKINS USER http://youtu.be/2VhvHXPKR6M 26. REUSE LIBRARIES 27. SECURITY templates/defaults/port_jenkins.erb recipes/default.rb 28. YUM REPOSITORY recipes/default.rb 29. INSTALL PACKAGE 30. SERVICE IS RUNNING 31. LEARN CHEF 32. Software Server Craftsmen 33. CONFIGURATION WORKFLOW 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. DEPENDENCY MANAGEMENT Tools: Berkshelf librarian-chef 36. UNIT TESTING chefspec (ruby gem) https://github.com/acrmp/chefspec Test a cookbook fast and from anywhere spec/default_spec.rb 37. CONTINUOUS TESTING guard (ruby gem) https://github.com/guard/guard When a local file changes, then run unit tests. Guardfile 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. STATIC ANALYSIS foodcritic (ruby gem) http://acrmp.github.io/foodcritic/ Style guide and find defects in cookbook source code. 40. CONTINUOUS INTEGRATION Jenkins (Java app) When a change is checked in, then run tests and deploy to Chef Server. 41. Best Practices Infrastructure as Code 42. FORWARD ONLY 43. AVOID SCRIPTING 44. SEPARATE CONFIG FROM DATA 45. USE & BUILD PACKAGES https://github.com/jordansissel/fpm 46. LEARN TO PROGRAM Ops acting like developers Learn the language! Learn the environment: rvm rbenv gems bundler 47. THANK YOU! Mike McGarr Director of Learn DevOps Blackboard Inc. [email protected] @jmichaelmcgarr http://earlyandoften.wordpress.com