DevOps Yourself:

Fast-Track Your Dev Environment Setup

Justin James

Time to bring on

a new developer

You Hire

an Expert

 

Who is all excited 

 

Then....

Then

the

setup

instructions

Hours

 

Later

 

....

 

 

feeling foggy

on the road

to

nowhere 

She Becomes

Instead..Make Them Best Friends

=

+

cross-platform

virtualization

high performance 

reproducible

lightweight

portable 

Setting up the VM

Boxes

 

portable 

skeletons 

for building

Virtual Machines

 

First Machine

mkdir c:\boxes\jekyll

cd c:\boxes\jekyll

vagrant init ubuntu/trusty64

Start up Box

vagrant up

Login to Box

vagrant ssh

Ready to Configure?

This isn't any better.... yet

KEEP CALM

 

WE HAVE

 

A PLAN

     Option 1

Pre-Configured Box

Pre-Built box

vagrant init digitaldrummerj/jekyll

vagrant up

vagrant ssh

More Pre-Built Boxes

atlas.hashicorp.com/boxes/search

Option 2

Provisioning

Start with Base Box

vagrant init ubuntu/trusty64

Configure VagrantFile

config.vm.provision "shell", path "setup.sh"

config.vm.provision "shell", inline: <<-SHELL
    sudo apt-get update
    sudo apt-get install -y git

    .....
SHELL

Start Up Box

vagrant up

Login into Box

vagrant ssh

All is Right Again

Now What

Other useful commands

vagrant reload

Need to Reboot?

vagrant halt

Need to Shutdown?

vagrant suspend

Need to Hibernate?

vagrant destroy

Done with Project?

vagrant up

Need to Box Again?

More

Configurations 

Options

VagrantFile - General

config.vm.box = "ubuntu/trusty64"

config.vm.hostname = "GithubBlog"

config.vm.boot_timeout = 600

config.vm.communicator = "winrm" or "ssh"

VagrantFile - Networking

config.vm.network "forwarded_port", guest: 3389, host: 8080,
          auto_correct: false,
          id: "rdp" 

   config.vm.network "private_network", ip: "192.168.33.10",
         type: "dhcp"

 

   config.vm.network "public_network",
         bridge: 'en1: Wi-Fi (AirPort)',
         ip: "192.168.0.17"

VagrantFile - Synced Folders

 config.vm.synced_folder '.', '/vagrant', disabled: true

 config.vm.synced_folder "c:\\projects",

         "/home/vagrant/projects"

 config.vm.synced_folder "src", "/srv/website"

VagrantFile - Virtualbox 

config.vm.provider "virtualbox" do |vb|

 end

     vb.gui = false

     vb.memory = 2048

     vb.cpus = 2

     vb.name = "Github Jekyll Blog"

     vb.customize ["modifyvm", :id, "--vram", "128"]    

     vb.customize ["modifyvm", :id, "--usb", "on"]

VagrantFile - Provisioning 

Defining Multiple Machines

Provision run order is outside-in

config.vm.provision :shell, inline: 'echo A'

config.vm.define "web" do |web|
        web.vm.box = "apache"
    web.vm.provision :shell, inline: 'echo B'
end

config.vm.define "db" do |db|
   db.vm.box = "mysql"
end

  config.vm.provision :shell, inline: 'echo C'  

Build & Share

Your Own Box

Easiest way

 

build out machine

 

then

 

package it

Packaging VirtualBox Machine

 

vagrant package --base NAME --output NAME

 

Share Box

Hashicorp Atlas

Additional Commands

vagrant box add name [url]

Add New Box

vagrant status

Status of Box

vagrant global-status

Status of All Boxes

vagrant box list

Local Base Boxes

Resources

Vagrant Website - http://www.vagrantup.com

 

VirtualBox - http://www.virtualbox.org

 

Vagrant Documentation - https://docs.vagrantup.com/

 

Vagrant Boxes - https://atlas.hashicorp.com/boxes/search

 

My blog - http://digitaldrummerj.me/

Questions?

Previous Talk

Rate Links

spkr8.com/t/43011

Please rate this talk!

Fast Track Your Windows Dev Box Setup

By Justin James

Fast Track Your Windows Dev Box Setup

Learn how to get rid of the it works on my machine. Toss the setup manual out the window and learn how to create reproducible setups.

  • 4,065