System Virtual Machines
"a complete system platform which supports the execution of a complete operating system (OS)"
- Wikipedia
Use Cases
- Multiple OSes
- Architecture emulation
- On-demand provisioning
- Workload migration
- Disaster recovery
- Environment consistency
Consistency
- Working with a team
- Developing across machines
- Deploying to production
- Shipping to a customer
Downsides
- Guest OS weight
- Reduced efficiency
- Resource competition
- Not entirely portable
VirtualBox
- Type 2 Hypervisor
English: It runs VMs on your laptop. - Manages VM images
- Runs VM instances
Vagrant
Developer-centric VM management
- Get / create a box (i.e., VM image).
- Write a config file.
- Script your installs.
- Run it.
- Share it with your team.
Vagrant CLI
Three commands to master:
$ vagrant up
$ vagrant ssh
$ vagrant destroy
Vagrantfile
- States the box to use
- States how to configure the box (e.g., networking)
- States how to provision software on the box
Example: Simple Vagrantfile
Vagrant.configure("2") do |config|
# fetches a box (i.e., VM image)
config.vm.box = "tottbox_2013_07_31"
config.vm.box_url = "http://static.mindtrove.info/tott/#{config.vm.box}.box"
# configures it
config.vm.network :private_network, ip: "192.168.33.10"
config.vm.network :forwarded_port, guest: 8080, host: 8080
# runs scripts on it
config.vm.provision :shell, :inline => "sudo apt-get -y update"
end
tottbox
- Our Vagrant box
- Our shared dev environment
- Pre-configured with many tools
Review
- Virtual machines
- VirtualBox
- Vagrant