support pre deployment usage of domains plugin. fixes interface binding issue

This commit is contained in:
Michael Hobbs
2015-01-06 12:42:21 -08:00
parent 566cc15081
commit 896ce50c93
6 changed files with 36 additions and 16 deletions

View File

@@ -15,12 +15,18 @@ restart_nginx () {
case "$1" in
nginx:build-config)
APP="$2"; PORT="$3"; IP="${4:-127.0.0.1}"
[[ -z "$PORT" ]] && PORT=$(< "$DOKKU_ROOT/$APP/PORT")
APP="$2"; PORT="$3"; IP="${4}"
VHOST_PATH="$DOKKU_ROOT/$APP/VHOST"
WILDCARD_SSL="$DOKKU_ROOT/tls"
SSL="$DOKKU_ROOT/$APP/tls"
if [[ -z "$PORT" ]] && [[ -f "$DOKKU_ROOT/$APP/PORT" ]]; then
PORT=$(< "$DOKKU_ROOT/$APP/PORT")
fi
if [[ -z "$IP" ]] && [[ -f "$DOKKU_ROOT/$APP/IP" ]]; then
IP=$(< "$DOKKU_ROOT/$APP/IP")
fi
[[ -f "$DOKKU_ROOT/$APP/ENV" ]] && source $DOKKU_ROOT/$APP/ENV
if [[ ! -n "$NO_VHOST" ]]; then
@@ -67,15 +73,17 @@ EOF
# Include SSL_VHOSTS so we can redirect http to https on that hostname as well
NOSSL_SERVER_NAME=$(echo $NONSSL_VHOSTS $SSL_VHOSTS| tr '\n' ' ')
echo "-----> Creating $SCHEME nginx.conf"
echo "upstream $APP { server $IP:$PORT; }" > $DOKKU_ROOT/$APP/nginx.conf
eval "cat <<< \"$(< $NGINX_CONF)\" >> $DOKKU_ROOT/$APP/nginx.conf"
if [[ -n "$PORT" ]] && [[ -n "$IP" ]]; then
echo "-----> Creating $SCHEME nginx.conf"
echo "upstream $APP { server $IP:$PORT; }" > $DOKKU_ROOT/$APP/nginx.conf
eval "cat <<< \"$(< $NGINX_CONF)\" >> $DOKKU_ROOT/$APP/nginx.conf"
echo "-----> Running nginx-pre-reload"
pluginhook nginx-pre-reload $APP $PORT
echo "-----> Running nginx-pre-reload"
pluginhook nginx-pre-reload $APP $PORT $IP
echo " Reloading nginx"
restart_nginx
echo " Reloading nginx"
restart_nginx
fi
else
if [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
echo "-----> NO_VHOST set, deleting $APP/VHOST"