Skip to content

Instantly share code, notes, and snippets.

@wpscholar
Last active December 29, 2018 14:30
Show Gist options
  • Save wpscholar/65e1fa5c571f4be420e6 to your computer and use it in GitHub Desktop.
Save wpscholar/65e1fa5c571f4be420e6 to your computer and use it in GitHub Desktop.
Provision a new site in VVV without having to run `vagrant reload --provision`
#!/bin/sh
# Run with `sudo bash vvv-provision.sh`
DIR=$(basename $PWD)
find /etc/nginx/custom-sites -name "vvv-auto-$DIR-*.conf" -exec rm {} \;
CONF="vvv-auto-$DIR-$(md5sum <<< vvv-nginx.conf | cut -c1-32).conf"
sed "s#{vvv_path_to_folder}#$PWD#" vvv-nginx.conf > /etc/nginx/custom-sites/"$CONF"
echo "Added nginx config file: $CONF"
@tomjn
Copy link

tomjn commented Dec 29, 2018

You don't have to reload, just run vagrant provision and it won't restart the VM

Keep in mind too that all these scripts modify the VM without VVV being awares, which is a great way to break things when VVV updates, or if vagrant destroy gets run for whatever reason. It's very difficult to recover from those scenarios, just stick to the standard VVV vvv-custom.yml config and everything should be fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment