SlideShare a Scribd company logo
1 of 27
Download to read offline
Vagrant
HOW TO SET A VAGRANT DEVELOPMENT SYSTEM
Paul Bearne @pbearne
Sr. Web Developer @ metronews.ca
Plugin author of Author Avatars List ( http://wordpress.org/plugins/author-avatars/ )
WP Site Verification tool ( http://wordpress.org/plugins/wp-site-verification-tool/ )
Where do you develop your sites?
Why use Vagrant?
No need to have a web server installed.
You can match the configuration of production server.
Project isolation - one vagrant setup per project.
Version isolation - more than one version of WordPress.
Works the same on PC/Mac or Linux.
Vagrant
“Vagrant is a tool for building complete
development environments. With an easy-to-
use workflow and focus on automation, Vagrant
lowers development environment setup
time, increases development/production
parity, and makes the 'works on my machine'
excuse a relic of the past.”
http://www.vagrantup.com/about.html
Host Computer
Virtualbox
Shared Folder/usr/html/site C:/user/document/code
Install
Vagrant: http://downloads.vagrantup.com/
VirtualBox: https://www.virtualbox.org/
Plus a configuration file
Note: Sometimes problems with latest version VirtualBox on windows
THE BASIC COMMAND LINE
$ vagrant init precise32 http://files.vagrantup.com/precise32.box
$ vagrant up
$ vagrant destroy
Scripting
AUTOMATE THE CONFIG
DEMO
JUST RUN IT
Config
THE VAGRANTFILE FROM VARYING-VAGRANT-VAGRANTS
# -*- mode: ruby -*-
# vi: set ft=ruby :
dir = Dir.pwd
vagrant_dir = File.expand_path(File.dirname(__FILE__))
Vagrant.configure("2") do |config|
# Configurations from 1.0.x can be placed in Vagrant 1.1.x specs like the following.
config.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--memory", 512]
end
# Forward Agent
#
# Enable agent forwarding on vagrant ssh commands. This allows you to use identities
# established on the host machine inside the guest. See the manual for ssh-add
config.ssh.forward_agent = true
# Default Ubuntu Box
#
# This box is provided by Vagrant at vagrantup.com and is a nicely sized (290MB)
# box containing the Ubuntu 12.0.4 Precise 32 bit release. Once this box is downloaded
# to your host computer, it is cached for future use under the specified box name.
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.hostname = "vvv"
# Local Machine Hosts
#
# If the Vagrant plugin hostsupdater (https://github.com/cogitatio/vagrant-hostsupdater) is
# installed, the following will automatically configure your local machine's hosts file to
# be aware of the domains specified below. Watch the provisioning script as you may be
# required to enter a password for Vagrant to access your hosts file.
#
# By default, we'll include the domains setup by VVV. A short term goal is to read these in
# from a local config file so that they can be more dynamic to your setup.
if defined? VagrantPlugins::HostsUpdater
config.hostsupdater.aliases = [
"local.wordpress.dev",
"local.wordpress-trunk.dev",
"src.wordpress-develop.dev",
"build.wordpress-develop.dev"
]
end
# Default Box IP Address
#
# This is the IP address that your host will communicate to the guest through. In the
# case of the default `192.168.50.4` that we've provided, Virtualbox will setup another
# network adapter on your host machine with the IP `192.168.50.1` as a gateway.
#
# If you are already on a network using the 192.168.50.x subnet, this should be changed.
# If you are running more than one VM through Virtualbox, different subnets should be used
# for those as well. This includes other Vagrant boxes.
config.vm.network :private_network, ip: "192.168.50.4"
# /srv/database/
#
# If a database directory exists in the same directory as your Vagrantfile,
# a mapped directory inside the VM will be created that contains these files.
# This directory is used to maintain default database scripts as well as backed
# up mysql dumps (SQL files) that are to be imported automatically on vagrant up
config.vm.synced_folder "database/", "/srv/database"
config.vm.synced_folder "database/data/", "/var/lib/mysql", :mount_options => [ "dmode=777", "fmode=777" ]
# /srv/config/
#
# If a server-conf directory exists in the same directory as your Vagrantfile,
# a mapped directory inside the VM will be created that contains these files.
# This directory is currently used to maintain various config files for php and
# nginx as well as any pre-existing database files.
config.vm.synced_folder "config/", "/srv/config"
# /srv/config/nginx-config/sites/
#
# If a sites directory exists inside the above server-conf directory, it will be
# added as a mapped directory inside the VM as well. This is used to maintain specific
# site configuration files for nginx
config.vm.synced_folder "config/nginx-config/sites/", "/etc/nginx/custom-sites"
# /srv/www/
#
# If a www directory exists in the same directory as your Vagrantfile, a mapped directory
# inside the VM will be created that acts as the default location for nginx sites. Put all
# of your project files here that you want to access through the web server
config.vm.synced_folder "www/", "/srv/www/", :owner => "www-data", :mount_options => [ "dmode=775", "fmode=774" ]
# Provisioning
#
# Process one or more provisioning scripts depending on the existence of custom files.
#
# provison-pre.sh acts as a pre-hook to our default provisioning script. Anything that
# should run before the shell commands laid out in provision.sh (or your provision-custom.sh
# file) should go in this script. If it does not exist, no extra provisioning will run.
if File.exists?(File.join(vagrant_dir,'provision','provision-pre.sh')) then
config.vm.provision :shell, :path => File.join( "provision", "provision-pre.sh" )
end
# provision.sh or provision-custom.sh
#
# By default, Vagrantfile is set to use the provision.sh bash script located in the
# provision directory. If it is detected that a provision-custom.sh script has been
# created, that is run as a replacement. This is an opportunity to replace the entirety
# of the provisioning provided by default.
if File.exists?(File.join(vagrant_dir,'provision','provision-custom.sh')) then
config.vm.provision :shell, :path => File.join( "provision", "provision-custom.sh" )
else
config.vm.provision :shell, :path => File.join( "provision", "provision.sh" )
end
# provision-post.sh acts as a post-hook to the default provisioning. Anything that should
# run after the shell commands laid out in provision.sh or provision-custom.sh should be
# put into this file. This provides a good opportunity to install additional packages
# without having to replace the entire default provisioning script.
if File.exists?(File.join(vagrant_dir,'provision','provision-post.sh')) then
config.vm.provision :shell, :path => File.join( "provision", "provision-post.sh" )
end
end
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant::Config.run do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :hostonly, "33.33.33.10"
config.vm.share_folder("vagrant-root", "/vagrant", ".", :nfs => true)
config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests"
puppet.module_path = "puppet/modules"
puppet.options = ['--verbose']
end
end
“:nfs => true” needed for Mac
Source: https://github.com/MikeRogers0/vagrant-nginx-wordpress-puppet/blob/master/Vagrantfile
Vagrant Commands
Vagrant up
◦ Start
Vagrant Suspend / resume
◦ pause/play
Vagrant halt
◦ turn off
Vagrant destroy
◦ wipeout
Vagrant status
◦ is it up
Vagrant int
◦ create empty config file
Vagrant box
◦ manage
C:WindowsSystem32driversetchosts
192.168.50.4 local.wordpress.dev local.wordpress-trunk.dev src.wordpress-develop.dev build.wordpress-develop.dev
Windows 8 - need to unprotect host in window defender
sudo sh -c 'echo "192.168.50.4 local.wordpress.dev local.wordpress-trunk.dev src.wordpress-develop.dev
build.wordpress-develop.dev" >>/private/etc/hosts'
Notes and links
Use: shell or bat to run vagrant
◦ cd varying-vagrant-vagrants
◦ start cmd.exe /k "vagrant up --no-provision“
Use different config files per site
http://www.vagrantup.com/
https://www.virtualbox.org/wiki/Downloads
Other tools
http://www.packer.io/ a tool for creating identical machine images for multiple platforms from
a single source configuration including vagrant images.
http://livereload.com/ to auto refresh web page on save.
http://puppetlabs.com/ home of puppet - http://forge.puppetlabs.com/apowers/wordpress
Questions?
We're hiring...
HR@METRONEWS.CA
Slides@ http://www.slideshare.net/pbearne
Email: pbearne@gmail.com

More Related Content

What's hot

Multi-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and moreMulti-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and moreChef Software, Inc.
 
It Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software DevelopmentIt Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software DevelopmentCarlos Perez
 
Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Nicolas Poggi
 
An Introduction to Vagrant and Docker
An Introduction to Vagrant and DockerAn Introduction to Vagrant and Docker
An Introduction to Vagrant and DockerScott Lowe
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in developmentAdam Culp
 
Vagrant + Ansible + Docker
Vagrant + Ansible + DockerVagrant + Ansible + Docker
Vagrant + Ansible + DockerVijay Selvaraj
 
Automated Infrastructure and Application Management
Automated Infrastructure and Application ManagementAutomated Infrastructure and Application Management
Automated Infrastructure and Application ManagementClark Everetts
 
Create your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and PackerCreate your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and Packerfrastel
 
Building (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with PackerBuilding (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with PackerCristovao G. Verstraeten
 
Vagrant 101 Workshop
Vagrant 101 WorkshopVagrant 101 Workshop
Vagrant 101 WorkshopLiora Milbaum
 
Continuous Integration and Kamailio
Continuous Integration and KamailioContinuous Integration and Kamailio
Continuous Integration and KamailioGiacomo Vacca
 
Continuous delivery with jenkins, docker and exoscale
Continuous delivery with jenkins, docker and exoscaleContinuous delivery with jenkins, docker and exoscale
Continuous delivery with jenkins, docker and exoscaleJulia Mateo
 
VCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environmentVCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environmentTakayuki Miyauchi
 
Node.js, Vagrant, Chef, and Mathoid @ Benetech
Node.js, Vagrant, Chef, and Mathoid @ BenetechNode.js, Vagrant, Chef, and Mathoid @ Benetech
Node.js, Vagrant, Chef, and Mathoid @ BenetechChristopher Bumgardner
 
Package Management on Windows with Chocolatey
Package Management on Windows with ChocolateyPackage Management on Windows with Chocolatey
Package Management on Windows with ChocolateyPuppet
 

What's hot (20)

Multi-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and moreMulti-provider Vagrant and Chef: AWS, VMware, and more
Multi-provider Vagrant and Chef: AWS, VMware, and more
 
It Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software DevelopmentIt Works On My Machine: Vagrant for Software Development
It Works On My Machine: Vagrant for Software Development
 
Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]Vagrant + Docker provider [+Puppet]
Vagrant + Docker provider [+Puppet]
 
Vagrant presentation
Vagrant presentationVagrant presentation
Vagrant presentation
 
Intro to vagrant
Intro to vagrantIntro to vagrant
Intro to vagrant
 
Introduction to Vagrant
Introduction to VagrantIntroduction to Vagrant
Introduction to Vagrant
 
Vagrant to-aws-flow
Vagrant to-aws-flowVagrant to-aws-flow
Vagrant to-aws-flow
 
An Introduction to Vagrant and Docker
An Introduction to Vagrant and DockerAn Introduction to Vagrant and Docker
An Introduction to Vagrant and Docker
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in development
 
Vagrant + Ansible + Docker
Vagrant + Ansible + DockerVagrant + Ansible + Docker
Vagrant + Ansible + Docker
 
Automated Infrastructure and Application Management
Automated Infrastructure and Application ManagementAutomated Infrastructure and Application Management
Automated Infrastructure and Application Management
 
Vagrant
Vagrant Vagrant
Vagrant
 
Create your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and PackerCreate your very own Development Environment with Vagrant and Packer
Create your very own Development Environment with Vagrant and Packer
 
Building (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with PackerBuilding (localized) Vagrant boxes with Packer
Building (localized) Vagrant boxes with Packer
 
Vagrant 101 Workshop
Vagrant 101 WorkshopVagrant 101 Workshop
Vagrant 101 Workshop
 
Continuous Integration and Kamailio
Continuous Integration and KamailioContinuous Integration and Kamailio
Continuous Integration and Kamailio
 
Continuous delivery with jenkins, docker and exoscale
Continuous delivery with jenkins, docker and exoscaleContinuous delivery with jenkins, docker and exoscale
Continuous delivery with jenkins, docker and exoscale
 
VCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environmentVCCW - Vagrant based WordPress development environment
VCCW - Vagrant based WordPress development environment
 
Node.js, Vagrant, Chef, and Mathoid @ Benetech
Node.js, Vagrant, Chef, and Mathoid @ BenetechNode.js, Vagrant, Chef, and Mathoid @ Benetech
Node.js, Vagrant, Chef, and Mathoid @ Benetech
 
Package Management on Windows with Chocolatey
Package Management on Windows with ChocolateyPackage Management on Windows with Chocolatey
Package Management on Windows with Chocolatey
 

Similar to HOW TO SET A VAGRANT DEVELOPMENT SYSTEM

Open stack and_vagrant-os-meetup-2015
Open stack and_vagrant-os-meetup-2015Open stack and_vagrant-os-meetup-2015
Open stack and_vagrant-os-meetup-2015yfauser
 
Vagrant introduction for Developers
Vagrant introduction for DevelopersVagrant introduction for Developers
Vagrant introduction for DevelopersAntons Kranga
 
Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp HamiltonPaul Bearne
 
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Carlos Sanchez
 
Vagrant - Version control your dev environment
Vagrant - Version control your dev environmentVagrant - Version control your dev environment
Vagrant - Version control your dev environmentbocribbz
 
Professional deployment
Professional deploymentProfessional deployment
Professional deploymentIvelina Dimova
 
Create Development and Production Environments with Vagrant
Create Development and Production Environments with VagrantCreate Development and Production Environments with Vagrant
Create Development and Production Environments with VagrantBrian Hogan
 
DevOps Hackathon - Session 1: Vagrant
DevOps Hackathon - Session 1: VagrantDevOps Hackathon - Session 1: Vagrant
DevOps Hackathon - Session 1: VagrantAntons Kranga
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012Carlos Sanchez
 
Vagrant for real
Vagrant for realVagrant for real
Vagrant for realCodemotion
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012Carlos Sanchez
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierCarlos Sanchez
 
Running Node.js in Production using Passenger
Running Node.js in Production using PassengerRunning Node.js in Production using Passenger
Running Node.js in Production using Passengerdavidchubbs
 
Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Carlos Sanchez
 
WordPress Development Environments
WordPress Development Environments WordPress Development Environments
WordPress Development Environments Ohad Raz
 
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Carlos Sanchez
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Michele Orselli
 

Similar to HOW TO SET A VAGRANT DEVELOPMENT SYSTEM (20)

Open stack and_vagrant-os-meetup-2015
Open stack and_vagrant-os-meetup-2015Open stack and_vagrant-os-meetup-2015
Open stack and_vagrant-os-meetup-2015
 
Vagrant introduction for Developers
Vagrant introduction for DevelopersVagrant introduction for Developers
Vagrant introduction for Developers
 
Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp Hamilton
 
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
Continuous Delivery with Maven, Puppet and Tomcat - ApacheCon NA 2013
 
Vagrant - Version control your dev environment
Vagrant - Version control your dev environmentVagrant - Version control your dev environment
Vagrant - Version control your dev environment
 
Professional deployment
Professional deploymentProfessional deployment
Professional deployment
 
Create Development and Production Environments with Vagrant
Create Development and Production Environments with VagrantCreate Development and Production Environments with Vagrant
Create Development and Production Environments with Vagrant
 
DevOps Hackathon - Session 1: Vagrant
DevOps Hackathon - Session 1: VagrantDevOps Hackathon - Session 1: Vagrant
DevOps Hackathon - Session 1: Vagrant
 
From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012From Dev to DevOps - Codemotion ES 2012
From Dev to DevOps - Codemotion ES 2012
 
Vagrant for real
Vagrant for realVagrant for real
Vagrant for real
 
From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012From Dev to DevOps - FOSDEM 2012
From Dev to DevOps - FOSDEM 2012
 
Continuous Delivery: The Next Frontier
Continuous Delivery: The Next FrontierContinuous Delivery: The Next Frontier
Continuous Delivery: The Next Frontier
 
Running Node.js in Production using Passenger
Running Node.js in Production using PassengerRunning Node.js in Production using Passenger
Running Node.js in Production using Passenger
 
Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012Puppet for Java developers - JavaZone NO 2012
Puppet for Java developers - JavaZone NO 2012
 
WordPress Development Environments
WordPress Development Environments WordPress Development Environments
WordPress Development Environments
 
Installing lemp with ssl and varnish on Debian 9
Installing lemp with ssl and varnish on Debian 9Installing lemp with ssl and varnish on Debian 9
Installing lemp with ssl and varnish on Debian 9
 
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
Infrastructure testing with Jenkins, Puppet and Vagrant - Agile Testing Days ...
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))
 
Lumen
LumenLumen
Lumen
 
Apache ppt
Apache pptApache ppt
Apache ppt
 

More from Paul Bearne

Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919Paul Bearne
 
Using WordPress as your application stack
Using WordPress as your application stackUsing WordPress as your application stack
Using WordPress as your application stackPaul Bearne
 
Unit tests with vagrant
Unit tests with vagrantUnit tests with vagrant
Unit tests with vagrantPaul Bearne
 
WordPress overloading Gravityforms using hooks, filters and extending classes
WordPress overloading Gravityforms using hooks, filters and extending classes WordPress overloading Gravityforms using hooks, filters and extending classes
WordPress overloading Gravityforms using hooks, filters and extending classes Paul Bearne
 
HirshHorn theme: how I created it
HirshHorn theme: how I created itHirshHorn theme: how I created it
HirshHorn theme: how I created itPaul Bearne
 
WortdPress Child themes: Why and How
WortdPress Child themes: Why and HowWortdPress Child themes: Why and How
WortdPress Child themes: Why and HowPaul Bearne
 
Author Avatars List demo slides
Author Avatars List demo slidesAuthor Avatars List demo slides
Author Avatars List demo slidesPaul Bearne
 

More from Paul Bearne (9)

Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919
 
WP json api
WP json apiWP json api
WP json api
 
Using WordPress as your application stack
Using WordPress as your application stackUsing WordPress as your application stack
Using WordPress as your application stack
 
Unit tests with vagrant
Unit tests with vagrantUnit tests with vagrant
Unit tests with vagrant
 
WordPress overloading Gravityforms using hooks, filters and extending classes
WordPress overloading Gravityforms using hooks, filters and extending classes WordPress overloading Gravityforms using hooks, filters and extending classes
WordPress overloading Gravityforms using hooks, filters and extending classes
 
HirshHorn theme: how I created it
HirshHorn theme: how I created itHirshHorn theme: how I created it
HirshHorn theme: how I created it
 
WortdPress Child themes: Why and How
WortdPress Child themes: Why and HowWortdPress Child themes: Why and How
WortdPress Child themes: Why and How
 
Daughter Themes
Daughter ThemesDaughter Themes
Daughter Themes
 
Author Avatars List demo slides
Author Avatars List demo slidesAuthor Avatars List demo slides
Author Avatars List demo slides
 

Recently uploaded

Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...BookNet Canada
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsYoss Cohen
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 

Recently uploaded (20)

Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platforms
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 

HOW TO SET A VAGRANT DEVELOPMENT SYSTEM

  • 1. Vagrant HOW TO SET A VAGRANT DEVELOPMENT SYSTEM
  • 2. Paul Bearne @pbearne Sr. Web Developer @ metronews.ca Plugin author of Author Avatars List ( http://wordpress.org/plugins/author-avatars/ ) WP Site Verification tool ( http://wordpress.org/plugins/wp-site-verification-tool/ )
  • 3. Where do you develop your sites?
  • 4. Why use Vagrant? No need to have a web server installed. You can match the configuration of production server. Project isolation - one vagrant setup per project. Version isolation - more than one version of WordPress. Works the same on PC/Mac or Linux.
  • 5. Vagrant “Vagrant is a tool for building complete development environments. With an easy-to- use workflow and focus on automation, Vagrant lowers development environment setup time, increases development/production parity, and makes the 'works on my machine' excuse a relic of the past.” http://www.vagrantup.com/about.html
  • 7. Install Vagrant: http://downloads.vagrantup.com/ VirtualBox: https://www.virtualbox.org/ Plus a configuration file Note: Sometimes problems with latest version VirtualBox on windows
  • 8. THE BASIC COMMAND LINE $ vagrant init precise32 http://files.vagrantup.com/precise32.box $ vagrant up $ vagrant destroy
  • 10.
  • 11.
  • 13. Config THE VAGRANTFILE FROM VARYING-VAGRANT-VAGRANTS
  • 14. # -*- mode: ruby -*- # vi: set ft=ruby : dir = Dir.pwd vagrant_dir = File.expand_path(File.dirname(__FILE__)) Vagrant.configure("2") do |config| # Configurations from 1.0.x can be placed in Vagrant 1.1.x specs like the following. config.vm.provider :virtualbox do |v| v.customize ["modifyvm", :id, "--memory", 512] end # Forward Agent # # Enable agent forwarding on vagrant ssh commands. This allows you to use identities # established on the host machine inside the guest. See the manual for ssh-add config.ssh.forward_agent = true
  • 15. # Default Ubuntu Box # # This box is provided by Vagrant at vagrantup.com and is a nicely sized (290MB) # box containing the Ubuntu 12.0.4 Precise 32 bit release. Once this box is downloaded # to your host computer, it is cached for future use under the specified box name. config.vm.box = "precise32" config.vm.box_url = "http://files.vagrantup.com/precise32.box" config.vm.hostname = "vvv"
  • 16. # Local Machine Hosts # # If the Vagrant plugin hostsupdater (https://github.com/cogitatio/vagrant-hostsupdater) is # installed, the following will automatically configure your local machine's hosts file to # be aware of the domains specified below. Watch the provisioning script as you may be # required to enter a password for Vagrant to access your hosts file. # # By default, we'll include the domains setup by VVV. A short term goal is to read these in # from a local config file so that they can be more dynamic to your setup. if defined? VagrantPlugins::HostsUpdater config.hostsupdater.aliases = [ "local.wordpress.dev", "local.wordpress-trunk.dev", "src.wordpress-develop.dev", "build.wordpress-develop.dev" ] end
  • 17. # Default Box IP Address # # This is the IP address that your host will communicate to the guest through. In the # case of the default `192.168.50.4` that we've provided, Virtualbox will setup another # network adapter on your host machine with the IP `192.168.50.1` as a gateway. # # If you are already on a network using the 192.168.50.x subnet, this should be changed. # If you are running more than one VM through Virtualbox, different subnets should be used # for those as well. This includes other Vagrant boxes. config.vm.network :private_network, ip: "192.168.50.4"
  • 18. # /srv/database/ # # If a database directory exists in the same directory as your Vagrantfile, # a mapped directory inside the VM will be created that contains these files. # This directory is used to maintain default database scripts as well as backed # up mysql dumps (SQL files) that are to be imported automatically on vagrant up config.vm.synced_folder "database/", "/srv/database" config.vm.synced_folder "database/data/", "/var/lib/mysql", :mount_options => [ "dmode=777", "fmode=777" ] # /srv/config/ # # If a server-conf directory exists in the same directory as your Vagrantfile, # a mapped directory inside the VM will be created that contains these files. # This directory is currently used to maintain various config files for php and # nginx as well as any pre-existing database files. config.vm.synced_folder "config/", "/srv/config" # /srv/config/nginx-config/sites/ # # If a sites directory exists inside the above server-conf directory, it will be # added as a mapped directory inside the VM as well. This is used to maintain specific # site configuration files for nginx config.vm.synced_folder "config/nginx-config/sites/", "/etc/nginx/custom-sites" # /srv/www/ # # If a www directory exists in the same directory as your Vagrantfile, a mapped directory # inside the VM will be created that acts as the default location for nginx sites. Put all # of your project files here that you want to access through the web server config.vm.synced_folder "www/", "/srv/www/", :owner => "www-data", :mount_options => [ "dmode=775", "fmode=774" ]
  • 19. # Provisioning # # Process one or more provisioning scripts depending on the existence of custom files. # # provison-pre.sh acts as a pre-hook to our default provisioning script. Anything that # should run before the shell commands laid out in provision.sh (or your provision-custom.sh # file) should go in this script. If it does not exist, no extra provisioning will run. if File.exists?(File.join(vagrant_dir,'provision','provision-pre.sh')) then config.vm.provision :shell, :path => File.join( "provision", "provision-pre.sh" ) end # provision.sh or provision-custom.sh # # By default, Vagrantfile is set to use the provision.sh bash script located in the # provision directory. If it is detected that a provision-custom.sh script has been # created, that is run as a replacement. This is an opportunity to replace the entirety # of the provisioning provided by default. if File.exists?(File.join(vagrant_dir,'provision','provision-custom.sh')) then config.vm.provision :shell, :path => File.join( "provision", "provision-custom.sh" ) else config.vm.provision :shell, :path => File.join( "provision", "provision.sh" ) end # provision-post.sh acts as a post-hook to the default provisioning. Anything that should # run after the shell commands laid out in provision.sh or provision-custom.sh should be # put into this file. This provides a good opportunity to install additional packages # without having to replace the entire default provisioning script. if File.exists?(File.join(vagrant_dir,'provision','provision-post.sh')) then config.vm.provision :shell, :path => File.join( "provision", "provision-post.sh" ) end end
  • 20. # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant::Config.run do |config| config.vm.box = "precise64" config.vm.box_url = "http://files.vagrantup.com/precise64.box" config.vm.network :hostonly, "33.33.33.10" config.vm.share_folder("vagrant-root", "/vagrant", ".", :nfs => true) config.vm.provision :puppet do |puppet| puppet.manifests_path = "puppet/manifests" puppet.module_path = "puppet/modules" puppet.options = ['--verbose'] end end “:nfs => true” needed for Mac Source: https://github.com/MikeRogers0/vagrant-nginx-wordpress-puppet/blob/master/Vagrantfile
  • 21. Vagrant Commands Vagrant up ◦ Start Vagrant Suspend / resume ◦ pause/play Vagrant halt ◦ turn off Vagrant destroy ◦ wipeout Vagrant status ◦ is it up Vagrant int ◦ create empty config file Vagrant box ◦ manage
  • 22. C:WindowsSystem32driversetchosts 192.168.50.4 local.wordpress.dev local.wordpress-trunk.dev src.wordpress-develop.dev build.wordpress-develop.dev Windows 8 - need to unprotect host in window defender sudo sh -c 'echo "192.168.50.4 local.wordpress.dev local.wordpress-trunk.dev src.wordpress-develop.dev build.wordpress-develop.dev" >>/private/etc/hosts'
  • 23. Notes and links Use: shell or bat to run vagrant ◦ cd varying-vagrant-vagrants ◦ start cmd.exe /k "vagrant up --no-provision“ Use different config files per site http://www.vagrantup.com/ https://www.virtualbox.org/wiki/Downloads
  • 24. Other tools http://www.packer.io/ a tool for creating identical machine images for multiple platforms from a single source configuration including vagrant images. http://livereload.com/ to auto refresh web page on save. http://puppetlabs.com/ home of puppet - http://forge.puppetlabs.com/apowers/wordpress