Vagrant and Magento – We Will Cover – What is Vagrant?



Vagrant and Magento – We Will Cover – What is Vagrant?

0 1


vagrant-magento-presentation


On Github broderboy / vagrant-magento-presentation

Vagrant and Magento

@timothybroder

We Will Cover

  • What is Vagrant?
  • Common Scenarios
  • Technical Overview

What is Vagrant?

An Open Source tool for building and distributing development environments

wft does that mean?

Vagrant can help automate common Dev and Ops scenarios

By providing easy to configure, lightweight, reproducible, and portable virtual machines targeted at development environments, Vagrant helps maximize the productivity and flexibility of you and your team.

Common Scenarios

  • Test a server config
  • Test a deploy script
  • SETUP. THE. PROJECT.

How?

Virtual Machines:

  • That match the production environment
  • That setup themselves
  • With easy to remember git-like commands

Benefits

  • Consistent development environments
  • Dependency and configuration encapsulation
  • Environment distribution

All of this saves time, money, and frustration

Technical Overview

Install

Vagrant Project Setup

  • Mark root (project) directory
  • Setup basic required files
$ mkdir vagrant_guide
$ cd vagrant_guide
$ vagrant init

This can be done to new or existing projects

Web Project Setup

  • Create some content
  • We'll get into libraries, db, and servers later
$ echo "Hello from a Vagrant VM" > index.html

Boxes

  • What?
    • Vagrant Boxes are a package around a virtual machine that Vagrant can use
    • Can pull from local/networked filesystem or over HTTP
  • Where?
    • Get a pre-configured box from Ai's vagrant drive
    • Get a base box from vagrantup.com:
    $ vagrant box add lucid32 http://files.vagrantup.com/lucid32.box
  • If needed, use the lucid32 box with multiple projects

Think: Ai's "magento box", or "wordpress box", or could just be project specific

Boxes (cont'd)

  • Remove (delete) a box:
$ vagrant box remove lucid32

Boxes and VagrantFile

  • Tell Vagrant which box to use for this project
Vagrant::Config.run do |config|
    config.vm.box = "lucid32"
end
vagrant up vagrant halt vagrant reload

Getting into the Box

  • vagrant ssh
  • Quick command on mac putty key config on windows
  • Project files mapped to /vagrant
  • root access

Dev Locally, Run on "Prodish"

Project files mapped to /vagrant Port Forwarding: guest, local
Vagrant::Config.run do |config|
    config.vm.forward_port 80, 8000
    config.vm.box = "lucid32"
end
Profit

Setting up complex boxes

  • Manual setup and package
  • chef
  • puppet

Packaging the box

  • VagrantFile
  • Package the Box
$ vagrant package --vagrantfile Vagrantfile.pkg
  • Distribute the Box

Questions?