SlideShare a Scribd company logo
Reproducible and Portable
Work Environments with
Vagrant and Chef
About Me
• 33 years old, almost married
• From Karlsruhe, Germany
• Studied Computer Science
• Hobbies: guitar, climbing,
cycling, travel, photography
• Works in Phnom Penh for 3 months
• Working with TYPO3
Vagrant and Chef on FOSSASIA 2014
Outline
• Motivation
• Introducing Vagrant & Chef

• Vagrant „Hands-On“
• Advanced usage
Vagrant and Chef on FOSSASIA 2014
Motivation
• Internal project
• Estimated development time ~2 years
• Approx. 15 developers
• 2-day sprints, every second week
• 4 developers per sprint
Motivation
Observations
• Setting up dev environment takes > 1 day
– More than ½ of the sprint time!

• Developers spent too much time on setup
• Always needed physical server for testing
Solution: Vagrant Boxes
Provisioning 2 virtual machines...
• ...each with an extended LAMP stack*)

• ...with 4 different projects
takes less than 15 minutes

*) including RabbitMQ, Solr, Git, Composer, tons of PHP modules...
Technological Stack
VirtualBox
Free open source virtualization tool
Chef
Automation tool for
Configuration Management

Vagrant
“Remote control” for VirtualBox
Vagrant and Chef on FOSSASIA 2014
What is Vagrant?
• Building tool for portable work environments
• Tool for distributing work environments
• Written in Ruby
• Open Source
• Build upon well-established tools
Vagrant Components
• Vagrant Box
• Vagrantfile
• Provisioners
• Providers
Vagrant Boxes
• Pre-installed base images
• Used as base layer for all further provisioning
• Many different boxes available online:
The Vagrantfile
• Marks root directory of Vagrant project
• Describes what Vagrant box to use

• Describes settings of box (e.g. network)
• Triggers the provisioning of box (using Chef)
Provisioners
• Configures your Vagrant box by
– Installing packages and software
– Configuration and starting of services

• Multiple provisioners available
• Run once the box is booted
Providers
• Describe in which virtualization environment

to provision your machines
• Multiple providers available
– VirtualBox
– VMWare
– Amazon AWS
Vagrant and Chef on FOSSASIA 2014
What is Chef?
• Configuration Management automation tool
• Written in Ruby

• „Code your desired system state“
• Put system state into version control

• Relies on a client / server architecture
– Or use chef solo without a server
Chef Architecture
Chef Architecture
Vagrant and Chef on FOSSASIA 2014
Using chef-solo
• mount cookbooks directory into your box
config.vm.synced_folder "./chef", "/var/chef"
config.vm.synced_folder "./home", "/var/
vagrant-home"

• run chef-solo in your box
config.vm.provision :shell do |s|
s.inline = "sudo chef-solo -c /var/chef/
solo.rb -j /var/vagrant-home/config.json"
end
The solo.rb File
• Define some paths:
file_cache_path "/var/chef-cache"
cookbook_path ["/var/chef/cookbooks”]
data_bag_path "/var/chef/data_bags"
role_path "/var/chef/roles"
The config.json File
• Define cookbook runlist:
{"run_list" : ["recipe[cookbook_name]"]}

• Further configuration in config.json
overwrites defaults in cookbooks
node['key1']['key2']
Chef Provisioning Alternatives
• Different ways for Chef provisioning
– Mounting Cookbooks and use chef-solo

– Copy Cookbooks into box and use chef-solo
– Use Chef client in box and Chef server
Overview
2

Chef Cookbooks
/home/vagrant/chef

mounted/copied into
OR taken from chef server

Vagrant Box

4

uses
cookbooks
triggers
chef

3

remote
controlls

1
Vagrant and Chef on FOSSASIA 2014
Provisioning Activity

Provisioning Activity
Provision Projects

Configuration
Management
Booting Box
Set up Box

Chef,
Git
Vagrant,
Chef
Vagrant,
VirtualBox
Vagrant
Set Up Box
1. Install VirtualBox & Vagrant
2. Add a box
vagrant box add box_name http://box_url

1. Create a first Vagrantfile
mkdir vagrant
cd vagrant
vagrant init
Set up & Boot the Box
4. Use the box in your Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "box_name"
end

5. Boot your machine
vagrant up

6. ssh into your machine
vagrant ssh
Versioning and Distribution
• Remember: „Everything should be put into
Version Control!“
• Vagrantfile can easily be put into any VCS
• Distributing an environment is as easy as
git clone git@github.com:my/vagrant.git
cd vagrant
vagrant up
Daily Vagrant Usage
• Start the box
vagrant up

• Stop the box
Vagrant halt

• Suspend the box
vagrant suspend

• Resume the box
vagrant resume
Vagrant and Chef on FOSSASIA 2014
Multiple Boxes for Multiple Projects
PROs
- Easy to set up
- Can have different systems in a box

Vagrant Box
Project 1

Vagrant Box
Project 2

CONs
- Have multiple Boxes running at the
same time consumes resources

Vagrant Box
Project 3
Multiple Projects in one Box
PROs
- Less ressources required

Vagrant Box
Project 1
Project 2
Project 3

CONs
- No easy way to set up
- Longer provisioning time
- Bigger boxes
Identical Copy of Server
server is provisioned
using Chef Client

Chef Client

Chef Server

Chef Cookbooks

mounted/copied into
OR taken from chef server
provisioned
using same cookboks

Identical Copy of Server
as Vagrant Box
Vagrant & Chef for CI / CD

• Set up the whole deployment chain locally
• Use tools like Jenkins inside your boxes
• Provision the projects on Jenkins with Chef
DevOps
• Tools like Vagrant and Chef bring Developers
and system operators closer together

• Learn from each other
• Use each other‘s tools for problem solving
Vagrant and Chef on FOSSASIA 2014
Vagrant and Chef on FOSSASIA 2014
Summary
• Vagrant is a great tool for portable boxes
• Chef can help you manage your configuration
• „Infrastructure as Code“
• Same environment on dev and live system
• DevOps brings devs and admins together

More Related Content

What's hot (20)

KEY
Using Vagrant
andygale
 
KEY
Avoiding surprises with Chef and Vagrant
andygale
 
PDF
Testable Infrastructure with Chef, Test Kitchen, and Docker
Mandi Walls
 
PDF
Automated Infrastructure and Application Management
Clark Everetts
 
PPTX
Vagrant to-aws-flow
Kimberly Macias
 
PPTX
CLUG 2014-10 - Cookbook CI with Jenkins
Zachary Stevens
 
PPTX
How to Write Chef Cookbook
devopsjourney
 
PPTX
Testing for infra code using test-kitchen,docker,chef
kamalikamj
 
PPTX
Baking docker using chef
Mukta Aphale
 
PDF
Infrastructure Automation with Chef
Jonathan Weiss
 
PDF
Ansible Introduction
Robert Reiz
 
PDF
Introduction to Chef
Pubudu Suharshan Perera
 
PPTX
Continuous Delivery and Infrastructure as Code
Sascha Möllering
 
PDF
Automated Deployment and Configuration Engines. Ansible
Alberto Molina Coballes
 
PDF
Steamlining your puppet development workflow
Tomas Doran
 
PDF
Puppet Development Workflow
Jeffery Smith
 
PDF
Chef Fundamentals Training Series Module 1: Overview of Chef
Chef Software, Inc.
 
ODP
Introduction to Chef
Knoldus Inc.
 
PDF
Docker Docker Docker Chef
Sean OMeara
 
PDF
CI/CD Using Ansible and Jenkins for Infrastructure
Faisal Shaikh
 
Using Vagrant
andygale
 
Avoiding surprises with Chef and Vagrant
andygale
 
Testable Infrastructure with Chef, Test Kitchen, and Docker
Mandi Walls
 
Automated Infrastructure and Application Management
Clark Everetts
 
Vagrant to-aws-flow
Kimberly Macias
 
CLUG 2014-10 - Cookbook CI with Jenkins
Zachary Stevens
 
How to Write Chef Cookbook
devopsjourney
 
Testing for infra code using test-kitchen,docker,chef
kamalikamj
 
Baking docker using chef
Mukta Aphale
 
Infrastructure Automation with Chef
Jonathan Weiss
 
Ansible Introduction
Robert Reiz
 
Introduction to Chef
Pubudu Suharshan Perera
 
Continuous Delivery and Infrastructure as Code
Sascha Möllering
 
Automated Deployment and Configuration Engines. Ansible
Alberto Molina Coballes
 
Steamlining your puppet development workflow
Tomas Doran
 
Puppet Development Workflow
Jeffery Smith
 
Chef Fundamentals Training Series Module 1: Overview of Chef
Chef Software, Inc.
 
Introduction to Chef
Knoldus Inc.
 
Docker Docker Docker Chef
Sean OMeara
 
CI/CD Using Ansible and Jenkins for Infrastructure
Faisal Shaikh
 

Similar to Vagrant and Chef on FOSSASIA 2014 (20)

PDF
Powering Development and Testing Environments with Vagrant
Coen Jacobs
 
PDF
Improved development workflows using vagrant
Makis Asimidis
 
PDF
Vagrant For DevOps
Lalatendu Mohanty
 
PDF
Instant ColdFusion with Vagrant
ColdFusionConference
 
PDF
Making Developers Productive with Vagrant, VirtualBox, and Docker
John Rofrano
 
PDF
Instant ColdFusion with Vagrant
ColdFusionConference
 
PDF
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
OlinData
 
PDF
Using Vagrant, Puppet, Testing & Hadoop
Puppet
 
PDF
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
Walter Heck
 
PDF
Vagrant Binding JayDay 2013
Hendrik Ebbers
 
PPTX
Vagrant & Docker
Joao Antonio Ferreira (Parana)
 
PPTX
Varying WordPress Development Environment WordCamp Columbus 2016
David Brattoli
 
PPTX
Version Control and Continuous Integration
Geff Henderson Chang
 
PPTX
Opscode Webinar: Managing Your VMware Infrastructure with Chef
Chef Software, Inc.
 
PDF
Vagrant for Effective DevOps Culture
Vaidik Kapoor
 
PDF
Building with Virtual Development Environments
Oscar Merida
 
PPTX
Varying wordpressdevelopmentenvironment wp-campus2016
David Brattoli
 
PDF
Chef, Vagrant and Friends
Ben McRae
 
PDF
Containing the world with Docker
Giuseppe Piccolo
 
PDF
Vagrant in 15 minutes
Anton Weiss
 
Powering Development and Testing Environments with Vagrant
Coen Jacobs
 
Improved development workflows using vagrant
Makis Asimidis
 
Vagrant For DevOps
Lalatendu Mohanty
 
Instant ColdFusion with Vagrant
ColdFusionConference
 
Making Developers Productive with Vagrant, VirtualBox, and Docker
John Rofrano
 
Instant ColdFusion with Vagrant
ColdFusionConference
 
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
OlinData
 
Using Vagrant, Puppet, Testing & Hadoop
Puppet
 
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
Walter Heck
 
Vagrant Binding JayDay 2013
Hendrik Ebbers
 
Varying WordPress Development Environment WordCamp Columbus 2016
David Brattoli
 
Version Control and Continuous Integration
Geff Henderson Chang
 
Opscode Webinar: Managing Your VMware Infrastructure with Chef
Chef Software, Inc.
 
Vagrant for Effective DevOps Culture
Vaidik Kapoor
 
Building with Virtual Development Environments
Oscar Merida
 
Varying wordpressdevelopmentenvironment wp-campus2016
David Brattoli
 
Chef, Vagrant and Friends
Ben McRae
 
Containing the world with Docker
Giuseppe Piccolo
 
Vagrant in 15 minutes
Anton Weiss
 
Ad

Recently uploaded (20)

PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PPTX
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
PDF
introduction to computer hardware and sofeware
chauhanshraddha2007
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
PPTX
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
introduction to computer hardware and sofeware
chauhanshraddha2007
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Researching The Best Chat SDK Providers in 2025
Ray Fields
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
Ad

Vagrant and Chef on FOSSASIA 2014

  • 1. Reproducible and Portable Work Environments with Vagrant and Chef
  • 2. About Me • 33 years old, almost married • From Karlsruhe, Germany • Studied Computer Science • Hobbies: guitar, climbing, cycling, travel, photography • Works in Phnom Penh for 3 months • Working with TYPO3
  • 4. Outline • Motivation • Introducing Vagrant & Chef • Vagrant „Hands-On“ • Advanced usage
  • 6. Motivation • Internal project • Estimated development time ~2 years • Approx. 15 developers • 2-day sprints, every second week • 4 developers per sprint
  • 7. Motivation Observations • Setting up dev environment takes > 1 day – More than ½ of the sprint time! • Developers spent too much time on setup • Always needed physical server for testing
  • 8. Solution: Vagrant Boxes Provisioning 2 virtual machines... • ...each with an extended LAMP stack*) • ...with 4 different projects takes less than 15 minutes *) including RabbitMQ, Solr, Git, Composer, tons of PHP modules...
  • 9. Technological Stack VirtualBox Free open source virtualization tool Chef Automation tool for Configuration Management Vagrant “Remote control” for VirtualBox
  • 11. What is Vagrant? • Building tool for portable work environments • Tool for distributing work environments • Written in Ruby • Open Source • Build upon well-established tools
  • 12. Vagrant Components • Vagrant Box • Vagrantfile • Provisioners • Providers
  • 13. Vagrant Boxes • Pre-installed base images • Used as base layer for all further provisioning • Many different boxes available online:
  • 14. The Vagrantfile • Marks root directory of Vagrant project • Describes what Vagrant box to use • Describes settings of box (e.g. network) • Triggers the provisioning of box (using Chef)
  • 15. Provisioners • Configures your Vagrant box by – Installing packages and software – Configuration and starting of services • Multiple provisioners available • Run once the box is booted
  • 16. Providers • Describe in which virtualization environment to provision your machines • Multiple providers available – VirtualBox – VMWare – Amazon AWS
  • 18. What is Chef? • Configuration Management automation tool • Written in Ruby • „Code your desired system state“ • Put system state into version control • Relies on a client / server architecture – Or use chef solo without a server
  • 22. Using chef-solo • mount cookbooks directory into your box config.vm.synced_folder "./chef", "/var/chef" config.vm.synced_folder "./home", "/var/ vagrant-home" • run chef-solo in your box config.vm.provision :shell do |s| s.inline = "sudo chef-solo -c /var/chef/ solo.rb -j /var/vagrant-home/config.json" end
  • 23. The solo.rb File • Define some paths: file_cache_path "/var/chef-cache" cookbook_path ["/var/chef/cookbooks”] data_bag_path "/var/chef/data_bags" role_path "/var/chef/roles"
  • 24. The config.json File • Define cookbook runlist: {"run_list" : ["recipe[cookbook_name]"]} • Further configuration in config.json overwrites defaults in cookbooks node['key1']['key2']
  • 25. Chef Provisioning Alternatives • Different ways for Chef provisioning – Mounting Cookbooks and use chef-solo – Copy Cookbooks into box and use chef-solo – Use Chef client in box and Chef server
  • 26. Overview 2 Chef Cookbooks /home/vagrant/chef mounted/copied into OR taken from chef server Vagrant Box 4 uses cookbooks triggers chef 3 remote controlls 1
  • 28. Provisioning Activity Provisioning Activity Provision Projects Configuration Management Booting Box Set up Box Chef, Git Vagrant, Chef Vagrant, VirtualBox Vagrant
  • 29. Set Up Box 1. Install VirtualBox & Vagrant 2. Add a box vagrant box add box_name http://box_url 1. Create a first Vagrantfile mkdir vagrant cd vagrant vagrant init
  • 30. Set up & Boot the Box 4. Use the box in your Vagrantfile Vagrant.configure("2") do |config| config.vm.box = "box_name" end 5. Boot your machine vagrant up 6. ssh into your machine vagrant ssh
  • 31. Versioning and Distribution • Remember: „Everything should be put into Version Control!“ • Vagrantfile can easily be put into any VCS • Distributing an environment is as easy as git clone [email protected]:my/vagrant.git cd vagrant vagrant up
  • 32. Daily Vagrant Usage • Start the box vagrant up • Stop the box Vagrant halt • Suspend the box vagrant suspend • Resume the box vagrant resume
  • 34. Multiple Boxes for Multiple Projects PROs - Easy to set up - Can have different systems in a box Vagrant Box Project 1 Vagrant Box Project 2 CONs - Have multiple Boxes running at the same time consumes resources Vagrant Box Project 3
  • 35. Multiple Projects in one Box PROs - Less ressources required Vagrant Box Project 1 Project 2 Project 3 CONs - No easy way to set up - Longer provisioning time - Bigger boxes
  • 36. Identical Copy of Server server is provisioned using Chef Client Chef Client Chef Server Chef Cookbooks mounted/copied into OR taken from chef server provisioned using same cookboks Identical Copy of Server as Vagrant Box
  • 37. Vagrant & Chef for CI / CD • Set up the whole deployment chain locally • Use tools like Jenkins inside your boxes • Provision the projects on Jenkins with Chef
  • 38. DevOps • Tools like Vagrant and Chef bring Developers and system operators closer together • Learn from each other • Use each other‘s tools for problem solving
  • 41. Summary • Vagrant is a great tool for portable boxes • Chef can help you manage your configuration • „Infrastructure as Code“ • Same environment on dev and live system • DevOps brings devs and admins together