Skip to content

Varying Vagrant Vagrants is an evolving Vagrant configuration focused on WordPress development.

Notifications You must be signed in to change notification settings

tanshio/VVV-small

 
 

Repository files navigation

Varying Vagrant Vagrants

Varying Vagrant Vagrants is an evolving Vagrant configuration focused on WordPress development.

VVV is a 10up creation and transitioned to a community organization in 2014.

Overview

The Purpose of Varying Vagrant Vagrants

The primary goal of Varying Vagrant Vagrants (VVV) is to provide an approachable development environment that matches a typical production environment.

The default server configuration provisioned by VVV matches a common configuration for working with high traffic WordPress sites.

The default WordPress configurations provided by VVV create an environment 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.

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 containing everything needed to develop a WordPress theme or plugin. 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 the www/wordpress-default or www/wordpress-trunk directories to develop themes.
  • Use wp-content/plugins in either the www/wordpress-default or www/wordpress-trunk directories to develop plugins.
  • Take advantage of VVV's auto site configuration to provision additional instances of WordPress in www/.
  • 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 https://local.wordpress.dev/. Likewise, if you vagrant ssh and make modifications to the files in /svr/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.

The First Vagrant Up

  1. Start with any local operating system such as Mac OS X, Linux, or Windows.
  2. Install VirtualBox 4.3.x
  3. Install Vagrant 1.6.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.
  4. 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 local.wordpress-trunk.dev src.wordpress-develop.dev build.wordpress-develop.dev
  5. Install the vagrant-triggers plugin with vagrant plugin install vagrant-triggers
    • Note: This step is not a requirement. It does allow for various scripts to fire when issuing commands such as vagrant halt and vagrant 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 a dbname.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.
  6. Clone or extract the Varying Vagrant Vagrants project into a local directory
    • git clone git:https://github.com/Varying-Vagrant-Vagrants/VVV.git vagrant-local
    • OR download and extract the repository master zip file to a vagrant-local directory on your computer.
    • OR download and extract a stable release zip file if you'd like some extra comfort.
  7. In a command prompt, change into the new directory with cd vagrant-local
  8. 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.
  9. Visit any of the following default sites in your browser:

Fancy, yeah?

What Did That Do?