Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Tamed Localized Development with Vagrant

Tamed Localized Development with Vagrant

Talk given at DrupalCampCT 2012.

Tamed Localized Development with Vagrant
Nick Silkey Senior UNIX Systems Engineer, Yale University

Vagrant, a free open-source tool with multi-platform support, facilitates the manipulation of local, virtualized environments. It lowers development environment setup time, maximizes dev/prod parity, and maintains consistent development environments over multiple projects. This talk is aimed at Drupal developers of all levels (themers, core hackers) along with ops engineers whom support Drupal as a service. More info on Vagrant at http://vagrantup.com/.

Nick Silkey

August 18, 2012
Tweet

More Decks by Nick Silkey

Other Decks in Technology

Transcript

  1. Vagrant is open-source software for creating and configuring virtual development

    environments. It can be considered a wrapper around VirtualBox and configuration management software such as Chef and Puppet. Although written in Ruby, it is usable in other programming projects such as PHP, Python, Java, and C#. - http://en.wikipedia.org/wiki/ Vagrant_(software)
  2. Vagrant lowers development environment setup time, maximizes dev/prod parity, and

    makes the "works on my machine" excuse a relic of the past. - http://vagrantup.com/
  3. $ vagrant init $ vagrant up $ vagrant provision $

    vagrant ssh $ vagrant reload $ vagrant destroy
  4. # Every Vagrant virtual environment # requires a box to

    build off of. # config.vm.box = "base" # The url from where the 'config.vm.box' # box will be fetched if it doesn't already # exist on the user's system. # config.vm.box_url = "http://domain.com/ path/to/above.box"
  5. # Boot with a GUI so you can # see

    the screen. (Default is # headless) # # config.vm.boot_mode = :gui
  6. # Assign this VM to a host-only network # IP,

    allowing you to access it via the IP. # Host-only networks can talk to the host # machine as well as any other machines on # the same network, but cannot be accessed # (through this network interface) by any # external networks. # # config.vm.network :hostonly, "33.33.33.10"
  7. # Assign this VM to a bridged network, # allowing

    you to connect directly to a # network using the host's network device. # This makes the VM appear as another # physical device on your network. # # config.vm.network :bridged
  8. # Forward a port from the guest to the #

    host, which allows for outside # computers to access the VM, whereas host # only networking does not. # # config.vm.forward_port 80, 8080
  9. # Share an additional folder to the guest # VM.

    The first argument is an identifier, # the second is the path on the guest to # mount the folder, and the third is the # path on the host to the actual folder. # # config.vm.share_folder "v-data", "/ vagrant_data", "../data" config.vm.share_folder "drupal-7.15", "/ var/www/html", "./drupal-7.15"
  10. Vagrant::Config.run do |config| config.vm.define :web do |web_config| web_config.vm.box = "web"

    web_config.vm.forward_port 80, 8080 end config.vm.define :db do |db_config| db_config.vm.box = "db" db_config.vm.forward_port 3306, 3306 end end
  11. Vagrant::Config.run do |config| config.vm.define :varnish do |varnish_config| varnish_config.vm.box = "varnish"

    varnish_config.vm.forward_port 6081, 6081 end config.vm.define :web do |web_config| web_config.vm.box = "web" web_config.vm.forward_port 80, 8080 end config.vm.define :db do |db_config| db_config.vm.box = "db" db_config.vm.forward_port 3306, 3306 end end
  12. Vagrant::Config.run do |config| config.vm.define :varnish do |varnish_config| varnish_config.vm.box = "varnish"

    varnish_config.vm.forward_port 6081, 6081 end config.vm.define :web1 do |web1_config| web1_config.vm.box = "web1" web1_config.vm.forward_port 80, 8081 end config.vm.define :web2 do |web2_config| web2_config.vm.box = "web2" web2_config.vm.forward_port 80, 8082 end config.vm.define :db do |db_config| db_config.vm.box = "db" db_config.vm.forward_port 3306, 3306 end end
  13. Enable reconstruction of the business from nothing but * a

    source code repository, * application data backup, * and bare metal resources
  14. * veewee \_ basebox templating * sahara \_ sandbox mode

    (cli snaps) \_ vagrant sandbox on vagrant ssh * hack hack hack vagrant sandbox commit or vagrant sandbox rollback vagrant sandbox off * vagrant-vbguest \_ update base vbox extensions