Vagrant Up.Key
Total Page:16
File Type:pdf, Size:1020Kb
VAGRANT UP! SCOTT P. GALLAGHER [email protected] @SCOTTPGALLAGHER Me! Systems Administrator @ Penn State (*nix & Mac) @scottpgallagher https://vagrantcloud.com/scottpgallagher Using Vagrant Who's heard of vagrant? Anybody using vagrant currently? Using vbox, vmware fusion, parallels, etc? What is vagrant? Fully open source! Utility for building development environments Utility for easily distributing these environments Vagrant cloud Vagrant Support Linux Windows no Mac love ….yet Why vagrant? Benefits! Manage VMs all through command line No switching back and forth between an application and a terminal Using configuration file to manage VM settings Someone has already created the box for you and... You can share your box with others! Sharing is cool! All the kids are doing it!! More Benefits Easily bring people up to speed more quickly Boxes are easy to roll back; start over Repeatable, You know it's setup correctly Leverages puppet and/or chef code Why else? $ vagrant init scottpgallagher/ubuntu $ vagrant up 2 commands and your up and running! More time to relax and have a beer! Puppet/Chef code Can use puppet/chef code inside the Vagrantfile Can be used to provision/configure the box Install applications to box Can leverage the code you already have! Why vagrant and not docker? Remembering to commit on Docker Easier to manage; less layers Full VM Feature set Boxes Networking Synced Folders Multi-Machine Vagrant Share Plugins Vagrant boxes Version controlled Can push fixes and updates Easy to pull updated boxes (vagrant box update) Automatic update checking vagrant box add <USER/BOX> vagrant up checks for new versions each time Vagrant networking Forwarded ports Private network Public network Works across multiple providers (vbox, vmware, etc) Synced Folders Sync a folder on the host to the guest NFS, rsync, SMB Bi-directional too! Vagrant Multi-Machine Can bring up multiple machines from one Vagrantfile Boxes that communicate with each other Web server + mysql server Testing an API to a service Vagrant providers Virtualbox (default) VMWare Hyper-V Docker Custom providers (AWS for example) Vagrant share 3 primary modes* HTTP Sharing (provides link to share with others) SSH Sharing (Provides only SSH access to VM) General Sharing (Access any exposed ports) Uses encryption for connections *all require vagrant cloud account Vagrant plugins Extend vagrant beyond the basics Examples Jenkins, Additional providers/provisioners, etc https://github.com/mitchellh/vagrant/wiki/ Available-Vagrant-Plugins Using Vagrant Providers Defaults to virtualbox Can use vmware fusion (among others) --provider=vmware_fusion Vagrant + Docker Provision Docker containers from within Vagrant Vagrant.configure("2") do |config| config.vm.provision "docker" do |d| d.pull_images "ubuntu" d.pull_images "vagrant" d.run "ubuntu" d.run "vagrant" end end Vagrantfile Contains all configuration information for VM Environment, URL of box, Private IP, SSH settings, synced folders, vagrant provider Run chef and puppet scripts against box Forward ports from Vagrant to localhost Vagrant cloud vagrantcloud.com Ability to find boxes others have created Share your box configurations with others Can use vagrant hosting or your own storage for the .box files Vagrant box requirements root password: vagrant vagrant user (same password) + key pair Passwordless sudo SSH Usedns to no Virtualbox additions Package up the box vagrant package --base <VM_name> DEMO TIME! Vagrant Notes Remember to halt/suspend machines Use folder structure for multiple VMs --provider= Resources vagrantup.com vagrantcloud.com https://github.com/mitchellh/vagrant http://www.vagrantup.com/blog.html IRC #vagrant Resources Managing OS X with VMware Fusion https://github.com/jedi4ever/veewee http://derflounder.wordpress.com/2013/10/23/ create_vmware_osx_install_dmg-script- updated-with-mavericks-support/ Q & A [email protected] @scottpgallagher https://vagrantcloud.com/scottpgallagher http://j.mp/psumac60.