Virtualization for Developers

Download Virtualization for Developers

Post on 19-Jan-2015

573 views

Category:

Technology

0 download

Embed Size (px)

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

<ul><li> 1. Virtualization for Developers John Coggeshall @coogle http://www.coggeshall.org/ </li></ul> <p> 2. 2 A bit about me oInvolved with PHP since 1996 oAuthor of tidy extension oPublished Author of many PHP texts Welcome 3. 3 Virtualization for you, the developer o 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 discuss o 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 were going to be talking about today 4. 4 How it all fits together 5. 5 There are a lot of reasons to use VMs for development o 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 &amp; Puppet o Much easier management of the stack, versions, etc. o Allows seamless deployment to various environments for testing Why Virtualization? 6. 6 To get started, youre going to need to download two pieces of software o Vagrant - http://www.vagrantup.com/ o VirtualBox - https://www.virtualbox.org/ There are builds available for all major platforms Getting Started 7. 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. 8 Every repository should have a Vagrantfile in the root directory that defines the VM itself o Ruby based, but no Ruby knowledge required Defines a few key aspects of your initial VM configuration o 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. 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. 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 Thats it! 11. 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. 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. 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. 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 VMWareVMs, etc. Other cool tricks 15. 15 Vagrantfile configuration files can be created at various levels, and will be merged together to define/override settings o Box itself (precise64) o Home directory (~/.vagrant.d) o Project directory Other cool tricks 16. 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? </p>