don't time out waiting for weave infrastructure containers to start
instead keep trying, until we succeed or the container dies Fixes #666.
This commit is contained in:
1 parent
52f31f0596
commit
4e68bde7b5
1 file changed
+14
-24
@@ -554,32 +554,22 @@ http_call() {
|
|||||||
http_call_ip $CONTAINER_IP "$@"
|
http_call_ip $CONTAINER_IP "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Wait until container $1 on port $2 is alive enough to respond to its status call
|
# Wait until container $1 on IP $2, port $3 is alive enough to respond
|
||||||
wait_for_status() {
|
# to its status call
|
||||||
WAIT_TIME=0
|
wait_for_status_ip() {
|
||||||
while [ $WAIT_TIME -lt 3 ] ; do
|
while true ; do
|
||||||
sleep $WAIT_TIME
|
http_call_ip $2 $3 GET /status >/dev/null && return 0
|
||||||
container_ip $1 \
|
if ! container_id $1 >/dev/null 2>&1 ; then
|
||||||
"$1 container has died." \
|
echo "$1 container has died." >&2
|
||||||
"$1 container has died." \
|
return 1
|
||||||
|| return 1
|
fi
|
||||||
http_call_ip $CONTAINER_IP $2 GET /status >/dev/null && return 0
|
sleep 1
|
||||||
WAIT_TIME=$((WAIT_TIME+1))
|
|
||||||
done
|
done
|
||||||
echo "Timed out waiting for $1 container to start." >&2
|
|
||||||
return 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Just like wait_for_status, but takes the IP instead of a container ID
|
wait_for_status() {
|
||||||
wait_for_status_ip() {
|
container_ip $1 "$1 container has died." "$1 container has died." || return 1
|
||||||
WAIT_TIME=0
|
wait_for_status_ip $1 $CONTAINER_IP $2
|
||||||
while [ $WAIT_TIME -lt 3 ]; do
|
|
||||||
sleep $WAIT_TIME
|
|
||||||
http_call_ip $1 $2 GET /status >/dev/null && return 0
|
|
||||||
WAIT_TIME=$((WAIT_TIME+1))
|
|
||||||
done
|
|
||||||
echo "Timed out waiting for container to start." >&2
|
|
||||||
return 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Call $1 for all containers, passing container ID, all MACs and all IPs
|
# Call $1 for all containers, passing container ID, all MACs and all IPs
|
||||||
@@ -888,7 +878,7 @@ case "$COMMAND" in
|
|||||||
--entrypoint=/home/weave/weaveproxy \
|
--entrypoint=/home/weave/weaveproxy \
|
||||||
$WEAVEPROXY_DOCKER_ARGS \
|
$WEAVEPROXY_DOCKER_ARGS \
|
||||||
$EXEC_IMAGE "$@")
|
$EXEC_IMAGE "$@")
|
||||||
wait_for_status_ip 127.0.0.1 $PROXY_PORT
|
wait_for_status_ip $PROXY_CONTAINER_NAME 127.0.0.1 $PROXY_PORT
|
||||||
echo $PROXY_CONTAINER
|
echo $PROXY_CONTAINER
|
||||||
;;
|
;;
|
||||||
connect)
|
connect)
|
||||||
|
|||||||
Reference in new issue
Block a user