SlideShare ist ein Scribd-Unternehmen logo
1 von 66
Downloaden Sie, um offline zu lesen
Powering Development
and Testing Environments
with Vagrant
Coen Jacobs / @CoenJacobs
at

WordCamp Norway 2014
!

#WCNorge
Coen Jacobs
@CoenJacobs
!

http://coenjacobs.me
!

WooThemes / WooCommerce
Powering Development
and Testing Environments
with Vagrant
Vagrant
Problem at hand
Get someone started
on your project
Let’s get you up and running…

•

“I just use MAMP, it’s brilliant”

•

“Tell me what you need and I’ll make a VM”

•

“My VPS runs a custom compiled LAMP setup”

•

“A server, what do I need that for?”
Bring order to chaos
Three common ways to do this
and all three are horrible…
1. Setup script
1. Setup script
•

Special maintenance!

•

Different to production!

•

Windows or Linux?
2. The über README
2. The über README
•

Extremely prone to user error!

•

Unlikely to keep it up to date!

•

Very time consuming!

•

Windows or Linux?
3. “Good luck, have fun”
3. “Good luck, have fun”
•

Extremely prone to user error!

•

Extremely time consuming!

•

Extremely frustrating!

•

Your developer will hate you…
Downsides
•

Not repeatable

•

Not verifiably correct

•

Not isolated

•

Difficult to understand

•

Slow
What is Vagrant?
“A tool for creating,
managing and distributing
portable development
environments”
- Mitchell Hashimoto (creator of Vagrant)
What is Vagrant?
•

Command line tool

•

Creates virtual machines

•

Handles networking and shared folders

•

Supports provisioning
What problems does it solve?
•

Repeatable & verifiably correct

•

Isolated

•

Understandable

•

As fast as possible
What problems does it solve?

•

Works on Mac, Windows and Linux

•

Works with VirtualBox, VMware and many more
How does it work then?
It’s magic, it really is…
“Vagrant reads a
Vagrantfile and builds a
virtual machine based on
a template called a box”
- Mitchell Hashimoto (creator of Vagrant)
Vagrantfile
“The primary function of the
Vagrantfile is to describe the type
of machine required for a project,
and how to configure and
provision these machines.”
http://docs.vagrantup.com/v2/vagrantfile/index.html
Vagrantfile
Vagrant::configure("2") do |config|!
! config.vm.box = "precise32"!
! config.vm.box_url = “http://.../precise32.box”!
! config.vm.hostname = "vagrant.localhost"!
!

! config.vm.network :private_network, ip: "192.168.99.100"!
end
Virtual machine
•

Isolated environment

•

Any operating system

•

Any installed software

•

Project specific configuration and versions
Boxes
“Boxes are the skeleton from
which Vagrant machines are
constructed. They are portable
files which can be used by others
on any platform that runs Vagrant
to bring up a working
environment.”
http://docs.vagrantup.com/v2/boxes.html
Boxes
•

Pre-installed OS

•

May contain pre-installed software

•

Custom boxes can be made
Provisioning
Provisioning
“Provisioners in Vagrant allow you
to automatically install software,
alter configurations, and more on
the machine as part of the vagrant
up process.”
http://docs.vagrantup.com/v2/provisioning/index.html
Provisioning
•

Shell

•

Ansible

•

Chef

•

Puppet

•

Docker

•

Salt
Providers
Enabling Vagrant to do its job
Providers
“While Vagrant ships out of the
box with support for VirtualBox,
Vagrant has the ability to manage
other types of machines as well.
This is done by using other
providers with Vagrant.”
https://docs.vagrantup.com/v2/providers/index.html
Providers
•

VirtualBox

•

VMware

•

AWS

•

Rackspace

•

Digital Ocean




and many more…
Change providers dynamically

vagrant up --provider=vmware_fusion
vagrant up --provider=digital_ocean
Does this really make a
developers life easier?
YES!
Old situation
•

Setup script

•

The über README file

•

“Good luck, have fun”




or any other manual way of configuring…
Vagrant is more like…
Get started with a Vagrant project

git clone repository.git folder!
cd folder!
vagrant up
What did Vagrant do
in the background?
The vagrant up command
•

Check if the box is already downloaded
•

If not, download the box

•

Start the VM

•

Set up synced folders

•

Set up networking

•

Start provisioning
Your new VM is ready
vagrant ssh
vagrant halt
vagrant destroy
Your new VM is ready
•

Some examples of what ‘ready’ means:
•

Nginx installed

•

PHP installed

•

MySQL installed

•

WordPress installed

•

Database imported

•

wp-config.php file set up
From development and
testing to production
Using Vagrant to its full potential
Vagrantfile in version control

•

Commit your Vagrantfile

•

Share it with all developers

•

Commit a change, all developers benefit
Share the provisioning
•

Provisioning files into version control as well

•

Production server shares the provisioning files
•

•

Use parameters/flags for differences

Change one, all environments will change
… and this is only
the beginning
Advanced use cases
Now we’re talking!
Plugin testing
•

Stable version

•

Development version

•

Combine those two on stable/dev WordPress

•

Four local websites per plugin
Multiple PHP version testing
•

One Vagrantfile

•

Multiple machines

•

Different PHP versions

•

One shared set of files

•

One database

http://wordpress.org/about/stats/
Integrate useful tools
•

WP-CLI

•

REDIS

•

Xdebug

•

Memcache

•

WebGrind

•

Your own dotfiles
All going a little too fast?
No worries
Vagrant has great documentation

•

http://docs.vagrantup.com/v2/

•

Plenty of examples

•

Great pointers to providers and provision resources

•

Vagrant is the latest trend
Varying Vagrant Vagrants
Varying Vagrant Vagrants
•

https://github.com/10up/varying-vagrant-vagrants

•

Ready to use Vagrant setup

•

Really easy to expand

•

Quickly launch new local development websites

•

Automatically installs: WP-CLI, Nginx, MySQL, PHPFPM, Memcache, Xdebug, Imagemagick, PHPunit,
Composer, NodeJS, Grunt, WebGrind and much,
much more, all on one Ubuntu 12.04 VM.
Let’s make the world a better place
for developers
!

Start using Vagrant
Questions?
Now, or come find me later!
!

@CoenJacobs
http://coenjacobs.me
Photo credits
1. http://www.flickr.com/photos/tinali778/2947963220/
2. http://www.flickr.com/photos/naan/2948047370/
3. http://www.flickr.com/photos/riebart/4466482623/
4. http://www.flickr.com/photos/55915190@N00/2302651444/
5. http://www.flickr.com/photos/l2f1/4895151918/
6. http://www.flickr.com/photos/basykes/490907537/
7. http://www.flickr.com/photos/whiskeytango/2098182380/
8. http://www.flickr.com/photos/chr1sp/5942681564/
9. http://www.flickr.com/photos/5wa/6109494115/
10.http://www.flickr.com/photos/msimdottv/4339697089/

Weitere ähnliche Inhalte

Was ist angesagt?

Vagrant-Binding JUG Dortmund
Vagrant-Binding JUG DortmundVagrant-Binding JUG Dortmund
Vagrant-Binding JUG Dortmund
Hendrik Ebbers
 
Automate your Development Environment with Vagrant & Chef
Automate your Development Environment with Vagrant & ChefAutomate your Development Environment with Vagrant & Chef
Automate your Development Environment with Vagrant & Chef
Michael Lihs
 
Open source and cross platform .net
Open source and cross platform .netOpen source and cross platform .net
Open source and cross platform .net
Ibon Landa
 

Was ist angesagt? (20)

Vagrant-Binding JUG Dortmund
Vagrant-Binding JUG DortmundVagrant-Binding JUG Dortmund
Vagrant-Binding JUG Dortmund
 
Docker
DockerDocker
Docker
 
How To Set a Vagrant Development System
How To Set a Vagrant Development SystemHow To Set a Vagrant Development System
How To Set a Vagrant Development System
 
Vagrant + Ansible + Docker
Vagrant + Ansible + DockerVagrant + Ansible + Docker
Vagrant + Ansible + Docker
 
Building with Virtual Development Environments
Building with Virtual Development EnvironmentsBuilding with Virtual Development Environments
Building with Virtual Development Environments
 
Automate your Development Environment with Vagrant & Chef
Automate your Development Environment with Vagrant & ChefAutomate your Development Environment with Vagrant & Chef
Automate your Development Environment with Vagrant & Chef
 
Using Vagrant
Using VagrantUsing Vagrant
Using Vagrant
 
DevOps Camp 2017 NYC Local Development using Vagrant by Anthony Alvarez
DevOps Camp 2017 NYC Local Development using Vagrant by Anthony AlvarezDevOps Camp 2017 NYC Local Development using Vagrant by Anthony Alvarez
DevOps Camp 2017 NYC Local Development using Vagrant by Anthony Alvarez
 
Codecoon - A technical Case Study
Codecoon - A technical Case StudyCodecoon - A technical Case Study
Codecoon - A technical Case Study
 
Vagrant and docker
Vagrant and dockerVagrant and docker
Vagrant and docker
 
PHP Deployment With SVN
PHP Deployment With SVNPHP Deployment With SVN
PHP Deployment With SVN
 
An Introduction to Vagrant and Docker
An Introduction to Vagrant and DockerAn Introduction to Vagrant and Docker
An Introduction to Vagrant and Docker
 
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
 
Docker zero
Docker zeroDocker zero
Docker zero
 
Open source and cross platform .net
Open source and cross platform .netOpen source and cross platform .net
Open source and cross platform .net
 
Ansible E2E Testing
Ansible E2E TestingAnsible E2E Testing
Ansible E2E Testing
 
Test-Driven Infrastructure with Chef
Test-Driven Infrastructure with ChefTest-Driven Infrastructure with Chef
Test-Driven Infrastructure with Chef
 
Docker Practical Use Cases
Docker Practical Use CasesDocker Practical Use Cases
Docker Practical Use Cases
 
Managing Large Selenium Grid
Managing Large Selenium Grid�Managing Large Selenium Grid�
Managing Large Selenium Grid
 
Delivery Pipeline for Windows Machines
Delivery Pipeline for Windows MachinesDelivery Pipeline for Windows Machines
Delivery Pipeline for Windows Machines
 

Ähnlich wie Powering Development and Testing Environments with Vagrant

Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013
Hendrik Ebbers
 

Ähnlich wie Powering Development and Testing Environments with Vagrant (20)

Varying wordpressdevelopmentenvironment wp-campus2016
Varying wordpressdevelopmentenvironment wp-campus2016Varying wordpressdevelopmentenvironment wp-campus2016
Varying wordpressdevelopmentenvironment wp-campus2016
 
Varying WordPress Development Environment WordCamp Columbus 2016
Varying WordPress Development Environment WordCamp Columbus 2016Varying WordPress Development Environment WordCamp Columbus 2016
Varying WordPress Development Environment WordCamp Columbus 2016
 
Making Developers Productive with Vagrant, VirtualBox, and Docker
Making Developers Productive with Vagrant, VirtualBox, and DockerMaking Developers Productive with Vagrant, VirtualBox, and Docker
Making Developers Productive with Vagrant, VirtualBox, and Docker
 
Building with Virtual Development Environments
Building with Virtual Development EnvironmentsBuilding with Virtual Development Environments
Building with Virtual Development Environments
 
Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013Vagrant Binding JayDay 2013
Vagrant Binding JayDay 2013
 
Varying WordPress Development Environment WordCamp Cincinnati 2016
Varying WordPress Development Environment WordCamp Cincinnati 2016Varying WordPress Development Environment WordCamp Cincinnati 2016
Varying WordPress Development Environment WordCamp Cincinnati 2016
 
WordPress Development Environments
WordPress Development EnvironmentsWordPress Development Environments
WordPress Development Environments
 
Vagrant for local and team WordPress Development
Vagrant for local and team WordPress DevelopmentVagrant for local and team WordPress Development
Vagrant for local and team WordPress Development
 
Instant ColdFusion with Vagrant
Instant ColdFusion with VagrantInstant ColdFusion with Vagrant
Instant ColdFusion with Vagrant
 
Instant ColdFusion with Vagrant
Instant ColdFusion with VagrantInstant ColdFusion with Vagrant
Instant ColdFusion with Vagrant
 
Virtualization for Developers
Virtualization for DevelopersVirtualization for Developers
Virtualization for Developers
 
Take Home Your Very Own Free Vagrant CFML Dev Environment
Take Home Your Very Own Free Vagrant CFML Dev Environment Take Home Your Very Own Free Vagrant CFML Dev Environment
Take Home Your Very Own Free Vagrant CFML Dev Environment
 
Take home your very own free Vagrant CFML Dev Environment - Presented at dev....
Take home your very own free Vagrant CFML Dev Environment - Presented at dev....Take home your very own free Vagrant CFML Dev Environment - Presented at dev....
Take home your very own free Vagrant CFML Dev Environment - Presented at dev....
 
Vagrant for Effective DevOps Culture
Vagrant for Effective DevOps CultureVagrant for Effective DevOps Culture
Vagrant for Effective DevOps Culture
 
Using Vagrant, Puppet, Testing & Hadoop
Using Vagrant, Puppet, Testing & HadoopUsing Vagrant, Puppet, Testing & Hadoop
Using Vagrant, Puppet, Testing & Hadoop
 
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & HadoopPuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
 
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & HadoopPuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
PuppetCamp SEA 1 - Using Vagrant, Puppet, Testing & Hadoop
 
Vagrant Plugin development
Vagrant Plugin developmentVagrant Plugin development
Vagrant Plugin development
 
Containing the world with Docker
Containing the world with DockerContaining the world with Docker
Containing the world with Docker
 
Vagrant to-aws-flow
Vagrant to-aws-flowVagrant to-aws-flow
Vagrant to-aws-flow
 

Mehr von Coen Jacobs (8)

WooCommerce 2.0 and beyond
WooCommerce 2.0 and beyondWooCommerce 2.0 and beyond
WooCommerce 2.0 and beyond
 
State of WordPress & eCommerce in 2012
State of WordPress & eCommerce in 2012State of WordPress & eCommerce in 2012
State of WordPress & eCommerce in 2012
 
WordPress Custom Post Types
WordPress Custom Post TypesWordPress Custom Post Types
WordPress Custom Post Types
 
Versiebeheer
VersiebeheerVersiebeheer
Versiebeheer
 
WordPress core contributions
WordPress core contributionsWordPress core contributions
WordPress core contributions
 
WordPress Meetup Eindhoven 2011
WordPress Meetup Eindhoven 2011WordPress Meetup Eindhoven 2011
WordPress Meetup Eindhoven 2011
 
WordCamp NL 2010: Plugin ontwikkeling
WordCamp NL 2010: Plugin ontwikkelingWordCamp NL 2010: Plugin ontwikkeling
WordCamp NL 2010: Plugin ontwikkeling
 
Ontwikkeling Wordpress Plugins
Ontwikkeling Wordpress PluginsOntwikkeling Wordpress Plugins
Ontwikkeling Wordpress Plugins
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Powering Development and Testing Environments with Vagrant