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

Vagrant to the rescue

Sebastian
October 04, 2014

Vagrant to the rescue

Many developers know the pain of setting up a development machine and share the setup with the team - Putting the same folders in the same place, keeping configurations in sync and managing external dependencies. Vagrant solves this problem by creating a development environment inside a virtual machine and making it easy to share with other developers. Within this talk, I'll take the audience on a trip from a time where everybody would install stuff on localhost until the software starts working to a land where the environment one develops in mirrors the production environment as closely as possible without changing the laptop/pc of the developer. I'll talk about devops and configuration management briefly and show how one can get started with vagrant. After this talk, the audience knows what problems vagrant solves and how to get started.

Sebastian

October 04, 2014
Tweet

More Decks by Sebastian

Other Decks in Programming

Transcript

  1. Vagrant to the rescue
    WebCamp Zagreb 2014
    @Sgoettschkes
    http://nos.twnsnd.co/image/95830917309

    View full-size slide

  2. “It works on my machine”

    View full-size slide

  3. “It’s all in SETUP.md”

    View full-size slide

  4. Enter vagrant

    View full-size slide

  5. Building blocks
    Configuration
    + Provider
    + Provisioner
    + Plugins
    = Vagrant
    http://pixabay.com/static/uploads/photo/2010/12/10/08/salad-1105_640.jpg

    View full-size slide

  6. Configuration
    Vagrant.configure(2) do |config|
    config.vm.box = "Sgoettschkes/debian7"
    config.vm.network "private_network", ip: "127.0.0.101"
    config.vm.synced_folder "../", "/srv/workspace"
    config.vm.provision "chef_solo" do |chef|
    chef.add_recipe "main"
    end
    end

    View full-size slide

  7. Provisioners

    View full-size slide

  8. Synced folders
    http://upload.wikimedia.org/wikipedia/commons/5/5d/BalticServers_data_center.jpg

    View full-size slide

  9. SSH
    http://pixabay.com/static/uploads/photo/2013/04/08/22/48/tunnel-101976_640.jpg
    $ vagrant ssh
    # or
    $ ssh -p 2222 vagrant@localhost
    # with password “vagrant”

    View full-size slide

  10. Plugins
    # AWS provider
    $ vagrant plugin install vagrant-aws
    # Boxen provisioner
    $ vagrant plugin install ventriloquist
    # Manage host files
    $ vagrant plugin install vagrant-hostmanager
    # Make screenshots of your VM
    $ vagrant plugin install vagrant-camera
    # … many more!

    View full-size slide

  11. Basic workflow
    $ vagrant init hashicorp/precise32
    $ vagrant up
    # box is booting
    $ vagrant ssh
    # you are now inside your vm
    $ vi Vagrantfile
    # change config
    # add provisioners and so on
    # don’t forget to comit Vagrantfile and provisioners to
    git!
    http://freehddesktopwallpaper.info/wp-content/uploads/2013/06/Blue-Flowers-hd-Wallpapers.jpg

    View full-size slide

  12. Basic workflow
    $ git clone [email protected]:awesomecompany/awesomeVm.git
    $ cd awesomeVm && vagrant up
    # Hack away
    $ git pull --rebase
    $ vagrant provision
    # Hack some more and change provision files
    $ vagrant provision
    $ git commit -am ‘Incredible changes’ && git push
    http://freehddesktopwallpaper.info/wp-content/uploads/2013/06/Blue-Flowers-hd-Wallpapers.jpg

    View full-size slide

  13. Use cases
    Development environment

    View full-size slide

  14. Use cases
    Development environment
    Testing environment

    View full-size slide

  15. Use cases
    Development environment
    Testing environment
    Local test box for PMs & Designer

    View full-size slide

  16. Use cases
    Development environment
    Testing environment
    Local test box for PMs & Designer
    Playing around

    View full-size slide

  17. Use cases
    Development environment
    Testing environment
    Local test box for PMs & Designer
    Playing around
    with clusters

    View full-size slide

  18. Use cases
    Development environment
    Testing environment
    Local test box for PMs & Designer
    Playing around
    with clusters
    Open Source projects

    View full-size slide

  19. What about...
    chef vs puppet?

    View full-size slide

  20. What about...
    one vs many boxes?

    View full-size slide

  21. What about...
    base boxes?

    View full-size slide

  22. … performance?

    View full-size slide

  23. http://community.openatria.com/sites/community.openatria.com/files/vagrant.png

    View full-size slide

  24. Vagrant
    “Development environments
    made easy”
    http://fc02.deviantart.net/fs50/i/2009/315/4/c/Tweaked_toy_airplane_by_afd.jpg

    View full-size slide