VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant...
Transcript of VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant...
![Page 2: VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant is a command line tool. Here are the most important commands: ! • vagrant init](https://reader036.fdocuments.in/reader036/viewer/2022070711/5ec9a6e27c3455151d652bc8/html5/thumbnails/2.jpg)
ABOUT ME
• CTO at Last Call Media • PHP/Drupal Developer • Lead Architect • Educator • Open source advocate
![Page 3: VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant is a command line tool. Here are the most important commands: ! • vagrant init](https://reader036.fdocuments.in/reader036/viewer/2022070711/5ec9a6e27c3455151d652bc8/html5/thumbnails/3.jpg)
LAST CALL MEDIA
![Page 4: VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant is a command line tool. Here are the most important commands: ! • vagrant init](https://reader036.fdocuments.in/reader036/viewer/2022070711/5ec9a6e27c3455151d652bc8/html5/thumbnails/4.jpg)
VAGRANT?
A tool for creating portable development environments.
![Page 5: VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant is a command line tool. Here are the most important commands: ! • vagrant init](https://reader036.fdocuments.in/reader036/viewer/2022070711/5ec9a6e27c3455151d652bc8/html5/thumbnails/5.jpg)
VAGRANT?
• Quickly spin up new developers with a powerful, custom stack • Share your environment with your team • Maintain multiple environments • Emulate a production environment
![Page 6: VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant is a command line tool. Here are the most important commands: ! • vagrant init](https://reader036.fdocuments.in/reader036/viewer/2022070711/5ec9a6e27c3455151d652bc8/html5/thumbnails/6.jpg)
VAGRANT?You do use a production-like environment for all of your development, right?
![Page 7: VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant is a command line tool. Here are the most important commands: ! • vagrant init](https://reader036.fdocuments.in/reader036/viewer/2022070711/5ec9a6e27c3455151d652bc8/html5/thumbnails/7.jpg)
WHAT ABOUT VIRTUALIZATION?
![Page 8: VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant is a command line tool. Here are the most important commands: ! • vagrant init](https://reader036.fdocuments.in/reader036/viewer/2022070711/5ec9a6e27c3455151d652bc8/html5/thumbnails/8.jpg)
THE BASICS:Vagrant is a command line tool. Here are the most important commands: !
• vagrant init - initialize a new vagrant box in the current directory • vagrant up - start an existing vagrant environment (box) and provision it • vagrant ssh - shell into a running vagrant box • vagrant halt - stop a running vagrant box (shut down the computer) • vagrant destroy - completely destroy a vagrant box (delete all the things)
![Page 9: VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant is a command line tool. Here are the most important commands: ! • vagrant init](https://reader036.fdocuments.in/reader036/viewer/2022070711/5ec9a6e27c3455151d652bc8/html5/thumbnails/9.jpg)
THE LINGOvagrant box - an instance of a VirtualBox VM that has been provisioned and
started using Vagrant base box - a stored VirtualBox machine packaged into a single file. Think of this
as the template for your Vagrant box. provision - the configuration step that comes after the Vagrant box loads. Vagrantfile - a single file that defines what a particular Vagrant box is, including
the base box, network settings, and provisioning.
![Page 10: VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant is a command line tool. Here are the most important commands: ! • vagrant init](https://reader036.fdocuments.in/reader036/viewer/2022070711/5ec9a6e27c3455151d652bc8/html5/thumbnails/10.jpg)
INSTALLATION
1. Download VirtualBox 2. Download Vagrant 3. Create a new Vagrant box (vagrant init rbayliss/debian-wheezy) 4. Start the Vagrant box (vagrant up)
![Page 11: VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant is a command line tool. Here are the most important commands: ! • vagrant init](https://reader036.fdocuments.in/reader036/viewer/2022070711/5ec9a6e27c3455151d652bc8/html5/thumbnails/11.jpg)
A BASIC EXAMPLE
![Page 12: VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant is a command line tool. Here are the most important commands: ! • vagrant init](https://reader036.fdocuments.in/reader036/viewer/2022070711/5ec9a6e27c3455151d652bc8/html5/thumbnails/12.jpg)
THE VAGRANTFILE
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| … Stuff goes here end
![Page 13: VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant is a command line tool. Here are the most important commands: ! • vagrant init](https://reader036.fdocuments.in/reader036/viewer/2022070711/5ec9a6e27c3455151d652bc8/html5/thumbnails/13.jpg)
THE VAGRANTFILE
# Every Vagrant virtual environment requires a box to build off of. config.vm.box = "puppetlabs/debian-7.5-64-puppet"
![Page 14: VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant is a command line tool. Here are the most important commands: ! • vagrant init](https://reader036.fdocuments.in/reader036/viewer/2022070711/5ec9a6e27c3455151d652bc8/html5/thumbnails/14.jpg)
THE VAGRANTFILE
# Create a private network, which allows host-only access to the machine # using a specific IP. config.vm.network "private_network", ip: "192.168.33.10"
![Page 15: VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant is a command line tool. Here are the most important commands: ! • vagrant init](https://reader036.fdocuments.in/reader036/viewer/2022070711/5ec9a6e27c3455151d652bc8/html5/thumbnails/15.jpg)
THE VAGRANTFILE
# Share an additional folder to the guest VM. The first argument is # the path on the host to the actual folder. The second argument is # the path on the guest to mount the folder. config.vm.synced_folder "../data", "/vagrant_data"
![Page 16: VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant is a command line tool. Here are the most important commands: ! • vagrant init](https://reader036.fdocuments.in/reader036/viewer/2022070711/5ec9a6e27c3455151d652bc8/html5/thumbnails/16.jpg)
THE VAGRANTFILE
# Provision using a shell script: config.vm.provision "shell", path: "provision.sh"
![Page 17: VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant is a command line tool. Here are the most important commands: ! • vagrant init](https://reader036.fdocuments.in/reader036/viewer/2022070711/5ec9a6e27c3455151d652bc8/html5/thumbnails/17.jpg)
PROVISIONING
Provisioning can be done with many tools.
![Page 18: VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant is a command line tool. Here are the most important commands: ! • vagrant init](https://reader036.fdocuments.in/reader036/viewer/2022070711/5ec9a6e27c3455151d652bc8/html5/thumbnails/18.jpg)
CREATING A NEW BASE BOX
1. Start from an existing box 2. Install only the pieces you know you’ll always need 3. Clean up 4. Export the .box file (vagrant package) 5. Upload to a web-accessible place 6. Add to Vagrant Cloud
![Page 19: VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant is a command line tool. Here are the most important commands: ! • vagrant init](https://reader036.fdocuments.in/reader036/viewer/2022070711/5ec9a6e27c3455151d652bc8/html5/thumbnails/19.jpg)
CONCLUSION
Vagrant is a only a tool… !
A super awesome, powerful tool to help you spread sustainable development practices at your organization.
![Page 20: VAGRANT UP AND RUNNING - NERD2016.nerdsummit.org/sites/default/files/slides/Vagrant.pdf · Vagrant is a command line tool. Here are the most important commands: ! • vagrant init](https://reader036.fdocuments.in/reader036/viewer/2022070711/5ec9a6e27c3455151d652bc8/html5/thumbnails/20.jpg)
LINKS
https://www.vagrantup.com https://vagrantcloud.com http://www.vagrantbox.es https://vagrantcloud.com/puppetlabs https://github.com/rbayliss/vagrant-demo