A script to automate creation of a new bedrock-based Wordpress site on Windows, using bedrock-ansible and Vagrant. It's aimed at someone who has none of the pre-requisites already installed, but can be used by anyone on Windows.
This PowerShell script makes use of Chocolatey to provision your Windows machine with everything you need to create a new bedrock instance. It's been tested on Windows 7 and 8.1. It is designed to be idempotent so you can run it as many times as you want.
The script needs some clean-up but it works!
Having a working git executable in your PATH is a requirement. If you don't have this, I recommend downloading GitHub for Windows, and opening the "Git Shell" shortcut that it installs.
The script installs Chocolatey and uses it to install the Windows versions of the required prerequisites:
It also uses the PowerShell module manager to import a required module:
It then pulls git projects from:
.. and splices in a gist from Andrea Brandi.
Whenever I have to set up a new open-source framework/tool (particularly on Windows), it invariably involves piecing together instructions from readme's/gists on github and/or peoples' blogs. I feel that this type of thing should live in a script! This is so:
BTW, if you're more of a yeoman type of Sir, head over to: https://github.com/paramburu/generator-bedrock
The instructions below assume the following:
c:\dev\wp-themes
you'll maintain a single bedrock-ansible
directory under this common directory. Within this bedrock-ansible
directory you'll maintain one or more local developments sites. This essentially maps to one Vagrant-managed VM.
Remember that Ansible's top level playbook (site.yml
) file defines your whole infrastructure, so you can define multiple sites and/or hosts.
Copy provision-bedrock.ps1 to your wordpress development root, e.g. c:\dev\wp themes\
or, even better:
cd "c:\dev\wp themes\" && mklink provision-bedrock.ps1 path\to\cloned\repo\provision-bedrock.ps1
or in powershell:
cd "c:\dev\wp themes\"; cmd /c mklink provision-bedrock.ps1 path\to\cloned\repo\provision-bedrock.ps1
Open a PowerShell console and type: .\provision-bedrock.ps1 project_name
, where project_name is the name of your theme.
The script will ask if you want to set a custom apt mirror. This can make it faster to update packages in the VM. Enter n
if you want to use the default 'archive.ubuntu.com'.
The script will ask you to continue, type y
if you would like to continue.
Once the script has completed, you may want to edit the following files to your preference:
See https://github.com/roots/bedrock-ansible#usage for details.
Then, navigate to _your_dev_root\projectname\bedrock-ansible and type vagrant up
Open your browser and go to 'project_name.dev/' to view your freshly created Bedrock site!
As mentioned above there's no need to maintain multiple bedrock-ansible instances (and therefore multiple VMs) unless you really need to seperate them.
You can create as many subsequent projects as you like using this script. It will not touch the bedrock-ansible
directory if it already exists.
Sure! Right now I'd love people to test this on Windows to make sure we've ironed out all the edge cases. Please open an issue with any comments/questions/problems.