Is that a Vagrant in your Computer?

Using Vagrant to set up your environment

Slides & Examples:

https://github.com/CornerGeeks/

Slides / Dockerfiles / Vagrantfile

Introduction

Timothy Lim

@thewheat

+TimothyLimSH

thewheatfield.org

bruneigeekmeet.com

Let's start development!

In Theory

  1. Go to website & install requirements
  2. Code
  3. Profit!

Let's start development!

In Reality

  1. Go to website
  2. Try to install requirements
  3. See something breaks
  4. Google Bing the problem
  5. Try to fix it
  6. Go to Step 2

Vagrant

vagrantup.com

Create and configure reproducible & portable development environments

  

How-To Use

  1. Install
  2. Download configuration file (i.e. Vagrantfile).
    Manual download or quickstart via command line
    vagrant init hashicorp/precise32
  3. Start the box
    vagrant up
  4. Environment set up perfectly and ready to go

Where does the Vagrant environment live?

Vagrant Terminology

  1. Boxes:
    • base operating system image to create the Vagrant environment from (e.g. .iso file to install an OS)
  2. Vagrantfile:
    • configuration file that creates a Vagrant Environment from a Box
  3. Vagrant Environment:
    • the actual running instance of a environment built from a Box via a Vagrantfile
  4. Providers:
    • where the Vagrant Environment actually runs
    • specified in the Vagrantfile

Vagrantfile

configuration file

Vagrantfile

sample

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
   config.vm.box = "hashicorp/precise32"
   config.vm.hostname = "GDGBNdevfest2014"
config.vm.network "forwarded_port", guest: 80, host: 8000 config.vm.network "forwarded_port", guest: 8080, host: 8080 config.vm.network "private_network", ip: "192.168.10.19"
config.vm.synced_folder "www", "/var/www" config.vm.synced_folder "var_cache_apt", "/var/cache/apt/"
config.vm.provision "shell", :path => "setup.sh" end

Vagrant Commands

Vagrant Commands

Vagrant Cloud

vagrantcloud.com

Problems

It's never just a walk in the clouds

And that's Vagrant in a nutshell

Hopefully....

But wait, there's more!

Computer Whaling

Using Docker to set up your environment

Docker

docker.io

  • Open platform for developers and sysadmins to build, ship, and run distributed applications.
  • Portable and lightweight (FAST!)
  • Focused more on deployment and production
  • Development solutions exist such as Fig

Docker Terminology

Understanding Docker

Docker Commands (1)

Docker Commands (2)

Docker Commands (3)

Dockerfile

Mapping ports

Working Directory

Linking containers

Managing Data in Containers

1. Data Volumes

Managing Data in Containers

2. Data Volume Containers

Findings

In conclusion

Dock all the things!

Acknowledgements & Links

  1. vagrantup.com
  2. docker.io: Interactive Docker Tutorial
  3. Should I use Vagrant or Docker.io for creating an isolated environment?
  4. Why You Shouldn’t Use Vagrant: Real talk from a Vagrant burn-out
  5. boot2docker (for OSX and Windows)
  6. Docker Cheat Sheet
  7. Where are Docker Images Stored
  8. Using Docker as a Development Environment
  9. giphy.com
  10. Installing node on Ubuntu

The End

Thanks for your time and enjoy the rest of the event!

@thewheat

+TimothyLimSH

thewheatfield.org

bruneigeekmeet.com