vagrant up-and-running
DESCRIPTION
Come learn about Vagrant - a tool to create and configure lightweight, reproducible, and portable development environments plus provisioning options to automate the environment configuration. Vagrant lowers development environment setup time, increases development/production parity, and makes the "works on my machine" excuse a relic of the past.TRANSCRIPT
![Page 1: Vagrant up-and-running](https://reader034.vdocuments.net/reader034/viewer/2022052208/55534e8ab4c9059e688b4ed5/html5/thumbnails/1.jpg)
Vagrant Up & Running
+ Basic Provisioning
To follow along, clone: https://github.com/svpernova09/Vagrant-Up-and-Running-Talk
Give feedback on this talk: https://joind.in/user/view/22057
![Page 2: Vagrant up-and-running](https://reader034.vdocuments.net/reader034/viewer/2022052208/55534e8ab4c9059e688b4ed5/html5/thumbnails/2.jpg)
Joe Ferguson - [email protected]
Professionally● Web Developer at RocketFuel● PHP / LAMP Focused
Semi Professional● Co-Organizer for MemphisPHP.org● MidsouthMakers - Hackerspace Leader● HACKmemphis.com Organizer
Who is this guy?
![Page 3: Vagrant up-and-running](https://reader034.vdocuments.net/reader034/viewer/2022052208/55534e8ab4c9059e688b4ed5/html5/thumbnails/3.jpg)
● Tool for building complete dev environments
● Easy to use workflow● Focus on automation● Lowers Dev Environment setup time● Increase Dev / Live Environment Parity
What is Vagrant?
![Page 4: Vagrant up-and-running](https://reader034.vdocuments.net/reader034/viewer/2022052208/55534e8ab4c9059e688b4ed5/html5/thumbnails/4.jpg)
Vagrant configures a Provider.Various Providers● Virtualbox● VMWare● AWSProvisioners Configure the VM● Puppet● Chef● Salt● Shell
Terminology
![Page 5: Vagrant up-and-running](https://reader034.vdocuments.net/reader034/viewer/2022052208/55534e8ab4c9059e688b4ed5/html5/thumbnails/5.jpg)
Assuming you have vagrant installed already:$ vagrant init precise32 http://files.vagrantup.com/precise32.box$ vagrant up
● Vagrant init: Create a vagrant env. here○ Name the box precise32 and fetch it from this
URL● Start the vagrant box
Getting Started
![Page 6: Vagrant up-and-running](https://reader034.vdocuments.net/reader034/viewer/2022052208/55534e8ab4c9059e688b4ed5/html5/thumbnails/6.jpg)
This is the Configuration file for the VM● Change "base" to whatever box you have● Add URL to box (optional)● Save Vagrantfile
Quick look at the Vagrantfile
![Page 7: Vagrant up-and-running](https://reader034.vdocuments.net/reader034/viewer/2022052208/55534e8ab4c9059e688b4ed5/html5/thumbnails/7.jpg)
$ vagrant ssh will dump you into the VM
On Mac OS X and Linux this is pretty easy
Vagrant SSH
![Page 8: Vagrant up-and-running](https://reader034.vdocuments.net/reader034/viewer/2022052208/55534e8ab4c9059e688b4ed5/html5/thumbnails/8.jpg)
On windows, this will give a warning that it cannot find an executable 'ssh'.
What we need to do here is open putty, configure 127.0.0.1:2222 with the private key it generatedhere: C:/Users/<you>/.vagrant.d/insecure_private_key
You will need to use Puttygen to generate the key for putty to use.
The user name will be 'vagrant'
Vagrant SSH+Windows = Extra Step
![Page 9: Vagrant up-and-running](https://reader034.vdocuments.net/reader034/viewer/2022052208/55534e8ab4c9059e688b4ed5/html5/thumbnails/9.jpg)
● Vagrant folder mounted in /vagrant
● Internet! (In most cases)
Automagic Stuff Done For You
![Page 10: Vagrant up-and-running](https://reader034.vdocuments.net/reader034/viewer/2022052208/55534e8ab4c9059e688b4ed5/html5/thumbnails/10.jpg)
● You get an empty VM with not much stuff
Where does this get you?
![Page 11: Vagrant up-and-running](https://reader034.vdocuments.net/reader034/viewer/2022052208/55534e8ab4c9059e688b4ed5/html5/thumbnails/11.jpg)
Four Common Provisioning Methods● Puppet*● Chef● Salt● Shell*
*We will cover
Provisioning
![Page 12: Vagrant up-and-running](https://reader034.vdocuments.net/reader034/viewer/2022052208/55534e8ab4c9059e688b4ed5/html5/thumbnails/12.jpg)
● Not the preferred method● Easy if you're bash savy
Add this to your Vagrantfile before "end"
*Make sure you copy "shell-provisioning.sh" to the same folder that has "Vagrantfile"
Shell Provisioning
![Page 13: Vagrant up-and-running](https://reader034.vdocuments.net/reader034/viewer/2022052208/55534e8ab4c9059e688b4ed5/html5/thumbnails/13.jpg)
If your vagrant box is still running:● vagrant reloadOtherwise:● vagrant up
Vagrant will start the VM and run the provisioning shell script.
Shell Provisioning
![Page 14: Vagrant up-and-running](https://reader034.vdocuments.net/reader034/viewer/2022052208/55534e8ab4c9059e688b4ed5/html5/thumbnails/14.jpg)
Oops!
Shell Provisioning - OOPS!
![Page 15: Vagrant up-and-running](https://reader034.vdocuments.net/reader034/viewer/2022052208/55534e8ab4c9059e688b4ed5/html5/thumbnails/15.jpg)
Resetting your vagrant box is very easy
Afterwards, just vagrant up again to start over
Vagrant DESTROY!
![Page 16: Vagrant up-and-running](https://reader034.vdocuments.net/reader034/viewer/2022052208/55534e8ab4c9059e688b4ed5/html5/thumbnails/16.jpg)
All set and ready to develop!
Back and now provisioned
![Page 17: Vagrant up-and-running](https://reader034.vdocuments.net/reader034/viewer/2022052208/55534e8ab4c9059e688b4ed5/html5/thumbnails/17.jpg)
Enter: Puppet - https://puppetlabs.com/
Why puppet?● Open Source Version● Community Support● Easier to grasp than Bash / Chef*
*for non-bash and non-ruby devs
There is a BETTER way
![Page 18: Vagrant up-and-running](https://reader034.vdocuments.net/reader034/viewer/2022052208/55534e8ab4c9059e688b4ed5/html5/thumbnails/18.jpg)
The simplistic syntax makes puppet manifests very easy to read and learn from.
PuPHPet - https://puphpet.com/● Geared towards PHP, but flexible● Creates manifests for you● Great to learn from
Puppet: Learn from others
![Page 19: Vagrant up-and-running](https://reader034.vdocuments.net/reader034/viewer/2022052208/55534e8ab4c9059e688b4ed5/html5/thumbnails/19.jpg)
Once you have a box configured, you can use vagrant box to package it up to share with your other developers.
This provides an easy way to ensure a team of developers are always on the same version and operating system that matches the live environment as closely as possible.
It's always nice to share...
![Page 20: Vagrant up-and-running](https://reader034.vdocuments.net/reader034/viewer/2022052208/55534e8ab4c9059e688b4ed5/html5/thumbnails/20.jpg)
Links:● Vagrant: http://www.vagrantup.com● Vagrant Boxes: http://www.vagrantbox.es● Make Vagrant Up Yours: https://jtreminio.
com/2013/06/make_vagrant_up_yours● PuPHPet: https://puphpet.com/● Vagrant: Up and Running: http://shop.oreilly.
com/product/0636920026358.doProvisioning:● Puppet: https://puppetlabs.com/puppet/puppet-open-
source/● Chef: http://docs.opscode.com/● Salt: https://github.com/saltstack
Links / Q & A