Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

whoami ● Brazilian, living in Amsterdam since 2012 ● PHP developer, eventually sysadmin ● Author of Vagrant Cookbook on LeanPub

Slide 3

Slide 3 text

What to expect from this talk ● Introduction to Vagrant – Terminology, basic usage ● Provisioning – Choosing a Provisioner – Practical Example with Ansible ● ProTips ● Useful Resources

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

“It works on my machine” - every developer, ever

Slide 6

Slide 6 text

1.1 Why Vagrant ● Reproducible and portable development environment ● Enables easier code collaboration ● Backend env tests / benchmark ● Automation Tools learning and testing

Slide 7

Slide 7 text

1.2 What you need (basic) ● Vagrant [1.4.x] ● VirtualBox [4.3.x]

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

1.3 Terminology ● Boxes ● Host and Guest ● Provider ● Provisioner ● Synced Folder ● Vagrantfile

Slide 10

Slide 10 text

1.4 Getting Started Vagrant.configure("2") do |config| config.vm.box = "precise64" config.vm.box_url = "http://files.vagrantup.com/precise64.box" config.vm.provision "shell", inline: "echo hello, this is a simple Shell Provisioner!" end

Slide 11

Slide 11 text

Output

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

2.1 Shell x Automation Tools ● Automation Tools have powerful built-in features – Clear language – Idempotent State – Templating – Modularization

Slide 15

Slide 15 text

2.2 Automation Tools PUPPET CHEF ANSIBLE Syntax Custom based on Ruby Ruby YAML Terminology Manifests / Modules Recipes / CookBooks Playbooks / Roles Exec. Order Not sequential Sequential Sequential Documentation Confusing Chaotic Excellent Popularity 1st 2nd 3rd Extra Requirements - - ansible Overall Learning Curve Moderate High Low

Slide 16

Slide 16 text

Pratical Example Nginx + PHP5: Ansible

Slide 17

Slide 17 text

Vagrantfile config.vm.provision "ansible" do |ansible| ansible.playbook = "playbook.yml" end

Slide 18

Slide 18 text

Playbook --- - hosts: all sudo: true tasks: - name: Update apt apt: update_cache=yes - name: Install Nginx apt: pkg=nginx state=latest - name: Install PHP5-fpm apt: pkg=php5-fpm state=latest

Slide 19

Slide 19 text

Output

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

3.1 Installing Packages ● Package managers are usually outdated – Make SURE you run apt-get update first

Slide 22

Slide 22 text

3.2 Debugging ● Unknown Vagrant error – Use VirtualBox / Vmware GUI ● Unknown Provisioner error – Increase provisioner verbosity ● Not working as expected – Login, fix, automate

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

Vagrant Cookbook Special discount coupon for DevFest Women: http://leanpub.com/vagrantcookbook/c/devfestw

Slide 25

Slide 25 text

puphpet.com

Slide 26

Slide 26 text

phansible.com

Slide 27

Slide 27 text

Comparing Provisioners ● Sandbox-PHP – Ansible, Puppet and Chef provisionings – https://github.com/vagrantee/sandbox-php

Slide 28

Slide 28 text

@erikaheidi