Virtualization for Developers
-
Upload
john-coggeshall -
Category
Technology
-
view
583 -
download
0
description
Transcript of Virtualization for Developers
Virtualization for Developers
John Coggeshall@coogle
http://www.coggeshall.org/
2
•A bit about meoInvolved with PHP since 1996
oAuthor of tidy extension
oPublished Author of many PHP texts
Welcome
3
•Virtualization for you, the developero Creating fully encapsulated development environments
→Fully Version Controlled
o Available locally using free tools or deploy to EC2 as necessary
•The technologies we are going to discusso Vagrant – Bootstrap virtual machines, manage box
settings, etc.
o VirtualBox – Provides the actual VM environment for machine
o Puppet – Provisions box, installs and manages various software, code, etc. (also supports others such as Chef, shell scripts, etc.)
What we’re going to be talking about today
4
How it all fits together
5
•There are a lot of reasons to use VMs for developmento Keep your host machine clean / easily recover from
corruption
o Keep separate projects from stepping on each other
o Super easy developer on-boarding
•There are even more reasons to use Vagrant & Puppeto Much easier management of the stack, versions, etc.
o Allows seamless deployment to various environments for testing
Why Virtualization?
6
•To get started, you’re going to need to download two pieces of softwareo Vagrant - http://www.vagrantup.com/
o VirtualBox - https://www.virtualbox.org/
•There are builds available for all major platforms
Getting Started
7
•Step 1: Download the tools
•Step 2: Define your VM parameters
•Step 3: Build your puppet manifests
•Step 4: Prosper
The steps to building your VM
8
•Every repository should have a Vagrantfile in the root directory that defines the VM itselfo Ruby based, but no Ruby knowledge required
•Defines a few key aspects of your initial VM configurationo Base VM type used (various available)
o Network configuration for VM in relation to host machine
o Provisioning tooling used (i.e. puppet)
o VM resource limits (memory, etc)
•Different configurations can be defined for different environments, and propagated throughout the process
Defining your VM Parameters
9
•Once the VM has been defined vagrant can boot it up as a headless VM (no display) using VirtualBox automatically and configure it as necessary
•Once booted, it can then provision the box by installing software packages, shared paths with hosts, etc. as necessary through the use of provisioning tools like puppet
•Next step is defining your puppet manifests
Defining your Puppet Manifests
10
•With everything defined, one command takes care of it all!o Downloads the VirtualBox image if necessary (precise64)
o Boots the VM with the defined parameters (memory, network, etc)
o Sets of shared folders, copies puppet manifests as necessary and executes puppet to run those manifests
That’s it!
11
• vagrant up – Brings up the virtual machine
• vagrant halt – Halts the VM (poweroff)
• vagrant destroy – Destroys the VM entirely
• vagrant provision – Run puppet provisioning again
• vagrant ssh – automagically log into the VM via SSH
Important Vagrant commands
12
•Primarily Vagrant is used to build local VMs for development
•But Vagrant can also be used to deploy to other environments, such as AWS through the use of Vagrant plug-ins
• First, install the Vagrant AWS provider plug-in:
Deploying to AWS
13
•Next, you will need to add a new environment to your Vagrantfile to setup the necessary configuration values for AWS such as Key/Secret, AMI type, etc.
•Note: To do provisioning using puppet, you may need to bootstrap the AMI on boot to install the puppet tooling
•To boot, simply add the --provider option to vagrant up
Deploying to AWS
14
•A single Vagrantfile can define multiple VMs (multi-machine environments) useful for all sorts of things: o A web server and database server
o API client and server
o Etc.
•Vagrant can do more than just VirtualBox as well, through providers can also provide VMWare VMs, etc.
Other cool tricks
15
•Vagrantfile configuration files can be created at various levels, and will be merged together to define/override settingso Box itself (precise64)
o Home directory (~/.vagrant.d)
o Project directory
Other cool tricks
16
•Thank you for coming!
•Questions?
• If you loved the talk, please login to joind.in and rate me! (If you hated the talk, please anonymously troll me)o https://joind.in/9061
•Further Reading:o http://docs.vagrantup.com/v2/
o http://puppetlabs.com/
Thank you! Questions?