This is a 4 part reference guide to getting started with Vagrant, VVV and WordPress.
This is Part 3 – Adding Multiple Sites Natively and with Variable VVV
Vagrant and WordPress Local Development – Spinning up WordPress sites natively and using Variable VVV
As well as these default sites, you can use a script to power up any number of additional WordPress sites either provisioning them natively and using Variable VVV – The Best VVV Site.
Provisioning additional WordPress sites natively
In your VVV install is a configuration file called vvv-config.yml this is the file that has the config for the 3 default sites loaded with VVV as outlined above.
To make additional sites copy the file and rename it vvv-custom.yml, that way when you update your version of VVV you won’t lose your new settings for additional sites as the original vvv-config.yml file will be overwritten.
--- sites: # The wordpress-default configuration provides a default installation of the # latest version of WordPress. wordpress-default: repo: https://github.com/Varying-Vagrant-Vagrants/vvv-wordpress-default.git hosts: - local.wordpress.dev
Looking at one of the default sites will indicate how to format the new additional sites which have to be added under the sites: section, give the site a name to identify, a repo to pull the WordPress install and a host url. Follow the .yml 2 space indentation to avoid syntax errors.
So for example to create a new site called test.dev you could add under the sites section…
test: repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template hosts: - test.dev
This is creating a site but with a custom WordPress site repo link provided by VVV, you can add your own repo.
When you have made changes do a provision for them to take affect…
vagrant reload --provision
Now you will have a working new WordPress site at test.dev
Variable VVV – The Best VVV Site Wizard
Variable VVV – The Best VVV Site Wizard is a development that make the process of adding additional WordPress sites to your VVV set up very easy.
Install Variable VVV
Either download the zip and expand and move it into your Vagrant folder or clone it in…
git clone https://github.com/bradp/vv.git
You can also install via Homebrew
brew install bradp/vv/vv
This will add the vv directory and the all important set up script file is inside named vv – if you didn’t go the HomeBrew install way, it’s best to add the vv directory to your path so you can easily run the vv script.
Running Variable VVV
Run the vv script from your vv folder, in the screen shot below, the vagrant directory is vagrant-wordpress and the new site is redtest.dev
With the new VVV2 vvv-custom.yml file for additional sites, you also need to add the new site identity in that file so VVV knows about it – this requirement may change in the next version of Variable VVV but for now you would also have to add in vvv-custom.yml for example…
redtest: hosts: - redtest.dev
Then continue on with the vv commands.
Run the script and answer the wizard prompts for the initial VVV install directory, directory name, domain name, WP version, Multi-Site, Git Repo, Sample content and debug variables – then the new site will be created and you will be given the config details at the end of the command including the WP Admin login.
You may need to make a cup of tea while it does it’s thing. The reason for the time is called ‘provisioning’ in vagrant VVV speak, once you are comfortable with the process you can investigate VVV Provision Flipper, which is another tool by the same author that allows very fast site provisioning by swapping the site creation script to a more bare bones one.
That’s it the site is now available locally and has a default login of admin/password.
Variable VVV is a fork of VVV Site Wizard and has built further functionality in like blueprints which allow you to set up sites with default plugins and themes – more info on that is available on the projects GitHub page.