Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'xteam/auto-site-setup'
Conflicts: CHANGELOG.md README.md
- Loading branch information
Showing
5 changed files
with
110 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# auto-site-setup.sh | ||
# | ||
# This script is responsible for finding new sites to setup. | ||
|
||
# Kill previously symlinked Nginx configs | ||
# We can't know what sites have been removed, so we have to remove all | ||
# the configs and add them back in again. | ||
find /etc/nginx/custom-sites -name 'vvv-auto-*.conf' -exec rm {} \; | ||
|
||
# Look for Nginx vhost files, symlink them into the custom sites dir | ||
for SITE_CONFIG_FILE in $(find /srv/www -maxdepth 4 -name 'vvv-nginx.conf'); do | ||
DEST_CONFIG_FILE=${SITE_CONFIG_FILE//\/srv\/www\//} | ||
DEST_CONFIG_FILE=${DEST_CONFIG_FILE//\//\-} | ||
DEST_CONFIG_FILE=${DEST_CONFIG_FILE/%-vvv-nginx.conf/} | ||
DEST_CONFIG_FILE="vvv-auto-$DEST_CONFIG_FILE-$(md5sum <<< $SITE_CONFIG_FILE | cut -c1-32).conf" | ||
# We allow the replacement of the {vvv_path_to_folder} token with | ||
# whatever you want, allowing flexible placement of the site folder | ||
# while still having an Nginx config which works. | ||
DIR=`dirname $SITE_CONFIG_FILE` | ||
sed "s#{vvv_path_to_folder}#$DIR#" $SITE_CONFIG_FILE > /etc/nginx/custom-sites/$DEST_CONFIG_FILE | ||
done | ||
|
||
# Look for site setup scripts | ||
for SITE_CONFIG_FILE in $(find /srv/www -maxdepth 4 -name 'vvv-init.sh'); do | ||
DIR=`dirname $SITE_CONFIG_FILE` | ||
( | ||
cd $DIR | ||
bash vvv-init.sh | ||
) | ||
done; | ||
|
||
# RESTART SERVICES AGAIN | ||
# | ||
# Make sure the services we expect to be running are running. | ||
echo -e "\nRestart Nginx..." | ||
service nginx restart |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# This file contains a list of the domains supported by default | ||
# in Varying Vagrant Vagrants. Both Vagrantfile and provision.sh | ||
# parse this file for domains to add to both your host and guest | ||
# machines as the virtual machines boot. | ||
# | ||
# In addition to this file, other files named vvv-hosts can | ||
# be created with additional domain information. These will be | ||
# automatically parsed as long as they are located in subdirectories | ||
# of the www/ directory. | ||
vvv.dev | ||
local.wordpress.dev | ||
local.wordpress-trunk.dev | ||
src.wordpress-develop.dev | ||
build.wordpress-develop.dev |