WordPress logo

WordPress Workflow with VVV & Variable VVV

Lately I have been looking at WordPress theme design and I came across Varying Vagrant Vagrants (VVV). Despite the rather strange tongue-twister of a name this is a neat environment for developing with WordPress. Up to this point I have been doing my WordPress development using XAMPP as a local server but it appears that this is now rather an old hat way of doing things. Apparently, those in the ‘know’ use the likes of VVV for the many added benefits it brings. However when researching how to go about implementing VVV on Windows 10 I couldn’t find all the information in a single place. Therefore I’ve put this post together for anybody else for which this is new territory, though I might add its raison d’etre is that these days I tend to forget things rather more quickly than I would like and so this post serves as a crib-sheet more than anything else, but if it saves any head scratching for others than that’s just a bonus. In this first post I will cover the installation of the prerequisite software and in subsequent posts I will detail how to use VVV and associated tools. Note that the following is specifically for Windows but it is a similar procedure for other OS.

So, what exactly is Vagrant and VVV and how will it help you develop WP themes and plugins more efficiently? The benefits of using Vagrant as a developer, is that it will isolate dependencies and their configuration within a single disposable, consistent environment. While VVV allows you to run many different sites on one VVV configuration. It’s a great environment to develop themes and plugins on, and it makes contributing to WordPress core easier.  VVV installs a lot of components. git, composer, wp-cli, grunt-cli, nodeJs and a lot of other tools to help you work faster and smarter. It  also includes a lot of debugging and profiling tools:  Webgrind, Opcache Status and Xdebug, it also uses nginx by default.

The prerequisite software required to run VVV is VirtualBox (other VM software also supported, such as VMWare Fusion  or Hyper-V) to provide a VM sandboxed from your local environment and Vagrant, which is a tool for building and distributing development environments. Start off by installing VirtualBox first and then Vagrant .  Installation is straightforward, just follow the install prompts. Check that everything installed correctly by running vagrant –v from the command line which will show the version number.

You may also want to install the vagrant-hostsupdater plugin at this point. This will make things easier by adding the necessary redirects to your hosts file, otherwise you will need to manually add these. This plugin updates your hosts file when you execute vagrant up, reload and resume.

  • vagrant plugin install vagrant-hostsupdater

Next install Varying Vagrant Vagrants by cloning into a directory named vagrant-local, i.e. c:/vagrant-local/:

  • git clone git://github.com/Varying-Vagrant-Vagrants/VVV.git vagrant-local

Finally, install Variable VVV, which is a site wizard that makes it easy to create, delete, and list your WordPress sites. It also supports site creation with different options via site blueprints – a great time saver.

  • git clone https://github.com/bradp/vv.git

Once installed you now need to add this directory to your PATH variable. In Windows 10 the quickest way to do this:

Right click start menu –>System->Advanced->System Settings->Environment Variables->Edit path variable.

Just to recap we installed the required software in this order:

  1. VirtualBox into default install directory
  2. Vagrant into default install directory
  3. Vagrant-hostupdater plugin (optional)
  4. Vagrant-triggers plugin (optional  – see https://github.com/emyl/vagrant-triggers)
  5. Varying-Vagrant-Vagrants (VVV) into c:\vagrant-local
  6. Variable VVV into c:\vv
  7. Added c:\vv to the PATH variable

We are now ready to fire up all the software and start flexing it – in a command prompt cd into c:/vagrant-local and start the Vagrant environment with vagrant up.
This initial vagrant up may take quite a while to do its stuff as it has to download all the required files – subsequent runs should be considerably quicker. You may see a few warnings that the remote connection is not connected, this is normal. However, should the operation time-out after several warnings and Vagrant is not able to connect to the virtual machine then you may need to check that you have Intel virtualization enabled in your BIOS/UEFI settings. This was the case on both PCs that I installed this software on. You may also see a warning to this effect in the Preview windows of the VirtualBox Manager. Another reason being that these programs are running under different privilege levels – it may be that the ‘hosts’ file requires admin privileges. This can readily be checked by opening them as an ‘administrator’ if you trust the software.

image

You can check the status at any time with the command vagrant status or halt it with vagrant halt

Now open up a browser and navigate to vvv.dev* and if everything is working you will see all the default sites listed.

image

In subsequent posts I will be using Variable VVV to create and delete sites; adding a blueprint for creating new sites and exploring WP-CLI. Oh, and just to make life a little bit easier still we will add a VVV dashboard .

*It appears that Google have snaffled the .dev gTLD for themselves so this will change at some point. ‘Do no evil ‘– yea, right!

facebooktwittergoogle_plusredditpinterestlinkedinmail