Upload
john-coggeshall
View
153
Download
2
Tags:
Embed Size (px)
Citation preview
What’s Vagrant?
Vagrant is a tool for managing the creation and management of self-contained development environments.
Think of it as a tool that combines a few different technologies together into one bag of awesome.
Benefits & Drawbacks of Vagrant
Get people up and running fast
Completely Sandboxed
Consistent Deployment
Version Controlled
Safety Net
Large Upfront investment *
Requires learning new stuff
Takes up a lot of space
Increases complexity
Getting Started
So how do we get started?
1) Download tools2) Define
Environment3) Prosper
Tools you’ll need: Vagrant
http://www.vagrantup.com/
VirtualBox http://www.virtualbox.or
g
Vagrant Commands
There are many commands to interact with your environment available to you via Vagrant
We will discuss some of them in this talk, but they are fully documented here:
https://docs.vagrantup.com/v2/cli/index.html
Useful Vagrant CLI commands
Bring up a VM
$ vagrant up
Power down a VM
$ vagrant halt
Reboot a VM
$ vagrant reload
SSH into a VM
$ vagrant ssh
Destroy / delete a VM
$ vagrant destroy
Vagrant Providers
Vagrant supports a number of different providers (the technology that creates the virtual environment)
For us we’re using the VirtualBox and Amazon EC2 providers as they are “free”
Providers are extendable as plug-ins
A VMWare provider is also available
Getting Started
Once you have the tools the first step in creating your environment is to select a box to use.
Boxes are ready to run virtual machines in a variety of OSes
A large selection of pre-made boxes are available for use:
http://www.vagrantbox.es
Debian
Ubuntu
Windows
BSD
Creating an Environment
Vagrant environments are defined through a file called a VagrantFile.
To create a stub of this file, from the root of your project execute the following command:
$ vagrant init [box name]
$ vagrant box add precise64 http://files.vagrantup.com/precise64.box virtualbox
$ cd /myproject
$ vagrant init precise64
Tools to help build a Vagrantfile
A Vagrantfile as you’ve seen is basically Ruby.
There are also a number of online tools available to help you generate these files using a UI if that’s what you prefer.
Generate your Vagrantfile online
Rove
http://rove.io/
PuPHPet
http://puphpet.com/
Vagrant Provisioners
Provisioners are various tools (extendable as plug-ins) for configuring the virtual environment
Vagrant supports a number of various provisioners out of box, most notably Puppet and Chef
Vagrant Provisioners
• File
• Shell
• Ansible
• CFEngine
• Chef
• Docker
• Puppet
• Salt
Making the Most of Vagrant
There are a number of ways to improve your Vagrant experience at various points that are worth mentioning Streamlining environment creation Improving performance of the
environment Etc.
Let’s take a look at a few of them.
Improving Performance
There are a number of ways to improve the performance of the virtual environment Provider Selection – VMWare does better
than VirtualBox For VMWare there are a few things
you can do as well Use NFS to share the project Use all CPU cores Use ¼ of system memory
Improving Creation Time
There are a number of things you can do to simply the complexity of using a tool like Vagrant to build environments Don’t use provisioners Create skeleton projects
Skipping Provisioners
If you want, you don’t necessarily have to use any provisioners at all when using Vagrant Boot up a box, login, and configure the
environment manually Use vagrant package to create a .box
from your configured VM Provide this to others
Easier, but you lose some visibility and management that you get from provisioners
Creating a Skeleton
IMHO, better than simply packaging boxes is to create a skeleton of your basic projects and build off of them as necessary
I have created said skeleton projects http://github.com/coogle/skeleton
Same speed in ramp-up time without losing the power of the provisioners