Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Vagrant: are you stilldevelop in a non-virtualenvironment?Then we are coming to you!Anatoly BubenkovPaylogichttp://github....
Ok, Im starting a project, what do Ineed? (worst case)● Centos 4 (but I like my Ubuntu 13.04)!● MySQL (what??)● MongoDB (o...
Back to the past: can you please fixthat bug in a 2-years old project?● I dont even remember what was there...● Ok Ive fou...
As a Developer, I need theenvironment which is:● fully functional (eg. no limitations justbecause of its hard to set up lo...
Possible solutions:● 1 mb long INSTALL.txt :) - the hard way● Deployment automation tools (Puppet andetc) - need a clean m...
Vagrant!
How it works?Vagrant core(command line)VirtualboxVmWareProvidersAmazonAWSProvisionersShellPuppet (ruby script)Chef (ruby s...
InstallationExists for:● Windows● Linux● Mac OS
Easy example:$ vagrant init precise32 http://files.vagrantup.com/precise64.box$ vagrant upAfter running the above two comm...
ConfigurationVagrantfile - configuration entry point (a ruby script)Vagrant loads a series of Vagrantfiles, merging the se...
Configuration exampleVagrantfile:Vagrant.configure("2") do |config|config.vm.hostname = "paylogic-virtual"config.vm.box = ...
Boxes● Vagrant boxes are skeletons to rely on when you buildyour own instance.● Provider-specific● Contain metadata and he...
ProvisionersProvisioning is a process of making your basebox the box you need.Vagrant.configure("2") do |config|# ... othe...
Networking● High level configuration is provider-independend● Low level configuration is provider specific● Multiple netwo...
Synced folders● Transparently configure shared folders viavirtualization providers● By default, Vagrant will share your pr...
Multi-machine setup!● You can configure several machines insingle Vagrantfile:Vagrant.configure("2") do |config|config.vm....
ProvidersNatively:○ VirtualboxPlugins:○ Amazon AWS○ VMware (paid)
PluginsUseful for me:● vagrant-vbox-snapshot - snapshotmanagement for vbox provider● vagrant-vbguest - autoinstallation of...
Live demo● Editing code● Snapshot switching
But, but any consequences?● System memory - you need it enough● Disk - you need a complete OS on virtualmachine, be prepar...
Thanks!Questions?Anatoly BubenkovPaylogichttp://github.com/bubenkoff
Links● http://vagrantup.com● https://www.virtualbox.org/● https://github.com/dergachev/vagrant-vbox-snapshot● https://gith...
Upcoming SlideShare
Loading in …5
×

Vagrant are you still develop in a non-virtual environment-

2,344 views

Published on

Published in: Technology

Vagrant are you still develop in a non-virtual environment-

  1. 1. Vagrant: are you stilldevelop in a non-virtualenvironment?Then we are coming to you!Anatoly BubenkovPaylogichttp://github.com/bubenkoffMonthly PyGrunn June 11 2013
  2. 2. Ok, Im starting a project, what do Ineed? (worst case)● Centos 4 (but I like my Ubuntu 13.04)!● MySQL (what??)● MongoDB (oh...)● SOLR● RabbitMQ● node.js● python 2.4 :)● lots of system packages installed fromexternal sourcesWell, I dont want to install that on my machine,and actually cant!
  3. 3. Back to the past: can you please fixthat bug in a 2-years old project?● I dont even remember what was there...● Ok Ive found the code, but how do I createthe test data?● Spent hours to get it all working back...
  4. 4. As a Developer, I need theenvironment which is:● fully functional (eg. no limitations justbecause of its hard to set up locally)● reproducable (fast to reproduce same stuffon another machine in minutes)● as close to production environment aspossible● versioned (easy to make a savepoint, toreturn to if any need and at any time)● independent (no direct dependency on mymachine)
  5. 5. Possible solutions:● 1 mb long INSTALL.txt :) - the hard way● Deployment automation tools (Puppet andetc) - need a clean machine● docker.io - ubuntu specific (for now)● or ...
  6. 6. Vagrant!
  7. 7. How it works?Vagrant core(command line)VirtualboxVmWareProvidersAmazonAWSProvisionersShellPuppet (ruby script)Chef (ruby script)Ansible (YAML config)Base boxInstanceBase boxInstanceBase boxInstance
  8. 8. InstallationExists for:● Windows● Linux● Mac OS
  9. 9. Easy example:$ vagrant init precise32 http://files.vagrantup.com/precise64.box$ vagrant upAfter running the above two commands, youllhave a fully running virtual machine inVirtualBox running Ubuntu 12.04 LTS 64-bit.
  10. 10. ConfigurationVagrantfile - configuration entry point (a ruby script)Vagrant loads a series of Vagrantfiles, merging the settingsas it goes.Ordering:/home/mitchellh/projects/foo/Vagrantfile/home/mitchellh/projects/Vagrantfile/home/mitchellh/Vagrantfile/home/Vagrantfile/VagrantfileOn each level, Vagrant will merge settings in.
  11. 11. Configuration exampleVagrantfile:Vagrant.configure("2") do |config|config.vm.hostname = "paylogic-virtual"config.vm.box = "ubuntu-server-10.04-x64"config.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210.box"config.vm.network :private_network, ip: "192.168.44.10"config.vm.network :forwarded_port, guest: 8000, host: 8000config.vm.provider :virtualbox do |vb|vb.customize ["modifyvm", :id, "--memory", "512"]endconfig.vm.provision :puppet do |puppet|puppet.manifests_path = "puppet/manifests"puppet.manifest_file = "default.pp"endend
  12. 12. Boxes● Vagrant boxes are skeletons to rely on when you buildyour own instance.● Provider-specific● Contain metadata and helper files to deploy● Adding a box:$ vagrant box add name url● List:$ vagrant box listprecise64 (virtualbox)precise64 (vmware_fusion)● Remove:$ vagrant box remove precise64 virtualbox
  13. 13. ProvisionersProvisioning is a process of making your basebox the box you need.Vagrant.configure("2") do |config|# ... other configurationconfig.vm.provision :shell, :inline => "mkdir /etc/app"end● shell● chef● puppet● ansible
  14. 14. Networking● High level configuration is provider-independend● Low level configuration is provider specific● Multiple networks are supported at once
  15. 15. Synced folders● Transparently configure shared folders viavirtualization providers● By default, Vagrant will share your projectdirectory (the directory with theVagrantfile) to/vagrant.● But for the code, I prefer to share it FROMvirtual machine to host machine (NFS)
  16. 16. Multi-machine setup!● You can configure several machines insingle Vagrantfile:Vagrant.configure("2") do |config|config.vm.provision :shell, :inline => "echo Hello"config.vm.define :web do |web|web.vm.box = "apache"endconfig.vm.define :db do |db|db.vm.box = "mysql"endend● Start/stop them all or separately:vagrant upvagrant up webvagrant up db
  17. 17. ProvidersNatively:○ VirtualboxPlugins:○ Amazon AWS○ VMware (paid)
  18. 18. PluginsUseful for me:● vagrant-vbox-snapshot - snapshotmanagement for vbox provider● vagrant-vbguest - autoinstallation of vboxguest additionsInstallation is as simple as:$ vagrant plugin install <plugin name>
  19. 19. Live demo● Editing code● Snapshot switching
  20. 20. But, but any consequences?● System memory - you need it enough● Disk - you need a complete OS on virtualmachine, be prepared to give at least 10 Gbper instance.● Setting up network fs (NFS) - but thats onlyfor those who dont know vim :)● Speed - of course theres some slowdowndue virtualization.
  21. 21. Thanks!Questions?Anatoly BubenkovPaylogichttp://github.com/bubenkoff
  22. 22. Links● http://vagrantup.com● https://www.virtualbox.org/● https://github.com/dergachev/vagrant-vbox-snapshot● https://github.com/dotless-de/vagrant-vbguest

×