forked from cattles/spring-cloud-event-sourcing-example
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathskaterun.sh
75 lines (59 loc) · 2.09 KB
/
skaterun.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env bash
set -e
p1=$1
if [ ! -n "$p1" ] ;then
echo "you have not input a parameter eg. test local or web!"
exit
fi
BASE_IMAGE_PREFIX=""
#HOST_IP="192.168.31.72"
if [ $p1 = "test" ] ;then
IMAGE_PREFIX="192.168.31.34/skate/"
SKATE_VERSION="latest"
WEB_IP="192.168.31.72"
elif [ $p1 = "local" ] ;then
IMAGE_PREFIX="skate/"
SKATE_VERSION="latest"
WEB_IP="192.168.31.72"
elif [ $p1 = "web" ] ;then
IMAGE_PREFIX="demoregistry.dataman-inc.com/skate/"
BASE_IMAGE_PREFIX="demoregistry.dataman-inc.com/skate/"
#��һ�д���Ҫ�ֶ��İ汾��
SKATE_VERSION=":latest"
HOST_IP="10.3.8.23"
WEB_IP="106.75.90.26"
else
echo "you have not input a parameter in 'test'\'local'\'web'"
exit
fi
# Export the active docker machine IP
HOST_IP=`ifconfig | grep 'inet'| grep -v '127.0.0.1'|grep -v '172.' | cut -d: -f2 | awk '{ print $2}'|tr -s ["\n"]|tr -d [":"] | sed '1d'`
# docker-machine doesn't exist in Linux, assign default ip if it's not set
DOCKER_IP=${HOST_IP:-192.168.31.46}
WEB_IP=${WEB_IP:-192.168.31.46}
export SKATE_VERSION DOCKER_IP WEB_IP IMAGE_PREFIX BASE_IMAGE_PREFIX
# Remove existing containers
docker-compose -f docker-compose.yml stop
docker-compose -f docker-compose.yml rm -f
# Start the config service first and wait for it to become available
docker-compose -f docker-compose.yml up -d config-service
while [ -z ${CONFIG_SERVICE_READY} ]; do
echo "Waiting for config service..."
if [ "$(curl --silent $DOCKER_IP:8888/health 2>&1 | grep -q '\"status\":\"UP\"'; echo $?)" = 0 ]; then
CONFIG_SERVICE_READY=true;
fi
sleep 2
done
# Start the discovery service next and wait
docker-compose -f docker-compose.yml up -d discovery-service
while [ -z ${DISCOVERY_SERVICE_READY} ]; do
echo "Waiting for discovery service..."
if [ "$(curl --silent $DOCKER_IP:8761/health 2>&1 | grep -q '\"status\":\"UP\"'; echo $?)" = 0 ]; then
DISCOVERY_SERVICE_READY=true;
fi
sleep 2
done
# Start the other containers
docker-compose -f docker-compose.yml up -d
# Attach to the log output of the cluster
#docker-compose -f docker-compose.yml logs