Varying Vagrant Vagrants
Varying Vagrant Vagrants is an open source Vagrant configuration focused on WordPress development. VVV is MIT Licensed.
VVV is a 10up creation and transitioned to a community organization in 2014.
-
Version: 1.4.0
-
Latest Stable: 1.4.0
-
Contributors: @jeremyfelt, @carldanley, @ericmann, @lkwdwrd, @TheLastCicada, @tddewey, @johnpbloch, @kadamwhite, @scribu, @danielbachhuber, @tollmanz, @mbijon, @markjaquith, @curtismchale, @Mamaduka, @lgedeon, @pmgarman, @westonruter, @petemall, @cmmarslender, @mintindeed, @mboynes, @aaronjorbin, @tobiasbg, @simonwheatley, @ocean90, @lvnilesh, @alexw23, @zamoose, @leewillis77, @imichaeli, @andrezrv, @cadwell, @cfoellmann, @westi, @ryanduff, @selinerdominik, @ericandrewlewis, @vDevices, @sunnyratilal, @enejb, @salcode, @mattbanks, @aaroncampbell, @tnorthcutt, @neilpie, @francescolaffi, @itsananderson, @foolswis, @lloydde, @jmbarlow, @nacin, @thewebists, @iparr, @chrishepner, @miya0001, @iamntz, @mirmillo, @garyjones, @teraphy, @DrewAPicture, @jjeaton, @ntwb, @bradp, @jb510, @pbearne, @robneu, @hubdotcom, @michaelbeil, @EHLOVader, @HongPong, @twisty7867, @khromov, @amchoukir, @grantnorwood, @MatthewEppelsheimer, @cristovaov, @coreymckrill, @jonathanbardo, @rasmusbe, @eriktrom, @f4bsch, @meitar, @keegoid, @LoreleiAurora, @cobyan, @goblindegook, @dlackty, @rene-hermenau, @jdevalk, @kadimi, @sc0ttkclark, @jonathanbossenger, @hello-jason, @weskoop, @thebrandonallen
-
Contributing: Contributions are more than welcome. Please see our current contributing guidelines. Thanks!
Table of Content
Overview
The Purpose of Varying Vagrant Vagrants
The primary goal of Varying Vagrant Vagrants (VVV) is to provide an approachable development environment with a modern server configuration.
VVV is ideal for developing themes and plugins as well as for contributing to WordPress core.
How to Use Varying Vagrant Vagrants
Software Requirements
VVV requires recent versions of both Vagrant and VirtualBox to be installed.
Vagrant is a "tool for building and distributing development environments". It works with virtualization software such as VirtualBox to provide a virtual machine sandboxed from your local environment.
Provider support is included for VirtualBox, Parallels, Hyper-V, VMWare Fusion, and VMWare Workstation.
VVV as a MAMP/XAMPP Replacement
Once Vagrant and VirtualBox are installed, download or clone VVV and type vagrant up
to automatically build a virtualized Ubuntu server on your computer. See our section on The First Vagrant Up for detailed instructions.
Multiple projects can be developed at once in the same environment.
- Use
wp-content/themes
in either thewww/wordpress-default
orwww/wordpress-develop/src
directories to develop themes. - Use
wp-content/plugins
in either thewww/wordpress-default
orwww/wordpress-develop/src
directories to develop plugins. - Take advantage of VVV's auto site configuration to provision additional instances of WordPress in
www/
. The Variable VVV project helps to automate this process. - Use the
www/wordpress-develop
directory to participate in WordPress core development.
VVV's config
, database
, log
and www
directories are shared with the virtualized server.
These shared directories allow you to work, for example, in vagrant-local/www/wordpress-default
in your local file system and have those changes immediately reflected in the virtualized server's file system and http://local.wordpress.dev/. Likewise, if you vagrant ssh
and make modifications to the files in /srv/www/
, you'll immediately see those changes in your local file system.
VVV as a Scaffold
Entirely different server configurations can be created by modifying the files included with VVV and through the use of additional Auto Site Setup provisioning scripts. Check this project out and use it as a base to learn about server provisioning or change everything to make it your own.
Installation - The First Vagrant Up
- Start with any local operating system such as Mac OS X, Linux, or Windows.
- For Windows 8 or higher it is recommended that you run the cmd window as Administrator
- Install VirtualBox 5.1.x
- Install Vagrant 1.8.x
vagrant
will now be available as a command in your terminal, try it out.- Note: If Vagrant is already installed, use
vagrant -v
to check the version. You may want to consider upgrading if a much older version is in use.
- Optionally, install some convenient Vagrant plugins:
- Install the vagrant-hostsupdater plugin with
vagrant plugin install vagrant-hostsupdater
- Note: This step is not a requirement, though it does make the process of starting up a virtual machine nicer by automating the entries needed in your local machine's
hosts
file to access the provisioned VVV domains in your browser. - If you choose not to install this plugin, a manual entry should be added to your local
hosts
file that looks like this:192.168.50.4 vvv.dev local.wordpress.dev src.wordpress-develop.dev build.wordpress-develop.dev
- Note: This step is not a requirement, though it does make the process of starting up a virtual machine nicer by automating the entries needed in your local machine's
- Install the vagrant-triggers plugin with
vagrant plugin install vagrant-triggers
- Note: This step is not a requirement. When installed, it allows for various scripts to fire when issuing commands such as
vagrant halt
andvagrant destroy
. - By default, if vagrant-triggers is installed, a
db_backup
script will run on halt, suspend, and destroy that backs up each database to adbname.sql
file in the{vvv}/database/backups/
directory. These will then be imported automatically if starting from scratch. Custom scripts can be added to override this default behavior. - If vagrant-triggers is not installed, VVV will not provide automated database backups.
- Note: This step is not a requirement. When installed, it allows for various scripts to fire when issuing commands such as
- Install the vagrant-vbguest plugin with
vagrant plugin install vagrant-vbguest
.- Note: This step is not a requirement. When installed, it keeps the VirtualBox Guest Additions kernel modules of your guest synchronized with the version of your host whenever you do
vagrant up
. This can prevent some subtle shared folder errors.
- Note: This step is not a requirement. When installed, it keeps the VirtualBox Guest Additions kernel modules of your guest synchronized with the version of your host whenever you do
- Install the vagrant-hostsupdater plugin with
- Clone or extract the Varying Vagrant Vagrants project into a local directory
git clone git://github.com/Varying-Vagrant-Vagrants/VVV.git vagrant-local
- OR download and extract the repository
develop
branch zip file to avagrant-local
directory on your computer. - OR download and extract a stable release zip file if you'd like some extra comfort.
- In a command prompt, change into the new directory with
cd vagrant-local
- Start the Vagrant environment with
vagrant up
- Be patient as the magic happens. This could take a while on the first run as your local machine downloads the required files.
- Watch as the script ends, as an administrator or
su
password may be required to properly modify the hosts file on your local machine.
- Visit any of the following default sites in your browser:
- http://local.wordpress.dev/ for WordPress stable
- http://src.wordpress-develop.dev/ for trunk WordPress development files
- http://build.wordpress-develop.dev/ for the version of those development files built with Grunt
- http://vvv.dev/ for a default dashboard containing several useful tools
Fancy, yeah?
What Did That Do?
The first time you run vagrant up
, a packaged box containing a basic virtual machine is downloaded to your local machine and cached for future use. The file used by Varying Vagrant Vagrants contains an installation of Ubuntu 14.04 and is about 332MB.
After this box is downloaded, it begins to boot as a sandboxed virtual machine using VirtualBox. Once booted, it runs the provisioning script included with VVV. This initiates the download and installation of around 100MB of packages on the new virtual machine.
The time for all of this to happen depends a lot on the speed of your Internet connection. If you are on a fast cable connection, it will likely only take several minutes.
On future runs of vagrant up
, the packaged box will be cached on your local machine and Vagrant will only need to apply the requested provisioning.
- Preferred: If the virtual machine has been powered off with
vagrant halt
,vagrant up
will quickly power on the machine without provisioning. - Rare: If you would like to reapply the provisioning scripts with
vagrant up --provision
orvagrant provision
, some time will be taken to check for updates and packages that have not been installed. - Very Rare: If the virtual machine has been destroyed with
vagrant destroy
, it will need to download the full 100MB of package data on the nextvagrant up
.
Now What?
Now that you're up and running, start poking around and modifying things.
- Access the server via the command line with
vagrant ssh
from yourvagrant-local
directory. You can do almost anything you would do with a standard Ubuntu installation on a full server. - Power off the box with
vagrant halt
and turn it back on withvagrant up
. - Suspend the box's state in memory with
vagrant suspend
and bring it right back withvagrant resume
. - Reapply provisioning to a running box with
vagrant provision
. - Destroy the box with
vagrant destroy
. Files added in thewww
directory will persist on the nextvagrant up
. - Start modifying and adding local files to fit your needs. Take a look at Auto Site Setup for tips on adding new projects.
Caveats
The network configuration picks an IP of 192.168.50.4. It could cause conflicts on your existing network if you are on a 192.168.50.x subnet already. You can configure any IP address in the Vagrantfile
and it will be used on the next vagrant up
VVV relies on the stability of both Vagrant and VirtualBox. These caveats are common to Vagrant environments and are worth noting:
- If the directory VVV is inside of is moved once provisioned (
vagrant-local
), it may break.- If
vagrant destroy
is used before moving, this should be fine.
- If
- If VirtualBox is uninstalled, VVV will break.
- If Vagrant is uninstalled, VVV will break.
The default memory allotment for the VVV virtual machine is 1024MB. If you would like to raise or lower this value to better match your system requirements, a guide to changing memory size is in the wiki.
Since version 1.2.0, VVV has used a 64bit version of Ubuntu. Some older CPUs (such as the popular Intel Core 2 Duo series) do not support this. Changing the line config.vm.box = "ubuntu/trusty64"
to "ubuntu/trusty32"
in the Vagrantfile
before vagrant up
will provision a 32bit version of Ubuntu that will work on older hardware.
Credentials
All database usernames and passwords for WordPress installations included by default are:
User: wp
Password: wp
All WordPress admin usernames and passwords for WordPress installations included by default are:
User: admin
Password: password
MySQL Root:
User: root
Password: root
See: Connecting to MySQL from your local machine
WordPress Stable
- LOCAL PATH: vagrant-local/www/wordpress-default
- VM PATH: /srv/www/wordpress-default
- URL:
http://local.wordpress.dev
- DB Name:
wordpress_default
WordPress Develop
- LOCAL PATH: vagrant-local/www/wordpress-develop
- VM PATH: /srv/www/wordpress-develop
- /src URL:
http://src.wordpress-develop.dev
- /build URL:
http://build.wordpress-develop.dev
- DB Name:
wordpress_develop
- DB Name:
wordpress_unit_tests
What do you get?
A bunch of stuff!
- Ubuntu 14.04 LTS (Trusty Tahr)
- WordPress Develop
- WordPress Stable
- WP-CLI (master branch)
- nginx (mainline version)
- mysql 5.5.x
- php-fpm 7.0.x
- memcached
- PHP memcache extension
- PHP xdebug extension
- PHP imagick extension
- PHPUnit
- ack-grep
- git
- subversion
- ngrep
- dos2unix
- Composer
- phpMemcachedAdmin
- phpMyAdmin (multi-language)
- Opcache Status
- Webgrind
- NodeJs
- grunt-cli
- Mailcatcher
Need Help?
- Let us have it! Don't hesitate to open a new issue on GitHub if you run into trouble or have any tips that we need to know.
- The VVV Wiki also contains documentation that may help.
Helpful Extensions
Supporting init scripts during provisioning allows for some great extensions of VVV core.
- Variable VVV automates setting up new sites, setting up deployments, and more.
- HHVVVM is an HHVM configuration for VVV.
- The WordPress Meta Environment is a "collection of scripts that provision the official WordPress.org websites into a Varying Vagrant Vagrants installation."
- [VVV Provision Flipper] (https://github.com/bradp/vvv-provision-flipper) allows for easy toggling between VVV provisioning scripts.
Custom Dashboards
The dashboard provided by VVV allows for easy replacement by looking for a www/default/dashboard-custom.php
file. The community has built several great dashboards that may be more useful than the bare info provided by default:
- @topdown's VVV Dashboard
- @leogopal's VVV Dashboard
- @stevenkword's VVV Dashboard Custom
- @goblindegook's VVV Material Dashboard
Use Git instead of Subversion for WordPress core development
By default, VVV provisions WordPress into /www/wordpress-develop/
from the WordPress Subversion repository.
If you prefer to use Git, there is a bundled script that converts to using the Git mirror.
To enable Git for core development, use vagrant ssh
to access the virtual machine and then run develop_git
. Alternatively, do this in one line with: vagrant ssh -c /srv/config/homebin/develop_git
.
Varying Vagrant Vagrants Objectives
- Provide an approachable development environment with a modern server configuration.
- Continue to work towards a stable state of software and configuration included in the default provisioning.
- Provide excellent and clear documentation throughout VVV to aid in both learning and scaffolding.
Copyright / License
VVV is copyright (c) 2014-2016, the contributors of the VVV project under the MIT License.
History
VVV has come a long way since it was first launched as Varying Vagrant Vagrants in December of 2012. Initially introduced as an exploration of workflow for immediate project needs at 10up, VVV caught speed quickly as more and more of the team was introduced. During an internal 10up developer summit in March of 2013, Vagrant as a tool was a highlight and more developers made the conversion.
In April of 2013, we made a call to the WordPress community to try to encourage the addition of Vagrant to everyday life. These efforts continued with talks at WordCamp Chicago, WordCamp Vancouver, and WordCamp Denver.
In January of 2014, 10up made the decision to spin VVV off into its own organization to better align with the community that has grown around the project over time. This transition opens doors for what Varying Vagrant Vagrants, the organization can accomplish as an ongoing project.