Update example app to include a loadbalancer.

This commit is contained in:
Tom Wilkie
2015-09-04 13:07:29 +00:00
parent 1c21feac07
commit 6e7a22ecae
7 changed files with 52 additions and 22 deletions
+13 -10
View File
@@ -2,24 +2,27 @@
set -eux
REPLICAS=${REPLICAS:-1}
eval $(weave env)
start_container() {
IMAGE=$1
BASENAME=${2:-$1}
IMAGE=$2
BASENAME=$3
REPLICAS=$1
shift 3
HOSTNAME=$BASENAME.weave.local
for i in $(seq $REPLICAS); do
if docker inspect $BASENAME$i >/dev/null 2>&1; then
docker rm -f $BASENAME$i
fi
weave run --with-dns --name=$BASENAME$i --hostname=$HOSTNAME $IMAGE
docker run -d --name=$BASENAME$i --hostname=$HOSTNAME $@ $IMAGE
done
}
start_container elasticsearch
start_container tomwilkie/searchapp searchapp
start_container redis
start_container tomwilkie/qotd qotd
start_container tomwilkie/app app
start_container tomwilkie/client client
start_container 1 elasticsearch elasticsearch
start_container 2 tomwilkie/searchapp searchapp
start_container 1 redis redis
start_container 1 tomwilkie/qotd qotd
start_container 2 tomwilkie/app app
start_container 2 tomwilkie/frontend frontend --add-host=dns.weave.local:$(weave docker-bridge-ip)
start_container 1 tomwilkie/client client