Vagrant at TTM



Vagrant at TTM

0 0


ttm-vagrant-presentation


On Github joelmccracken / ttm-vagrant-presentation

Vagrant at TTM

Make development awesomer.

The 50,000 Foot View: Goals

  • All develpers have a common environment
  • Setting up the application is scripted & repeatable
  • Multiple copies of the application
    • possible on single machine
    • can be set up easily

The basic workflow

Acquire the `vagrant-environment` repository. (the initial bootstrap command) Run the `install-osx-host-software.sh` command. (install Vagrant and Virtualbox) Run 'vagrant up'. (Create a Virtual machine) Create and fill in an `env` file. (We need to know your scalr credentials, where your ssh private key is, etc) Run the 'setup.sh' command. (We need to know your scalr credentials) Start Working

30,000 Foot View:

The Players

  • Virtualization Software
  • Vagrant

30,000 Foot View:

Virtualization Software

  • Guest vs Host
  • Virtualbox vs VMWare

30,000 Foot View:

Vagrant

Provides:
  • `vagrant` commands to control VMs (vagrant up, vagrant halt, vagrant ssh)
  • A `Vagrantfile` system to configure the VMs (Base Box, forwarded ports, shared directories, provisioning)

10,000 Foot View:

Vagrant Details

  • Vagrant commands
  • Vagrant Boxes

10,000 Foot View:

Vagrant Commands

  • `vagrant up`
  • `vagrant ssh`
  • `vagrant halt`
  • `vagrant destroy`

Vagrant Boxes

A VM Image with specific conventions.
  • The vagrant user
  • Installed vagrant ssh key
  • Correct sudo permissions

Runway

Our Implementation

  • Vagrantfile highlights
  • Provisioning
  • The env file
  • Setup.sh

Our Implementation: Vagrantfile highlights

Vagrant.configure("2") do |config|

  config.vm.box     = "precise64"
  config.vm.box_url = "http://files.vagrantup.com/precise64.box"

  config.vm.provision :shell, path: 'provision.sh'

  # rails
  config.vm.network "forwarded_port", guest: 3000, host: 3002

  # live teaching
  config.vm.network "forwarded_port", guest: 5000, host: 5002

  # ttm-coffeescript-math
  config.vm.network "forwarded_port", guest: 9000, host: 9002

  # Give VM 2 gigs of memory
  config.vm.provider "virtualbox" do |vb|
    vb.customize ["modifyvm", :id, "--memory", "2048"]
  end

  # Use synced filesystem
  config.vm.synced_folder ".", "/vagrant", nfs: true

  # ...
end

Our Implementation: Provisioning

Installs:

  • Postgres
  • PhantomJS
  • Redis
  • ... and anything else needed from apt

Our Implementation: env file

Configuration to give the VM your data:

  • The private key to communicate with Github
  • Your Scalr credentials, so we can access production data
  • The Branch to clone apangea from

Our Implementation: setup.sh

Everything else

Copies data found in env. Installs RVM and software Clones & prepares an apangea repository, essentially following the apangea README

Caveat Emptor: Problems

  • Manual fiddling required
  • Possible performance issues
  • Takes time to get used to
  • More?

End

Questions?