diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index d1acee7933..69c4738e61 100755 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -39,6 +39,17 @@ while true; do --no-probe|--probe-only) touch /etc/service/probe/down ;; + --weave.hostname*) + if echo "$1" | grep "=" 1>/dev/null; then + ARG_VALUE=$(echo "$1" | sed 's/\-\-weave.hostname=\(.*\)/\1/') + else + [ $# -gt 1 ] || usage + ARG_VALUE="$2" + shift + fi + PROBE_ARGS="$PROBE_ARGS -weave.hostname=$ARG_VALUE" + APP_ARGS="$APP_ARGS -weave.hostname=$ARG_VALUE" + ;; --probe.*) if echo "$1" | grep "=" 1>/dev/null; then ARG_NAME=$(echo "$1" | sed 's/\-\-probe\.\([^=]*\)=\(.*\)/\1/') diff --git a/integration/210_clustering_custom_hostname_2_test.sh b/integration/210_clustering_custom_hostname_2_test.sh new file mode 100755 index 0000000000..765094d905 --- /dev/null +++ b/integration/210_clustering_custom_hostname_2_test.sh @@ -0,0 +1,29 @@ +#! /bin/bash + +. ./config.sh + +start_suite "Launch 2 scopes and check they cluster automatically, with custom weave domain" + +weave_on $HOST1 launch --dns-domain foo.local $HOST1 $HOST2 +weave_on $HOST2 launch --dns-domain foo.local $HOST1 $HOST2 + +scope_on $HOST1 launch --weave.hostname=bar.foo.local +scope_on $HOST2 launch --weave.hostname bar.foo.local + +docker_on $HOST1 run -dit --name db1 peterbourgon/tns-db +docker_on $HOST2 run -dit --name db2 peterbourgon/tns-db + +sleep 30 # need to allow the scopes to poll dns, resolve the other app ids, and send them reports + +check() { + has_container $1 weave 2 + has_container $1 weaveproxy 2 + has_container $1 weavescope 2 + has_container $1 db1 + has_container $1 db2 +} + +check $HOST1 +check $HOST2 + +scope_end_suite