virtualization for developers

16
Virtualization for Developers John Coggeshall @coogle http://www.coggeshall.org/

Upload: john-coggeshall

Post on 19-Jan-2015

582 views

Category:

Technology


0 download

DESCRIPTION

The rise of virtualization has transformed the server business, but other than that it seems like the developer world has largely been left behind. Regardless of if you are working on one project, or have 20 clients, every developer should know how to use virtualization to create seamless and easy to manage development environments. In this talk we will take a practical approach to using a combination of Puppet, Vagrant, and VirtualBox to create entire development environments in a matter of moments - and even better re-use that template for any project you have in the future in a version-controlled and easily managed manner. Bringing on a new developer for your project? We'll show you how they can get a full-fledged development environment from zero to working in under 10 minutes.

TRANSCRIPT

Page 1: Virtualization for Developers

Virtualization for Developers

John Coggeshall@coogle

http://www.coggeshall.org/

Page 2: Virtualization for Developers

2

•A bit about meoInvolved with PHP since 1996

oAuthor of tidy extension

oPublished Author of many PHP texts

Welcome

Page 3: Virtualization for Developers

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

Page 4: Virtualization for Developers

4

How it all fits together

Page 5: Virtualization for Developers

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?

Page 6: Virtualization for Developers

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

Page 7: Virtualization for Developers

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

Page 8: Virtualization for Developers

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

Page 9: Virtualization for Developers

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

Page 10: Virtualization for Developers

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!

Page 11: Virtualization for Developers

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

Page 12: Virtualization for Developers

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

Page 13: Virtualization for Developers

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

Page 14: Virtualization for Developers

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

Page 15: Virtualization for Developers

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

Page 16: Virtualization for Developers

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?