disable VHOST deployment if global VHOST file is missing

This commit is contained in:
Michael Hobbs committed 2015-01-08 15:58:08 -08:00
1 parent 4abccf0119
commit da465a61dd
4 files changed
+7 -11

No files matched your search

+1 -1
View File
@@ -141,7 +141,7 @@ dokku domains:remove myapp example.com
> New as of 0.3.13 > New as of 0.3.13
The deployed docker container running your app's web process will bind to either the internal docker network interface (i.e. `docker inspect --format '{{ .NetworkSettings.IPAddress }}' $CONTAINER_ID`) or an external interface (i.e. 0.0.0.0) depending on dokku's VHOST configuration. Dokku will attempt to bind to the internal docker network interface unless you specifically set NO_VHOST for the given app or your dokku installation is not setup to use VHOSTS (i.e. $DOKKU_ROOT/VHOST or $DOKKU_ROOT/HOSTNAME is set to an IPv4 or IPv6 address) The deployed docker container running your app's web process will bind to either the internal docker network interface (i.e. `docker inspect --format '{{ .NetworkSettings.IPAddress }}' $CONTAINER_ID`) or an external interface (i.e. 0.0.0.0) depending on dokku's VHOST configuration. Dokku will attempt to bind to the internal docker network interface unless you specifically set NO_VHOST for the given app or your dokku installation is not setup to use VHOSTS (i.e. $DOKKU_ROOT/VHOST is missing or $DOKKU_ROOT/HOSTNAME is set to an IPv4 or IPv6 address)
```shell ```shell
# container bound to docker interface # container bound to docker interface
+2 -2
View File
@@ -38,8 +38,8 @@ case "$1" in
else else
VHOST=$(< "$DOKKU_ROOT/HOSTNAME") VHOST=$(< "$DOKKU_ROOT/HOSTNAME")
fi fi
if [[ "$VHOST" =~ $RE_IPV4 ]] || [[ "$VHOST" =~ $RE_IPV6 ]];then if [[ "$VHOST" =~ $RE_IPV4 ]] || [[ "$VHOST" =~ $RE_IPV6 ]] || [[ ! -f "$DOKKU_ROOT/VHOST" ]];then
echo "ip found as hostname. disabling vhost support" echo "unsupported vhost config found. disabling vhost support"
[[ ! $(grep -q NO_VHOST "$DOKKU_ROOT/$APP/ENV") ]] && echo "export NO_VHOST='1'" >> "$DOKKU_ROOT/$APP/ENV" [[ ! $(grep -q NO_VHOST "$DOKKU_ROOT/$APP/ENV") ]] && echo "export NO_VHOST='1'" >> "$DOKKU_ROOT/$APP/ENV"
else else
echo "-----> Creating new $VHOST_PATH..." echo "-----> Creating new $VHOST_PATH..."
+3 -7
View File
@@ -19,14 +19,10 @@ RE_IPV6="${RE_IPV6}fe08:(:[0-9a-fA-F]{1,4}){2,2}%[0-9a-zA-Z]{1,}|" # TEST: f
RE_IPV6="${RE_IPV6}::(ffff(:0{1,4}){0,1}:){0,1}${RE_IPV4}|" # TEST: ::255.255.255.255 ::ffff:255.255.255.255 ::ffff:0:255.255.255.255 (IPv4-mapped IPv6 addresses and IPv4-translated addresses) RE_IPV6="${RE_IPV6}::(ffff(:0{1,4}){0,1}:){0,1}${RE_IPV4}|" # TEST: ::255.255.255.255 ::ffff:255.255.255.255 ::ffff:0:255.255.255.255 (IPv4-mapped IPv6 addresses and IPv4-translated addresses)
RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}:${RE_IPV4}" # TEST: 2001:db8:3:4::192.0.2.33 64:ff9b::192.0.2.33 RE_IPV6="${RE_IPV6}([0-9a-fA-F]{1,4}:){1,4}:${RE_IPV4}" # TEST: 2001:db8:3:4::192.0.2.33 64:ff9b::192.0.2.33
if [[ -f "$DOKKU_ROOT/VHOST" ]];then [[ -f "$DOKKU_ROOT/VHOST" ]] && GLOBAL_VHOST=$(< "$DOKKU_ROOT/VHOST")
GLOBAL_VHOST=$(< "$DOKKU_ROOT/VHOST")
else
GLOBAL_VHOST=$(< "$DOKKU_ROOT/HOSTNAME")
fi
if [[ -n "$NO_VHOST" ]]; then if [[ -n "$NO_VHOST" ]] || [[ -z "$GLOBAL_VHOST" ]]; then
echo true # bind to external ip. VHOST is disabled for this app echo true # bind to external ip. VHOST is disabled
elif [[ "$GLOBAL_VHOST" =~ $RE_IPV4 ]] || [[ "$GLOBAL_VHOST" =~ $RE_IPV6 ]]; then elif [[ "$GLOBAL_VHOST" =~ $RE_IPV4 ]] || [[ "$GLOBAL_VHOST" =~ $RE_IPV6 ]]; then
echo true # bind to external ip. GLOBAL_VHOST is somehow an IPv4 or IPv6 address echo true # bind to external ip. GLOBAL_VHOST is somehow an IPv4 or IPv6 address
elif [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then elif [[ -f "$DOKKU_ROOT/$APP/VHOST" ]]; then
+1 -1
View File
@@ -32,7 +32,7 @@ teardown() {
run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'" run bash -c "docker port $CONTAINER_ID | sed 's/[0-9.]*://' | egrep '[0-9]*'"
echo "output: "$output echo "output: "$output
echo "status: "$status echo "status: "$status
assert_failure assert_success
} }
@test "port exposure (with NO_VHOST set)" { @test "port exposure (with NO_VHOST set)" {