improved development workflows using vagrant
TRANSCRIPT
![Page 1: Improved development workflows using vagrant](https://reader031.vdocuments.mx/reader031/viewer/2022021922/58ed6eb31a28ab30738b470d/html5/thumbnails/1.jpg)
Improved dev workflows using Vagrant
and Docker
Makis Asimidis @aasimid
![Page 2: Improved development workflows using vagrant](https://reader031.vdocuments.mx/reader031/viewer/2022021922/58ed6eb31a28ab30738b470d/html5/thumbnails/2.jpg)
What is vagrant?
• Vagrant is a tool for building complete development environments. With an easy-to-use workflow and focus on automation, Vagrant lowers development environment setup time, increases development/production parity, and makes the "works on my machine" excuse a relic of the past.
https://www.vagrantup.com/about.html
![Page 3: Improved development workflows using vagrant](https://reader031.vdocuments.mx/reader031/viewer/2022021922/58ed6eb31a28ab30738b470d/html5/thumbnails/3.jpg)
Dev environments
• On the production system
![Page 4: Improved development workflows using vagrant](https://reader031.vdocuments.mx/reader031/viewer/2022021922/58ed6eb31a28ab30738b470d/html5/thumbnails/4.jpg)
Dev environments
• Shared development server - Local/Remote/Cloud
• Costly to buy
• Maintenance, Administration
• Developers sharing the same hardware/resources
• Tied down to specific software packages, versions
• Remote/Cloud = Network latencies
![Page 5: Improved development workflows using vagrant](https://reader031.vdocuments.mx/reader031/viewer/2022021922/58ed6eb31a28ab30738b470d/html5/thumbnails/5.jpg)
Dev environments
• Native local machine setup (e.g. WAMP)
• OS, platform, architecture, dependencies
• Package dependency mayhem
• Cannot quickly experiment by switching to different versions or packages
![Page 6: Improved development workflows using vagrant](https://reader031.vdocuments.mx/reader031/viewer/2022021922/58ed6eb31a28ab30738b470d/html5/thumbnails/6.jpg)
Does not work in production?
![Page 7: Improved development workflows using vagrant](https://reader031.vdocuments.mx/reader031/viewer/2022021922/58ed6eb31a28ab30738b470d/html5/thumbnails/7.jpg)
Does not work in production?
![Page 8: Improved development workflows using vagrant](https://reader031.vdocuments.mx/reader031/viewer/2022021922/58ed6eb31a28ab30738b470d/html5/thumbnails/8.jpg)
![Page 9: Improved development workflows using vagrant](https://reader031.vdocuments.mx/reader031/viewer/2022021922/58ed6eb31a28ab30738b470d/html5/thumbnails/9.jpg)
• We can run the exact same operating system and setup as the production boxes, on top of any other machine, be it Mac, Windows or Linux.
!
• We can install the same software / packages / versions.
!
• Everything is run in a contained sandbox and resources can be managed.
!
• We can create distributable images to share.
!
• If we run the VM’s locally, we can develop offline.
Local virtual environments
![Page 10: Improved development workflows using vagrant](https://reader031.vdocuments.mx/reader031/viewer/2022021922/58ed6eb31a28ab30738b470d/html5/thumbnails/10.jpg)
• Disadvantages
• Search for appropriate images or install OS on the VM manually
• No easy fallback in case of problems
• Not easily and most importantly programmatically reproducible
• Can be hard to learn, setup and configure
Local virtual environments
![Page 11: Improved development workflows using vagrant](https://reader031.vdocuments.mx/reader031/viewer/2022021922/58ed6eb31a28ab30738b470d/html5/thumbnails/11.jpg)
Vagrant virtual development environment
• A simple quick way to
• Bring up virtual machines with minimum requirements
• Programmatically recreate configuration
• Store vm configuration in vcs (Infrastructure as code)
• Share virtual machine settings
• Easy rollbacks
• Integration with configuration management tools (Puppet, Chef, Salt, Ansible etc.)
![Page 12: Improved development workflows using vagrant](https://reader031.vdocuments.mx/reader031/viewer/2022021922/58ed6eb31a28ab30738b470d/html5/thumbnails/12.jpg)
Questions• Won't it be slow?
• Headless Linux VMs are much less resource hungry than a fully blown Win/MacOS virtual image
• I want to use my preferred IDE
• You can. Vagrant automatically shares a folder with the host OS
• How do I transfer my code to the box?
• See above
• Where do I find, or how do I build an image
• All popular OS and apps offered as ready-made bundles
• Is this for coding only?
• NO! We can use it to test, experiment with new packages/versions and even in packaging & delivering software
![Page 13: Improved development workflows using vagrant](https://reader031.vdocuments.mx/reader031/viewer/2022021922/58ed6eb31a28ab30738b470d/html5/thumbnails/13.jpg)
• Required software (for your specific operating system):
• VirtualBox -- https://virtualbox.org/
• Vagrant -- https://vagrantup.com/
• GitBash -- https://git-scm.com/download/ (for Windows users)
Vagrant virtual development environment
![Page 14: Improved development workflows using vagrant](https://reader031.vdocuments.mx/reader031/viewer/2022021922/58ed6eb31a28ab30738b470d/html5/thumbnails/14.jpg)
$ mkdir vagrant-demo $ cd vagrant-demo/ $ vagrant init ubuntu/trusty64 $ vagrant up --provider=virtualbox $ vagrant ssh !You should see a default Ubuntu login message. You are now logged into your Vagrant VM. Enter the following: !Last login: Thu Jun 25 14:34:01 2015!vagrant@linux-p94a:~> uname -a!Linux linux-p94a 3.12.43-52.6-default #1 SMP Wed May 20 12:44:39 UTC 2015 (fc0ce!ac) x86_64 x86_64 x86_64 GNU/Linux!vagrant@linux-p94a:~>
Vagrant basic usage
![Page 15: Improved development workflows using vagrant](https://reader031.vdocuments.mx/reader031/viewer/2022021922/58ed6eb31a28ab30738b470d/html5/thumbnails/15.jpg)
VS
![Page 16: Improved development workflows using vagrant](https://reader031.vdocuments.mx/reader031/viewer/2022021922/58ed6eb31a28ab30738b470d/html5/thumbnails/16.jpg)
+
![Page 17: Improved development workflows using vagrant](https://reader031.vdocuments.mx/reader031/viewer/2022021922/58ed6eb31a28ab30738b470d/html5/thumbnails/17.jpg)
Demo
![Page 18: Improved development workflows using vagrant](https://reader031.vdocuments.mx/reader031/viewer/2022021922/58ed6eb31a28ab30738b470d/html5/thumbnails/18.jpg)
Resources• http://www.slideshare.net/ichilton/virtualized-development-
environments-phpne-may-2012
• http://www.slideshare.net/ortussolutions/vagrant-48606177
• http://www.slideshare.net/lorinh/vagrant-ansible-and-openstack-on-your-laptop
• https://eu.yourcircuit.com/#/conversation/49efedc6-b2db-4cc0-ac09-499c98fcca2d
• https://it-ebooks.info/book/5792/