If you’re using Varying Vagrant Vagrants for WordPress development, the VVV Site Wizard, created by Alison Barrett, is a must-have tool for setting up new sites and deleting old ones. It’s a bash script that completely automates the otherwise lengthy process of adding a new site to VVV.
If you already have VVV up and running on your machine, download the wizard script:
git clone https://github.com/aliso/vvv-site-wizard.git
You can run ./vvv from the directory where you placed the script, but if you want to run it from any directory and not have to enter the path to VVV every time, you can edit the vvv root in the vvv-site-wizard/vvv script. Uncomment the line that begins with path= and add the path to your VVV setup. You’ll find it at the very top of the file:
You may also need to edit your bashrc file to make sure you can run vvv from a folder included in your PATH environment variable. Save and refesh your terminal and you should be good to launch your new site wizard.
The script’s Github homepage includes a list of options available for the vvv command, including site creation and teardown, setting the domain and site name, whether or not to provision vagrant or just create the site directory/files, path, the WordPress version to install, and the option to turn on WP_DEBUG and WP_DEBUG_LOG.
However, none of these options are required. If there’s a required piece of information missing from your original command, the script, in true wizard fashion, will prompt you for it, as shown below:
Once you proceed, the wizard will go about doing all the work of creating your new development site, including setting up the file in the nginx-config folder and creating the vvv-init.sh, wp-cli.yml, and vvv-hosts files. You’ll get a success message when it’s finished:
You can now visit your new development site in your favorite browser. Thank the wizard and get back to work! If you want to delete a site, running the teardown command (vvv -a delete mysite) will remove everything the wizard created, with the exception of the site’s database.
Alison’s VVV site wizard makes the process of adding a new site to VVV a very simple task. Prior to going to work with 10up, I was using MAMP and manually creating v-hosts (a way to avoid buying MAMP Pro). The process Alison has in place is as easy as a one line command and answering yes. This is definitely a win for anyone using VVV.