Consistent Development Environment with Vagrant and Chef
-
Upload
gerald-villorente -
Category
Internet
-
view
1.066 -
download
0
Transcript of Consistent Development Environment with Vagrant and Chef
{{ Dev with Ops in MindDev with Ops in Mind }} :: Building Consistent Environment with
Vagrant and Chef
Gerald Z. VillorenteSenior Drupal Developer | DevOps Engineer | Proud Dad
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
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 at Drupal Engineer and Mutant at X-TeamX-Team 2014-present 2014-present(A global development team of 100+ carefully chosen specialists. )(A global development team of 100+ carefully chosen specialists. )
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?)
Dev Setup (traditional)Dev Setup (traditional)
Agenda:
Bullet Proof SetupBullet Proof Setup
Agenda:
VagrantVagrant
Agenda:
Agenda:
Why Vagrant?Why Vagrant?
Dev with Ops in MindDev with Ops in Mind
Agenda:
Agenda:
Agenda:
Why Chef?Why Chef?
Dev SetupDev SetupDev SetupDev Setup
Inconsistent OS between Prod, Dev, Staging, and Local
Inconsistent Web Server between Prod, Dev, Staging, and Local
IIS ApacheNginX
Lighttpd
Inconsistent version of libraries, server, and database.
PHP 5.3PHP 5.4
PHP 5.5Apache 2.2
Apache 2.4Drush 4.x
Drush 5.xVarnish 3.x
Varnish 4.xMySQL 5.1
MySQL 5.5
Inconsistent settings/configurations.
memory_limit = 256Mmax_allowed_packet = 16M
set beresp.http.cache-control = "max-age = 300";upload_max_filesize = 2M
key_buffer = 16Mmax_file_uploads = 20
query_cache_limit = 1M
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)
Unfortunately, most of Unfortunately, most of the time ...the time ...
Unfortunately, most of Unfortunately, most of the time ...the time ...
Bullet Proof SetupBullet Proof SetupBullet Proof SetupBullet Proof Setup
Prod = Stage = Dev = LocalProd = Stage = Dev = LocalProd = Stage = Dev = LocalProd = Stage = Dev = Local
Virtualized EnvironmentsVirtualized EnvironmentsVirtualized EnvironmentsVirtualized Environments
Consistent operating systems and libraries and extentions.Consistent operating systems and libraries and extentions. New comers can get going with the development right away. No New 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. No New 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:
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:
VagrantVagrantVagrantVagrant
A tool for building and A tool for building and distributing virtualized distributing virtualized
environments.environments.
A tool for building and A tool for building and distributing virtualized distributing virtualized
environments.environments.
Why Vagrant?Why Vagrant?Why Vagrant?Why Vagrant?
IsolationIsolationIsolationIsolation
Mirror ProductionMirror ProductionMirror ProductionMirror Production
Test Ops scripts Test Ops scripts with a free serverwith a free serverTest Ops scripts Test Ops scripts
with a free serverwith a free server
Designers and QA Designers and QA can setup their environment can setup their environment
easilyeasily
Designers and QA Designers and QA can setup their environment can setup their environment
easilyeasily
Faster OnboardingFaster OnboardingFaster OnboardingFaster Onboarding
DemoDemoDemoDemo
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))
DistributionDistribution $ vagrant package --base VM_ID --output BOX_NAME.box
DistributionDistribution $ vagrant package --base VM_ID --output BOX_NAME.box
Dev with Dev with Ops in MindOps in MindDev with Dev with
Ops in MindOps in Mind
The Goal: Develop Cookbooks The Goal: Develop Cookbooks and Modules to run in a and Modules to run in a
VM and ProductionVM and Production
The Goal: Develop Cookbooks The Goal: Develop Cookbooks and Modules to run in a and Modules to run in a
VM and ProductionVM and Production
Little Extra EffortLittle Extra EffortBig GainBig Gain
Good PracticesGood Practices
Little Extra EffortLittle Extra EffortBig GainBig Gain
Good PracticesGood Practices
Vagrant and DevOps:
ChefChefA tool for automating the provisioning and management of serversA tool for automating the provisioning and management of servers
ChefChefA tool for automating the provisioning and management of serversA tool for automating the provisioning and management of servers
A Good ExampleA Good ExampleA Good ExampleA Good Example
Why Chef?Why Chef?Why Chef?Why Chef?
Less documentationLess documentationLess documentationLess documentation
Bash doesn't scale. Seriously.Bash doesn't scale. Seriously.Bash is a wonderful thing, but like all UNIX tools, it is fundamentally Bash is a wonderful thing, but like all UNIX tools, it is fundamentally limited by design. Bash doesn't have a code reuse mechanism more limited 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 fundamentally Bash is a wonderful thing, but like all UNIX tools, it is fundamentally limited by design. Bash doesn't have a code reuse mechanism more limited by design. Bash doesn't have a code reuse mechanism more
powerful than functions.powerful than functions.
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?
Technical Awesomeness.Technical Awesomeness.Technical Awesomeness.Technical Awesomeness.
NOSQL FTWNOSQL FTWOne of the virtues that many *nix tools share is that they store their One of the virtues that many *nix tools share is that they store their
configurations in text files rather than binary formats or in a configurations in text files rather than binary formats or in a database. database.
Chef stores your system configurations in text Chef 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 FTWOne of the virtues that many *nix tools share is that they store their One of the virtues that many *nix tools share is that they store their
configurations in text files rather than binary formats or in a configurations in text files rather than binary formats or in a database. database.
Chef stores your system configurations in text Chef 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.
Knowing is Half the BattleKnowing is Half the BattleCChef uses Ohai to collect data about your system. Your recipes can hef 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 BattleCChef uses Ohai to collect data about your system. Your recipes can hef 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
SearchSearchSearch is a feature in Chef Server that allows you to query the Search is a feature in Chef Server that allows you to query the
configuration information of all other servers and of globally-defined configuration information of all other servers and of globally-defined databags (global variable). This allows you to do things like configure databags (global variable). This allows you to do things like configure clusters where a member of cluster needs to know not only about its clusters where a member of cluster needs to know not only about its
own configuration but about the configurations of the other own configuration but about the configurations of the other members of the cluster.members of the cluster.
SearchSearchSearch is a feature in Chef Server that allows you to query the Search is a feature in Chef Server that allows you to query the
configuration information of all other servers and of globally-defined configuration information of all other servers and of globally-defined databags (global variable). This allows you to do things like configure databags (global variable). This allows you to do things like configure clusters where a member of cluster needs to know not only about its clusters where a member of cluster needs to know not only about its
own configuration but about the configurations of the other own configuration but about the configurations of the other members of the cluster.members of the cluster.
KnifeKnifeKnife is one of the truly great command line tools. It is your primary Knife is one of the truly great command line tools. It is your primary mechanism for interacting with the chef-server. Knife shares many mechanism 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.
KnifeKnifeKnife is one of the truly great command line tools. It is your primary Knife is one of the truly great command line tools. It is your primary mechanism for interacting with the chef-server. Knife shares many mechanism 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.
ShefShefShef works the way you work, in an iterative manner. Most of us Shef 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 create Fire up shef and you can on the fly play with attributes and create recipes. Further, you can connect to your server and download the recipes. Further, you can connect to your server and download the
cookbooks.cookbooks.
ShefShefShef works the way you work, in an iterative manner. Most of us Shef 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 create Fire up shef and you can on the fly play with attributes and create recipes. Further, you can connect to your server and download the recipes. Further, you can connect to your server and download the
cookbooks.cookbooks.
You can stop You can stop reinventing the wheel.reinventing the wheel.
Until Chef, we sysadmins did not have a truly modular way to Until 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 stop You can stop reinventing the wheel.reinventing the wheel.
Until Chef, we sysadmins did not have a truly modular way to Until Chef, we sysadmins did not have a truly modular way to abstract and share our system configurations.abstract and share our system configurations.
DemoDemo
Zero Ruby knowledge?Zero Ruby knowledge?Zero Ruby knowledge?Zero Ruby knowledge?
rove.iorove.io
PuPHPetPuPHPet
Questions?Questions?Questions?Questions?
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:
1. Mitchell Hashimoto 1. Mitchell Hashimoto Founder of HashiCorp, Creator of Vagrant and PackerFounder of HashiCorp, Creator of Vagrant and Packer2. Opscode 2. Opscode Creator of ChefCreator of Chef3. Puppet Labs 3. Puppet Labs Creator of PuppetCreator of Puppet
Credits:
Thank You!!Salamat!Salamat!