Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Distributing uniform development environments with Vagrant

Distributing uniform development environments with Vagrant

By virtualising your whole dev environment, you can make it similar to production, avoiding issues that have to do with versions and compatibility.

Oh and also, Vagrant rules.

Yamil Urbina

October 10, 2014
Tweet

More Decks by Yamil Urbina

Other Decks in Technology

Transcript

  1. First day at new team A new and wild developer

    appears! First task: install the app locally “Use the documentation they said, it will be easy, they said” What about this new technology I know nothing about?
  2. Learning the insides of a new app can be a

    pain in the @$$. Problem #1
  3. Finally, the app is installed! but… • New dev: “hey,

    feature X is not working on my machine” • Older dev: “Oh, that version is not compatible with the app. Install v1.4.5” • Elder dev: “Also, your configuration file is outdated, we changed X setting months ago”
  4. “well, developers should work on the same OS and with

    the same tools” an failed solution
  5. The virtualisation ecosystem is diverse • Several solutions, different ways

    of managing settings, drives and memory • And that leads to even more differences between dev environments • They should be identical
  6. WHAT IF I TELL YOU… YOU CAN RUN YOU APP

    IN A PROPERLY CONFIGURED DEV ENVIRONMENT?
  7. Windows, Linux and OS X Vagrant acts as an intermediary

    between your virtualisation software and you Use you command line to start, stop and reboot your virtual machine Don’t worry about settings, Vagrant configures them for you
  8. Packaged .box files Are virtual machines already configured for your

    app They have the same software as production Same configuration and settings Redistributable; edit it and package it again Lighter than other VMs (less than 4GB) 21
  9. Use the same OS as production Using Ubuntu Server on

    production? Vagrant has the same machine version for you Install your app, dependencies and modify the proper settings there Package your own Vagrant machine and distribute it over HTTP
  10. A Vagrantfile to rule them all A single configuration file

    manages memory, folders and ports Include it on your source tree to distribute it No need to open GUIs
  11. Vagrant machines are indestructible Vagrant boots a VM copy that

    can be destroyed and rebuilt in a matter of minutes Perfect for noobies and new developers Also for experimenting, editing and pretty much doing whatever you want with it
  12. What about my files? Sync folders from host to vm

    Use rsync to detect changes Or use scp on Windows Exclude files and folders (kind of like git)
  13. Tell me more Imports a packaged .box file from the

    interwebz Vagrant creates a copy of the .box file Opens configured ports and local connections Starts the virtual machine That’s it
  14. Open ports and connections • Using HTTP? no problem, map

    port 80 from vm to the local machine • And access it via localhost • It uses your machine’s local internet connection
  15. Can I share my work? • Use your internal IP

    if you want to show it locally • Or, use vagrant share to create a public server • Anyone gets to see what you are working on
  16. Some downsides • While RAM consumption is low, it can

    affect performance on not so new machines • Updating .box files is a manual task • If mismanaged, the .box size can become pretty large (>20GB)
  17. First day at new team A new and wild developer

    appears! First task: boot Vagrant and experiment with the app New dev: “Oh, so that’s how it works!” Happiness :)
  18. First week at new team New developer is now familiar

    with the app They can start making small changes with confidence Or big experiments without fear