Consistent Development Environment with Vagrant and Chef
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?)
18. 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)
27. 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:
28. 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:
30. 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.
34. Test Ops scriptsTest Ops scripts
with a free serverwith a free server
Test Ops scriptsTest Ops scripts
with a free serverwith a free server
35. 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
41. 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
42. 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:
43. 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
47. 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.
48. 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?
50. 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.
51. 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
52. 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.
53. 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.
54. 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.
55. 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.
62. 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: