Consistent Development Environment with Vagrant and Chef

  • 428 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
428
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
22
Comments
0
Likes
3

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. {{ Dev with Ops in MindDev with Ops in Mind }} :: Building Consistent Environment with Vagrant and Chef Gerald Z. Villorente Senior Drupal Developer | DevOps Engineer | Proud Dad
  • 2. About MeAbout Me  Open-source advocateOpen-source advocate  Learned how to power on and operate a PC in 2005Learned how to power on and operate a PC in 2005  Became system administrator in 2007Became system administrator in 2007  Became web developer in 2009Became web developer in 2009  Drupalista since 2011Drupalista since 2011  Drupal Developer at CNN Travel | KiteSystems 2011-2013Drupal Developer at CNN Travel | KiteSystems 2011-2013  DevOps Engineer at BodogNation | Novenix Corp. 2013-2014DevOps Engineer at BodogNation | Novenix Corp. 2013-2014
  • 3. About MeAbout Me  Started to learn how to use computer in 2005Started to learn how to use computer in 2005  I became a computer technician in 2007I became a computer technician in 2007  I became a Web Developer in 2009I became a Web Developer in 2009  Drupalista since 2011Drupalista since 2011  Drupal Developer at CNN Travel | KiteSystems 2011-2013Drupal Developer at CNN Travel | KiteSystems 2011-2013  DevOps Engineer at BodogNation 2013-2014DevOps Engineer at BodogNation 2013-2014  Drupal Engineer and Mutant at X-Team 2014-presentDrupal Engineer and Mutant at X-Team 2014-present About MeAbout Me  Started to learn how to use computer in 2005Started to learn how to use computer in 2005  I became a computer technician in 2007I became a computer technician in 2007  I became a Web Developer in 2009I became a Web Developer in 2009  Drupalista since 2011Drupalista since 2011  Drupal Developer at CNN Travel | KiteSystems 2011-2013Drupal Developer at CNN Travel | KiteSystems 2011-2013  DevOps Engineer at BodogNation 2013-2014DevOps Engineer at BodogNation 2013-2014  Drupal Engineer and Mutant at X-Team 2014-presentDrupal Engineer and Mutant at X-Team 2014-present Drupal Engineer and Mutant atDrupal Engineer and Mutant at X-TeamX-Team 2014-present2014-present (A global development team of 100+ carefully chosen specialists. )(A global development team of 100+ carefully chosen specialists. )
  • 4. About YouAbout You  Dev EngineerDev Engineer  Ops EngineerOps Engineer  DevOps EngineerDevOps Engineer  Web ArchitectWeb Architect  Not a Graphic Designer (do you really care?)Not a Graphic Designer (do you really care?)
  • 5. Dev Setup (traditional)Dev Setup (traditional) Agenda:
  • 6. Bullet Proof SetupBullet Proof Setup Agenda:
  • 7. VagrantVagrant Agenda:
  • 8. Agenda: Why Vagrant?Why Vagrant?
  • 9. Dev with Ops in MindDev with Ops in Mind Agenda:
  • 10. Agenda:
  • 11. Agenda: Why Chef?Why Chef?
  • 12. Dev SetupDev SetupDev SetupDev Setup
  • 13. Inconsistent OS between Prod, Dev, Staging, and Local
  • 14. Inconsistent Web Server between Prod, Dev, Staging, and Local IIS Apache NginX Lighttpd
  • 15. Inconsistent version of libraries, server, and database. PHP 5.3 PHP 5.4 PHP 5.5 Apache 2.2 Apache 2.4 Drush 4.x Drush 5.x Varnish 3.x Varnish 4.x MySQL 5.1 MySQL 5.5
  • 16. Inconsistent settings/configurations. memory_limit = 256M max_allowed_packet = 16M set beresp.http.cache-control = "max-age = 300"; upload_max_filesize = 2M key_buffer = 16M max_file_uploads = 20 query_cache_limit = 1M
  • 17. Different libraries and extensions (Ex. GD vs. Imagemagick)Different libraries and extensions (Ex. GD vs. Imagemagick)Different libraries and extensions (Ex. GD vs. Imagemagick)Different libraries and extensions (Ex. GD vs. Imagemagick)
  • 18. Unfortunately, most ofUnfortunately, most of the time ...the time ... Unfortunately, most ofUnfortunately, most of the time ...the time ...
  • 19. Bullet Proof SetupBullet Proof SetupBullet Proof SetupBullet Proof Setup
  • 20. Prod = Stage = Dev = LocalProd = Stage = Dev = LocalProd = Stage = Dev = LocalProd = Stage = Dev = Local
  • 21. Virtualized EnvironmentsVirtualized EnvironmentsVirtualized EnvironmentsVirtualized Environments
  • 22.  Consistent operating systems and libraries and extentions.Consistent operating systems and libraries and extentions.  New comers can get going with the development right away. NoNew comers can get going with the development right away. No more painful setups.more painful setups.  Redistributable in case of hardware failure.Redistributable in case of hardware failure.  Consistent operating systems and libraries and extentions.Consistent operating systems and libraries and extentions.  New comers can get going with the development right away. NoNew comers can get going with the development right away. No more painful setups.more painful setups.  Redistributable in case of hardware failure.Redistributable in case of hardware failure. Reasons why we should:
  • 23.  Can never get the networking between host and guest OS.Can never get the networking between host and guest OS.  Scared of the command line.Scared of the command line.  Massive overhead keeping the VM up to date.Massive overhead keeping the VM up to date.  Can never get the networking between host and guest OS.Can never get the networking between host and guest OS.  Scared of the command line.Scared of the command line.  Massive overhead keeping the VM up to date.Massive overhead keeping the VM up to date. Reasons why we don't:
  • 24. VagrantVagrantVagrantVagrant
  • 25. A tool for building andA tool for building and distributing virtualizeddistributing virtualized environments.environments. A tool for building andA tool for building and distributing virtualizeddistributing virtualized environments.environments.
  • 26. Why Vagrant?Why Vagrant?Why Vagrant?Why Vagrant?
  • 27. IsolationIsolationIsolationIsolation
  • 28. Mirror ProductionMirror ProductionMirror ProductionMirror Production
  • 29. Test Ops scriptsTest Ops scripts with a free serverwith a free server Test Ops scriptsTest Ops scripts with a free serverwith a free server
  • 30. Designers and QADesigners and QA can setup their environmentcan setup their environment easilyeasily Designers and QADesigners and QA can setup their environmentcan setup their environment easilyeasily
  • 31. Faster OnboardingFaster OnboardingFaster OnboardingFaster Onboarding
  • 32. DemoDemoDemoDemo
  • 33. Getting StartedGetting Started  Install Virtualbox | VMwareInstall Virtualbox | VMware  Install VagrantInstall Vagrant  Import your base OS (Import your base OS ($ vagrant box add [BASE_NAME] [PATH.box]$ vagrant box add [BASE_NAME] [PATH.box]))  Generate Vagrantfile config (Generate Vagrantfile config ($ vagrant init [BASE_NAME]$ vagrant init [BASE_NAME]))  Boot your guest machine (Boot your guest machine ($ vagrant up$ vagrant up)) Getting StartedGetting Started  Install Virtualbox | VMwareInstall Virtualbox | VMware  Install VagrantInstall Vagrant  Import your base OS (Import your base OS ($ vagrant box add [BASE_NAME] [PATH.box]$ vagrant box add [BASE_NAME] [PATH.box]))  Generate Vagrantfile config (Generate Vagrantfile config ($ vagrant init [BASE_NAME]$ vagrant init [BASE_NAME]))  Boot your guest machine (Boot your guest machine ($ vagrant up$ vagrant up))
  • 34. DistributionDistribution $ vagrant package --base VM_ID --output BOX_NAME.box DistributionDistribution $ vagrant package --base VM_ID --output BOX_NAME.box
  • 35. Dev withDev with Ops in MindOps in Mind Dev withDev with Ops in MindOps in Mind
  • 36. The Goal: Develop CookbooksThe Goal: Develop Cookbooks and Modules to run in aand Modules to run in a VM and ProductionVM and Production The Goal: Develop CookbooksThe Goal: Develop Cookbooks and Modules to run in aand Modules to run in a VM and ProductionVM and Production
  • 37. Little Extra EffortLittle Extra Effort Big GainBig Gain Good PracticesGood Practices Little Extra EffortLittle Extra Effort Big GainBig Gain Good PracticesGood Practices Vagrant and DevOps:
  • 38. ChefChef A tool for automating the provisioning and management of serversA tool for automating the provisioning and management of servers ChefChef A tool for automating the provisioning and management of serversA tool for automating the provisioning and management of servers
  • 39. A Good ExampleA Good ExampleA Good ExampleA Good Example
  • 40. Why Chef?Why Chef?Why Chef?Why Chef?
  • 41. Less documentationLess documentationLess documentationLess documentation
  • 42. Bash doesn't scale. Seriously.Bash doesn't scale. Seriously. Bash is a wonderful thing, but like all UNIX tools, it is fundamentallyBash is a wonderful thing, but like all UNIX tools, it is fundamentally limited by design. Bash doesn't have a code reuse mechanism morelimited by design. Bash doesn't have a code reuse mechanism more powerful than functions.powerful than functions. Bash doesn't scale. Seriously.Bash doesn't scale. Seriously. Bash is a wonderful thing, but like all UNIX tools, it is fundamentallyBash is a wonderful thing, but like all UNIX tools, it is fundamentally limited by design. Bash doesn't have a code reuse mechanism morelimited by design. Bash doesn't have a code reuse mechanism more powerful than functions.powerful than functions.
  • 43. Maybe you can do this using “sed”. But hey are you sick?Maybe you can do this using “sed”. But hey are you sick?Maybe you can do this using “sed”. But hey are you sick?Maybe you can do this using “sed”. But hey are you sick?
  • 44. Technical Awesomeness.Technical Awesomeness.Technical Awesomeness.Technical Awesomeness.
  • 45. NOSQL FTWNOSQL FTW One of the virtues that many *nix tools share is that they store theirOne of the virtues that many *nix tools share is that they store their configurations in text files rather than binary formats or in aconfigurations in text files rather than binary formats or in a database.database. Chef stores your system configurations in textChef stores your system configurations in text and in a database. It accomplishes this by using the document-and in a database. It accomplishes this by using the document- oriented database, CouchDB.oriented database, CouchDB. NOSQL FTWNOSQL FTW One of the virtues that many *nix tools share is that they store theirOne of the virtues that many *nix tools share is that they store their configurations in text files rather than binary formats or in aconfigurations in text files rather than binary formats or in a database.database. Chef stores your system configurations in textChef stores your system configurations in text and in a database. It accomplishes this by using the document-and in a database. It accomplishes this by using the document- oriented database, CouchDB.oriented database, CouchDB.
  • 46. Knowing is Half the BattleKnowing is Half the Battle CChef uses Ohai to collect data about your system. Your recipes canhef uses Ohai to collect data about your system. Your recipes can access these attributes and make decisions based on them.access these attributes and make decisions based on them. Ex: node['platform_version'] vs. cat | grep | awkEx: node['platform_version'] vs. cat | grep | awk Knowing is Half the BattleKnowing is Half the Battle CChef uses Ohai to collect data about your system. Your recipes canhef uses Ohai to collect data about your system. Your recipes can access these attributes and make decisions based on them.access these attributes and make decisions based on them. Ex: node['platform_version'] vs. cat | grep | awkEx: node['platform_version'] vs. cat | grep | awk
  • 47. SearchSearch Search is a feature in Chef Server that allows you to query theSearch is a feature in Chef Server that allows you to query the configuration information of all other servers and of globally-definedconfiguration information of all other servers and of globally-defined databags (global variable). This allows you to do things like configuredatabags (global variable). This allows you to do things like configure clusters where a member of cluster needs to know not only about itsclusters where a member of cluster needs to know not only about its own configuration but about the configurations of the otherown configuration but about the configurations of the other members of the cluster.members of the cluster. SearchSearch Search is a feature in Chef Server that allows you to query theSearch is a feature in Chef Server that allows you to query the configuration information of all other servers and of globally-definedconfiguration information of all other servers and of globally-defined databags (global variable). This allows you to do things like configuredatabags (global variable). This allows you to do things like configure clusters where a member of cluster needs to know not only about itsclusters where a member of cluster needs to know not only about its own configuration but about the configurations of the otherown configuration but about the configurations of the other members of the cluster.members of the cluster.
  • 48. KnifeKnife Knife is one of the truly great command line tools. It is your primaryKnife is one of the truly great command line tools. It is your primary mechanism for interacting with the chef-server. Knife shares manymechanism for interacting with the chef-server. Knife shares many usage patterns with git. If you love git, you'll love knife.usage patterns with git. If you love git, you'll love knife. KnifeKnife Knife is one of the truly great command line tools. It is your primaryKnife is one of the truly great command line tools. It is your primary mechanism for interacting with the chef-server. Knife shares manymechanism for interacting with the chef-server. Knife shares many usage patterns with git. If you love git, you'll love knife.usage patterns with git. If you love git, you'll love knife.
  • 49. ShefShef Shef works the way you work, in an iterative manner. Most of usShef works the way you work, in an iterative manner. Most of us system administrators are self-taught and we learn best by doing.system administrators are self-taught and we learn best by doing. Fire up shef and you can on the fly play with attributes and createFire up shef and you can on the fly play with attributes and create recipes. Further, you can connect to your server and download therecipes. Further, you can connect to your server and download the cookbooks.cookbooks. ShefShef Shef works the way you work, in an iterative manner. Most of usShef works the way you work, in an iterative manner. Most of us system administrators are self-taught and we learn best by doing.system administrators are self-taught and we learn best by doing. Fire up shef and you can on the fly play with attributes and createFire up shef and you can on the fly play with attributes and create recipes. Further, you can connect to your server and download therecipes. Further, you can connect to your server and download the cookbooks.cookbooks.
  • 50. You can stopYou can stop reinventing the wheel.reinventing the wheel. Until Chef, we sysadmins did not have a truly modular way toUntil Chef, we sysadmins did not have a truly modular way to abstract and share our system configurations.abstract and share our system configurations. You can stopYou can stop reinventing the wheel.reinventing the wheel. Until Chef, we sysadmins did not have a truly modular way toUntil Chef, we sysadmins did not have a truly modular way to abstract and share our system configurations.abstract and share our system configurations.
  • 51. DemoDemo
  • 52. Zero Ruby knowledge?Zero Ruby knowledge?Zero Ruby knowledge?Zero Ruby knowledge?
  • 53. rove.iorove.io
  • 54. PuPHPetPuPHPet
  • 55. Questions?Questions?Questions?Questions?
  • 56. 1. http://www.scoop.it/1. http://www.scoop.it/ 2. http://devopsanywhere.blogspot.com/2. http://devopsanywhere.blogspot.com/ 3.3. http://www.vagrantup.com/http://www.vagrantup.com/ 4.4. https://puphpet.com/https://puphpet.com/ 5.5. http://rove.io/http://rove.io/ 6.6. http://www.getchef.com/http://www.getchef.com/ 7.7. http://puppetlabs.com/http://puppetlabs.com/ 8.8. http://www.vagrantbox.es/http://www.vagrantbox.es/ 9. http://virtualboxes.org/9. http://virtualboxes.org/ References:
  • 57. 1. Mitchell Hashimoto1. Mitchell Hashimoto Founder of HashiCorp, Creator of Vagrant and PackerFounder of HashiCorp, Creator of Vagrant and Packer 2. Opscode2. Opscode Creator of ChefCreator of Chef 3. Puppet Labs3. Puppet Labs Creator of PuppetCreator of Puppet Credits:
  • 58. Thank You!!Salamat!Salamat!