Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
2014 DevOps Day – Philippines
February 22, 2014

Microsoft Philippines

8th Floor, 6750 Ayala Ave., Makati City
{ DevOps Way } : Consistent
Development Environment using
Vagrant and Chef

Gerald Z. Villorente

DevOps Engineer | Drupal Developer | Open-Source Enthusiast
About Me
 Started to learn how to use computer in 2005
 I became a computer technician in 2007
 I became a Web Developer in 2009
 Drupalista since 2011
 Drupal Developer at CNN Travel|KiteSystems 2011-2013
 DevOps Engineer at BodogNation 2013-2014
 Drupal Engineer at X-Team 2014-present
Agenda:
Agenda:

 The Traditional Setup
 What is Vagrant
 Why to use Vagrant
 DevOps with Vagrant in Mind
 What is Chef
 Why to use Chef
Your Dev and Prod
environment
are not the same!
 Different Operating Systems
 Different version of PHP|Python|Ruby|Node.js
 Different configuration files
 Different libraries and extensions
Well, it worked on my
machine!
Against DevOps principle!
Dev and Ops War
The Right Way!
Virtualized Environments
Reasons why we should:
Reasons why we should:
 Consistent Operating Systems and PHP|Python|Ruby|Node.js
versions between production and development machine.
 New comers can get going with the development right away. No
more painful setups.
 Redistributable in case of hardware failure.
Reasons why we don't:
Reasons why we don't:

 Can never get the networking between host and guest OS.
 Scared of the command line.
 Massive overhead keeping the VM up to date.
What
is Vagrant?
A tool for building and
distributing virtualized
environments.
Why Vagrant?
Isolation
Mirror Production
Test Ops scripts
with a free server
Designers and QA
can setup their
environment easily
Faster Onboarding
Getting Started

 Install Virtualbox | VMware
 Install Vagrant
 Import your base OS ($ vagrant box add [BASE_NAME] [PATH.box])
 Generate Vagrantfile config ($ vagrant init [BASE_NAME])
 Boot your guest machine ($ vagrant up)
Demo
That's the OS only.
How about the
packages I needed?
Should I install them manually?
Well, you have 2 options.

 Package an existing running environment.

$ vagrant package --base VM_ID --output BOX_NAME.box

 Use Chef or Puppet to provision that packages and needed config.
DevOps with
Vagrant in Mind
The Goal: Develop
Cookbooks and Modules
to run in a
VM and Production
Vagrant and DevOps:
Vagrant and DevOps:

Little Extra Effort
Big Gain
Good Practices
Chef

A tool for automating the provisioning and management of servers
A Good Example
Why Chef?
Less documentation
Bash doesn't scale.
Seriously.

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
powerful than functions.
Maybe you can do this using “sed”. But hey are you sick?
Technical Awesomeness.
NOSQL FTW

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
database.
Chef stores your system configurations in text
and in a database. It accomplishes this by using the documentoriented database, CouchDB.
Knowing is Half the Battle

Chef uses Ohai to collect data about your system. Your recipes can
access these attributes and make decisions based on them.
For example, you can determine which version of Red Hat you are
using simply by looking up the value of node['platform_version']. You
don't have to cat | grep | awk to find out which release you are on.
Search

Search is a feature in Chef Server that allows you to query the
configuration information of all other servers and of globally-defined
databags (global variable). This allows you to do things like configure
clusters where a member of cluster needs to know not only about its
own configuration but about the configurations of the other
members of the cluster.
Knife

Knife is one of the truly great command line tools. It is your primary
mechanism for interacting with the chef-server. Knife shares many
usage patterns with git. If you love git, you'll love knife.
Shef

Shef works the way you work, in an iterative manner. Most of us
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
recipes. Further, you can connect to your server and download the
cookbooks.
Chef grows with you.

Chef uses pure Ruby as its configuration language, not a shackled
subset of ruby, nor yet another custom configuration language. You
only have to learn a small amount of ruby to get started with chef.
You can stop
reinventing the wheel.

Until Chef, we sysadmins did not have a truly modular way to
abstract and share our system configurations.
Demo
I don't know Ruby. How
can I create a robust
script|recipe|manifest?
rove.io
PuPHPet
Questions?
Thank You!
References:
References:
1. http://www.scoop.it/
2. http://devopsanywhere.blogspot.com/
3. http://www.vagrantup.com/
4. https://puphpet.com/
5. http://rove.io/
6. http://www.getchef.com/
7. http://puppetlabs.com/
Credits:
Credits:
1. Mitchell Hashimoto
Founder of HashiCorp, Creator of Vagrant and Packer
2. Opscode
Creator of Chef
3. Puppet Labs
Creator of Puppet

More Related Content

Consistent Development Environment using Vagrant and Chef

  • 1. 2014 DevOps Day – Philippines February 22, 2014 Microsoft Philippines 8th Floor, 6750 Ayala Ave., Makati City
  • 2. { DevOps Way } : Consistent Development Environment using Vagrant and Chef Gerald Z. Villorente DevOps Engineer | Drupal Developer | Open-Source Enthusiast
  • 3. About Me  Started to learn how to use computer in 2005  I became a computer technician in 2007  I became a Web Developer in 2009  Drupalista since 2011  Drupal Developer at CNN Travel|KiteSystems 2011-2013  DevOps Engineer at BodogNation 2013-2014  Drupal Engineer at X-Team 2014-present
  • 4. Agenda: Agenda:  The Traditional Setup  What is Vagrant  Why to use Vagrant  DevOps with Vagrant in Mind  What is Chef  Why to use Chef
  • 5. Your Dev and Prod environment are not the same!  Different Operating Systems  Different version of PHP|Python|Ruby|Node.js  Different configuration files  Different libraries and extensions
  • 6. Well, it worked on my machine!
  • 11. Reasons why we should: Reasons why we should:  Consistent Operating Systems and PHP|Python|Ruby|Node.js versions between production and development machine.  New comers can get going with the development right away. No more painful setups.  Redistributable in case of hardware failure.
  • 12. Reasons why we don't: Reasons why we don't:  Can never get the networking between host and guest OS.  Scared of the command line.  Massive overhead keeping the VM up to date.
  • 14. A tool for building and distributing virtualized environments.
  • 18. Test Ops scripts with a free server
  • 19. Designers and QA can setup their environment easily
  • 21. Getting Started  Install Virtualbox | VMware  Install Vagrant  Import your base OS ($ vagrant box add [BASE_NAME] [PATH.box])  Generate Vagrantfile config ($ vagrant init [BASE_NAME])  Boot your guest machine ($ vagrant up)
  • 22. Demo
  • 23. That's the OS only. How about the packages I needed? Should I install them manually?
  • 24. Well, you have 2 options.  Package an existing running environment. $ vagrant package --base VM_ID --output BOX_NAME.box  Use Chef or Puppet to provision that packages and needed config.
  • 26. The Goal: Develop Cookbooks and Modules to run in a VM and Production
  • 27. Vagrant and DevOps: Vagrant and DevOps: Little Extra Effort Big Gain Good Practices
  • 28. Chef A tool for automating the provisioning and management of servers
  • 32. Bash doesn't scale. Seriously. 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 powerful than functions.
  • 33. Maybe you can do this using “sed”. But hey are you sick?
  • 35. NOSQL FTW 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 database. Chef stores your system configurations in text and in a database. It accomplishes this by using the documentoriented database, CouchDB.
  • 36. Knowing is Half the Battle Chef uses Ohai to collect data about your system. Your recipes can access these attributes and make decisions based on them. For example, you can determine which version of Red Hat you are using simply by looking up the value of node['platform_version']. You don't have to cat | grep | awk to find out which release you are on.
  • 37. Search Search is a feature in Chef Server that allows you to query the configuration information of all other servers and of globally-defined databags (global variable). This allows you to do things like configure clusters where a member of cluster needs to know not only about its own configuration but about the configurations of the other members of the cluster.
  • 38. Knife Knife is one of the truly great command line tools. It is your primary mechanism for interacting with the chef-server. Knife shares many usage patterns with git. If you love git, you'll love knife.
  • 39. Shef Shef works the way you work, in an iterative manner. Most of us 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 recipes. Further, you can connect to your server and download the cookbooks.
  • 40. Chef grows with you. Chef uses pure Ruby as its configuration language, not a shackled subset of ruby, nor yet another custom configuration language. You only have to learn a small amount of ruby to get started with chef.
  • 41. You can stop reinventing the wheel. Until Chef, we sysadmins did not have a truly modular way to abstract and share our system configurations.
  • 42. Demo
  • 43. I don't know Ruby. How can I create a robust script|recipe|manifest?
  • 48. References: References: 1. http://www.scoop.it/ 2. http://devopsanywhere.blogspot.com/ 3. http://www.vagrantup.com/ 4. https://puphpet.com/ 5. http://rove.io/ 6. http://www.getchef.com/ 7. http://puppetlabs.com/
  • 49. Credits: Credits: 1. Mitchell Hashimoto Founder of HashiCorp, Creator of Vagrant and Packer 2. Opscode Creator of Chef 3. Puppet Labs Creator of Puppet