Last active
December 29, 2018 14:30
-
-
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`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
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
You can also use the function (custom_vvv) from the provision script VVV uses (provision.sh).
Just create a little script for it and run it as root.