Blog

How To Setup The WordPress Meta Environment Using VVV

Note: As with most software, VVV has changed a lot since this post was written. I haven’t used it for years, but you may wish to refer to Tom J Norwell’s comment.

When you are an organiser for an upcoming WordCamp, it is a good idea to have an understanding of how the WordCamp sites work before playing with a live one. The best way to do that is to set up the WordPress Meta Environment locally with VVV. Setting the environment up locally allows you to play around with the sites locally without worrying about breaking a live site or accidentally emailing subscribers with testing data.

While the documentation for VVV and the WordPress Meta Environment are good, I found they weren’t quite comprehensive enough and I ran into a couple of issues trying to set it up.

Setting up the WordPress Meta Environment with VVV

First, you’ll need to install VVV. You’ll also need to install a couple of prerequisites (Vagrant and VirtualBox). Then you can clone VVV from your console.

$ git clone https://github.com/Varying-Vagrant-Vagrants/VVV.git
view raw clone_vvv hosted with ❤ by GitHub

Then you’ll need to install the Vagrant Hostsupdater plugin so that you don’t have to play around with your hosts file to get the local URLs to work.

$ cd VVV
$ vagrant plugin install vagrant-hostsupdater
view raw hostsupdater hosted with ❤ by GitHub

The next step is the clone the WordPress Meta Environment. This will pull down files for a number of sites in the WordPress network.

$ git clone https://github.com/WordPress/meta-environment.git www/WordPress-meta-environment

Now that the files have been pulled down, the databases for the different sites need to be copied into the backups folder. This is so Vagrant will populate the databases when it provisions.

$ cp www/WordPress-meta-environment/buddypressorg.dev/provision/buddypressorg_dev.sql database/backups/
$ cp www/WordPress-meta-environment/jobs.wordpressnet.dev/provision/jobs_wordpressnet_dev.sql database/backups/
$ cp www/WordPress-meta-environment/wordcamp.dev/provision/wordcamp_dev.sql database/backups/
$ cp www/WordPress-meta-environment/wordpressorg.dev/provision/wordpressorg_dev.sql database/backups/
$ cp www/WordPress-meta-environment/wordpresstv.dev/provision/wordpresstv_dev.sql database/backups/
view raw copy_databases hosted with ❤ by GitHub

The database files copied over above don’t include commands to actually create the databases, and will fail if it tries to populate databases that don’t exist (see issue #36). Save this file into the database folder, which will also run on provision.

CREATE DATABASE IF NOT EXISTS `buddypressorg_dev`;
GRANT ALL PRIVILEGES ON `buddypressorg_dev`.* TO 'wp'@'localhost' IDENTIFIED BY 'wp';
CREATE DATABASE IF NOT EXISTS `jobs_wordpressnet_dev`;
GRANT ALL PRIVILEGES ON `jobs_wordpressnet_dev`.* TO 'wp'@'localhost' IDENTIFIED BY 'wp';
CREATE DATABASE IF NOT EXISTS `wordpressorg_dev`;
GRANT ALL PRIVILEGES ON `wordpressorg_dev`.* TO 'wp'@'localhost' IDENTIFIED BY 'wp';
CREATE DATABASE IF NOT EXISTS `wordcamp_dev`;
GRANT ALL PRIVILEGES ON `wordcamp_dev`.* TO 'wp'@'localhost' IDENTIFIED BY 'wp';
CREATE DATABASE IF NOT EXISTS `wordpresstv_dev`;
GRANT ALL PRIVILEGES ON `wordpresstv_dev`.* TO 'wp'@'localhost' IDENTIFIED BY 'wp';
view raw init-custom.sql hosted with ❤ by GitHub

Now that everything has been set up, we can boot up our virtual machine.

$ vagrant up –provision
view raw provision hosted with ❤ by GitHub

Provisioning will take quite a while. For me it took well over an hour the first time provisioning VVV.

Once that has completed visit http://wp-meta.dev/ to view a list of all the available WordPress meta sites.

Creating A New WordCamp Site

By default, the meta environment includes central.wordcamp.org and 2014.seattle.wordcamp.org. If you want to add a new WordCamp site, make sure to add the address to the WordCamp hosts file (in my case, 2017.brisbane.wordcamp.dev). If Vagrant is already running you’ll then need to run $ vagrant reload for the change to the hosts file to apply.

Hopefully this guide can help others avoid the issues I ran into when I first attempted to set up VVV and the WordPress Meta Environment.

Did you find this post useful?

YesNo