vagrant
DESCRIPTION
TRANSCRIPT
Vagrant
http://www.flickr.com/photos/themacinator/
Credits
Creators of Vagrant Mitchell Hashimotor
• http://mitchellhashimoto.com/
John Bender• http://nickelcode.com/
Patrick Debois http://jedi.be/blog/Much of this presentation is based off his
http://www.slideshare.net/jedi4ever/vagrant-devopsdays-mountain-view-2011
va·grant/ˈvāgrənt/Noun:A person without a settled home or regular work who wanders from place to place and lives by begging.
Vagrant http://www.vagrantup.com/a tool for creating and distributing virtualized development environments.
How ?
http://www.flickr.com/photos/51029297@N00/
Requirements
•Ruby (use RVM)•Virtualbox
Install Stuff
$ gem install vagrant
Your First Box
$ vagrant box add base http://files.vagrantup.com/lucid32.box$ vagrant init$ vagrant up
Coffee
http://www.flickr.com/photos/rwp-roger/
Connect
$ vagrant ssh
Had Enough
$ vagrant destroy
Port Forwarding
VM Workstation
80
3306
1080
13306
config.vm.forward_port "http", 80, 1080config.vm.forward_port "mysql", 3306, 13306
Shared Filesystem
VM
Workstation
/home/bob/project
/project
config.vm.share_folder "project", "/project", "/home/bob/project"
Provisioners
• Puppet• Chef• Shell Scripts
Using Puppet
config.vm.provision :puppet do |puppet| puppet.manifests_path = "manifests" puppet.manifest_file = "node.pp" puppet.module_path = "modules" end
Using Puppet
config.vm.provision :puppet do |puppet| puppet.manifests_path = "manifests" puppet.manifest_file = "node.pp" puppet.module_path = "modules" end
include myserver
class myserver { package {
"apache2" => "present", "mysql-server => "present", "vim" => "present", }}
node.pp
Why Vagrant ?
• Easier than using Virtualbox• Rebuild at will• Dedicated environment for project• Reproducible environments• Distribute environments• Automated setup using Puppet, Chef or
Shell Scripts• Tear down when done
For Developers
•Servers like live•Servers you control•Stop polluting your workstation•Still use the tools you love
For Operations
•Testing Puppet Manifests•Trying out new software
For Test
•Testing client applications•UI testing
Demonstration
http://www.flickr.com/photos/strassenstriche/
Cool Stuff
http://www.flickr.com/photos/wza/
Version Control
Vagrantfile
Puppet
VCS
StacksVagrant::Config.run do |config| config.vm.define :tomcat do |tomcat_config| web_config.vm.box = "tomcat" web_config.vm.forward_port("tc", 8080, 8080) end config.vm.define :web do |web_config| web_config.vm.box = "web" web_config.vm.forward_port("http", 80, 1080) end
config.vm.define :mysql do |mysql_config| db_config.vm.box = "mysql" db_config.vm.forward_port("db", 3306, 13306) endend
Tomcat
MySQL
Apache
Distribute Box
$ vagrant package --base my_base_box
Base Box Base BoxVMProvision Package
Obtaining Base Boxeshttp://vagrantbox.es/
Creating Base Boxes
•VeeWee• https://github.com/jedi4ever/veewee
Referenceshttp://www.flickr.com/photos/brokenthoughts/
References
• Vagrant http://vagrantup.com/• Vagrant https://github.com/mitchellh/vagrant• Virtual Box https://www.virtualbox.org/ • RVM http://beginrescueend.com/• Base Boxes http://vagrantbox.es/• VeeWee https://github.com/jedi4ever/veewee
Questions ?http://www.flickr.com/photos/dullhunk/