Developing robust software requires an accurate testing and staging environment. Vagrant provides just that. It lets you mimic your production server map on your computer.
|
vagrant init
|
Initialize Vagrant with a Vagrantfile and ./.vagrant directory, using no specified base image. Before you can do vagrant up, you'll need to specify a base image in the Vagrantfile.
|
|
vagrant init boxpath
|
Initialize Vagrant with a specific box. To find a box, go shopping. When you find one you like, just replace it's name with boxpath. For example, vagrant init chef/centos-6.5.
|
vagrant.configure("2") do |config|
config.vm.box = "chef/centos-6.5"
# guest is the VM; host is your computer end
config.vm.network "forwarded_port", guest: 80, host: 8080
config.vm.provision :shell, path: "my_bash_script.sh"
# path is relative to your Vagrantfile
end
|
vagrant box list
|
List the installed boxes
|
|
vagrant box add <name> <box path/HTTP URI>
|
Add the box for later use
|
|
vagrant box remove <name> virtualbox
|
delete a box
|
|
vagrant box outdated
|
Check for updates vagrant box update
|
|
vagrant up
|
starts vagrant environment (also provisions only on the FIRST vagrant up) Equivalent to pressing the power buttons on your servers.
|
|
vagrant status
|
outputs status of the vagrant machine
|
|
vagrant halt
|
stops the vagrant machine
|
|
vagrant reload
|
restarts vagrant machine, loads new Vagrantfile configuration
|
|
vagrant provision
|
forces reprovisioning of the vagrant machine
|
|
vagrant ssh
|
connects to machine via SSH
|
|
vagrant destroy
|
stops and deletes all traces of the vagrant machine
|
|
vagrant suspend
|
Suspends a virtual machine (remembers state)
|
|
vagrant resume
|
Resume a suspended machine (vagrant up works just fine for this as well)
|
|
vagrant reload --provision
|
Restart the virtual machine and force provisioning
|
|
vagrant provision --debug
|
Use the debug flag to increase the verbosity of the output
|
|
vagrant -v
|
Get the vagrant version
|
|
vagrant global-status
|
outputs status of all vagrant machines
|
|
vagrant global-status --prune
|
same as above, but prunes invalid entries
|
|
vagrant push
|
Vagrant can be configured to deploy code!
|
|
vagrant up --provision | tee provision.log
|
Runs
vagrant up, forces provisioning and logs all output to a file |
|
VAGRANT_LOG=info vagrant up
|
Use the environement variable VAGRANT_LOG to set verbosity
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.