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

  1. Acquire the `vagrant-environment` repository.
  2. (the initial bootstrap command)
  3. Run the `install-osx-host-software.sh` command.
  4. (install Vagrant and Virtualbox)
  5. Run 'vagrant up'.
  6. (Create a Virtual machine)
  7. Create and fill in an `env` file.
  8. (We need to know your scalr credentials, where your ssh private key is, etc)
  9. Run the 'setup.sh' command.
  10. (We need to know your scalr credentials)
  11. 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

  1. Copies data found in env.
  2. Installs RVM and software
  3. 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?