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

Vagrant Up: your environment

Vagrant Up: your environment

It’s Friday 3pm. Your boss comes to you and asks you to set up a development environment for the new employee that arrives on Monday.

On another day, you have a sudden traffic spike and need to add a new server. Now you have to carefully follow a procedure without forgetting a step.

Sounds familiar?

In this presentation, Yann Larrivée will show you how Vagrant and Puppet can dramatically reduce the time needed to accomplish these tasks ans reduce the number of mistakes.

Yann Larrivée

May 08, 2015
Tweet

More Decks by Yann Larrivée

Other Decks in Technology

Transcript

  1. foolab.ca | @foolabca
    Vagrant Up:
    your environment
    OpenWest, Orem – May 8th, 2015

    View full-size slide

  2. 2
    Yann Larrivée
    • Consultant at FooLab
    • Project rescue & bring projects
    to success
    • I organize ConFoo.ca
    • I founded PHP Quebec user
    group
    • Twitter: @ylarrivee
    • Email : [email protected]

    View full-size slide

  3. 3
    Presentation Objectives

    Increase software quality

    Lower the time needed for quality assurance

    Reduce the time needed to configure servers

    Spend more time doing solving real problems

    View full-size slide

  4. 4
    You will learn how to:
    Vagrant

    Manage a servers

    Provision them with VirtualBox or DigitalOcean
    Puppet

    Install / configure packadges

    Use configuration templates

    Create reusable scripts

    ..

    View full-size slide

  5. 5
    What is:

    VirtualBox: Hosted Hypervisor

    Puppet: Configuration Management System

    Vagrant: Provisioner

    View full-size slide

  6. 6
    Why use Vagrant & Puppet:
    Scenario #1

    Windows/Linux/Mac

    Different software version: PHP 5.5, 5.6, ..

    Different software installed

    Code breaks in production because of the later

    View full-size slide

  7. 7
    Why use Vagrant & Puppet:
    Scenario #2

    New employee

    No time to setup the machine

    View full-size slide

  8. 8
    Why use Vagrant & Puppet:
    Scenario #3

    You want to create a standard environment

    You need to create configured vm in seconds

    View full-size slide

  9. 9
    Installation

    https://www.virtualbox.org/wiki/Downloads

    http://www.vagrantup.com/downloads.html

    http://info.puppetlabs.com/open-source-puppet-
    download.html

    View full-size slide

  10. 10
    Vagrant:
    Where to get a box?

    https://atlas.hashicorp.com

    https://cloud-images.ubuntu.com/vagrant

    http://www.vagrantbox.es

    View full-size slide

  11. 11
    Vagrant:
    Commands

    vagrant init {box_name} {box_url}

    Vagrant up

    Vagrant halt/suspend/resume/reload

    Vagrant ssh

    Vagrant provision

    Vagrant destroy/rebuild

    Vagrant package

    View full-size slide

  12. 12
    Creating the box
    Naming things is hard!

    View full-size slide

  13. 13
    Creating the box
    Say Hello Waldo.box

    View full-size slide

  14. 14
    Vagrant:
    Creating the box
    https://cloud-images.ubuntu.com/vagrant/vivid/current/vivid-
    server-cloudimg-amd64-vagrant-disk1.box

    View full-size slide

  15. 15
    Vagrant:
    The Vagrantfile

    View full-size slide

  16. 16
    Vagrant:
    Customizing your VM

    Machine name

    RAM

    CPU

    Shared Folders

    Network

    Configuration manager (Puppet)

    The Hypervisor (virtualbox, vmware, DigitalOcea, AWS)

    View full-size slide

  17. 17
    Vagrant:
    The Vagrantfile

    View full-size slide

  18. 18
    Puppet:
    Manifest & Resource Example

    View full-size slide

  19. 19
    Puppet:

    Manifest

    Modules

    Classes

    Define

    View full-size slide

  20. 20
    Puppet:
    Resources Types

    Package

    File

    Service

    Cron

    Exec

    View full-size slide

  21. 21
    Puppet:
    Creating modules

    View full-size slide

  22. 22
    Puppet:
    The folder structure

    View full-size slide

  23. 23
    Vagrant:
    The Vagrantfile

    View full-size slide

  24. 24
    Vagrant:
    The Puppet Manifest

    View full-size slide

  25. 25
    Vagrant:
    The PHP Module

    View full-size slide

  26. 26
    Current Limitation

    Everything is hardcoded

    Specific to an OS

    Can't customize any packadge configuration

    Only configure one servers

    View full-size slide

  27. 27
    Why are we using puppet?

    Write your manifest once

    Configure always

    View full-size slide

  28. 28
    Hiera:
    Configuration Hierarchy

    Key/value storage engine

    Supports YAML & JSON

    View full-size slide

  29. 29
    Hiera:
    Configure Hiera

    View full-size slide

  30. 30
    Hiera:
    Configure Hiera

    View full-size slide

  31. 31
    Let's configure Waldo.box

    View full-size slide

  32. 32
    Hiera config for waldo.box

    View full-size slide

  33. 33
    Our Generic PHP Module

    View full-size slide

  34. 34
    Customizing config files

    View full-size slide

  35. 36
    Vagrant Multinode

    View full-size slide

  36. 37
    Vagrant Multinode:
    Vagrantfile

    View full-size slide

  37. 38
    Next step:
    In the cloud

    AWS

    DigitalOcean

    Linode

    ...

    View full-size slide

  38. 39
    In the cloud:
    Vagrant plugin

    View full-size slide

  39. 40
    In the cloud:
    The Vagrantfile

    View full-size slide

  40. 41
    In the cloud:
    Provisioning

    View full-size slide

  41. 42
    Presentation:
    Take away

    Don't automate things while learning

    Start small

    Iterate

    Automate once, configure always

    View full-size slide

  42. 43
    Presentation:
    Take away

    We automate to go faster

    Have a lab

    Test your scripts

    Be carefull, don't trust every box/scripts on the
    internet

    View full-size slide

  43. 44
    Questions:
    Twitter: @ylarrivee
    Email : [email protected]
    Website: foolab.ca
    Through powerful advice, I help businesses
    maximize their investment and ship projects
    ahead of time.

    View full-size slide