Top Banner
Improved dev workflows using Vagrant and Docker Makis Asimidis @aasimid
18

Improved development workflows using vagrant

Apr 12, 2017

Download

Software

Makis Asimidis
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Improved development workflows using vagrant

Improved dev workflows using Vagrant

and Docker

Makis Asimidis @aasimid

Page 2: Improved development workflows using vagrant

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

Dev environments

• On the production system

Page 4: Improved development workflows using vagrant

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

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

Does not work in production?

Page 7: Improved development workflows using vagrant

Does not work in production?

Page 8: Improved development workflows using vagrant
Page 9: Improved development workflows using vagrant

• 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

• 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

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

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

• 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

$ 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

VS

Page 16: Improved development workflows using vagrant

+

Page 17: Improved development workflows using vagrant

Demo

Page 18: Improved development workflows using vagrant

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/