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.

6e0a205f01d2d8ca7144d434ecb13a0a?s=128

Yann Larrivée

May 08, 2015
Tweet

Transcript

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

    May 8th, 2015
  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 : yann@foolab.ca
  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
  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  ..
  5. 5 What is:  VirtualBox: Hosted Hypervisor  Puppet: Configuration

    Management System  Vagrant: Provisioner
  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
  7. 7 Why use Vagrant & Puppet: Scenario #2  New

    employee  No time to setup the machine
  8. 8 Why use Vagrant & Puppet: Scenario #3  You

    want to create a standard environment  You need to create configured vm in seconds
  9. 9 Installation  https://www.virtualbox.org/wiki/Downloads  http://www.vagrantup.com/downloads.html  http://info.puppetlabs.com/open-source-puppet- download.html

  10. 10 Vagrant: Where to get a box?  https://atlas.hashicorp.com 

    https://cloud-images.ubuntu.com/vagrant  http://www.vagrantbox.es
  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
  12. 12 Creating the box Naming things is hard!

  13. 13 Creating the box Say Hello Waldo.box

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

  15. 15 Vagrant: The Vagrantfile

  16. 16 Vagrant: Customizing your VM  Machine name  RAM

     CPU  Shared Folders  Network  Configuration manager (Puppet)  The Hypervisor (virtualbox, vmware, DigitalOcea, AWS)
  17. 17 Vagrant: The Vagrantfile

  18. 18 Puppet: Manifest & Resource Example

  19. 19 Puppet:  Manifest  Modules  Classes  Define

  20. 20 Puppet: Resources Types  Package  File  Service

     Cron  Exec
  21. 21 Puppet: Creating modules

  22. 22 Puppet: The folder structure

  23. 23 Vagrant: The Vagrantfile

  24. 24 Vagrant: The Puppet Manifest

  25. 25 Vagrant: The PHP Module

  26. 26 Current Limitation  Everything is hardcoded  Specific to

    an OS  Can't customize any packadge configuration  Only configure one servers
  27. 27 Why are we using puppet? • Write your manifest

    once • Configure always
  28. 28 Hiera: Configuration Hierarchy  Key/value storage engine  Supports

    YAML & JSON
  29. 29 Hiera: Configure Hiera

  30. 30 Hiera: Configure Hiera

  31. 31 Let's configure Waldo.box

  32. 32 Hiera config for waldo.box

  33. 33 Our Generic PHP Module

  34. 34 Customizing config files

  35. 35 Templates

  36. 36 Vagrant Multinode

  37. 37 Vagrant Multinode: Vagrantfile

  38. 38 Next step: In the cloud  AWS  DigitalOcean

     Linode  ...
  39. 39 In the cloud: Vagrant plugin

  40. 40 In the cloud: The Vagrantfile

  41. 41 In the cloud: Provisioning

  42. 42 Presentation: Take away  Don't automate things while learning

     Start small  Iterate  Automate once, configure always
  43. 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
  44. 44 Questions: Twitter: @ylarrivee Email : yann@foolab.ca Website: foolab.ca Through

    powerful advice, I help businesses maximize their investment and ship projects ahead of time.