This repository has been archived by the owner on Dec 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 194
/
Copy pathstartup_all.sh
116 lines (98 loc) · 3.31 KB
/
startup_all.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/bash
##
# Copyright@2017 Huawei Technologies Co., Ltd.
##
# check sk/sk
if [ -z "$AK" ]; then
if [ -e "credentials" ]; then
AK=`awk -F= '/ak=/{print $2}' credentials | tr -d '\r'`
else
echo "Cannot find ak/sk in credentials file or system environment variables"
exit 1
fi
fi
if [ -z "$SK" ]; then
if [ -e "credentials" ]; then
SK=`awk -F= '/sk=/{print $2}' credentials | tr -d '\r'`
else
echo "Cannot find ak/sk in credentials file or system environment variables"
exit 1
fi
fi
if [ -e "credentials" ]; then
CIPHER=`awk -F= '/akskCustomCipher=/{print $2}' credentials | tr -d '\r'`
PROJECT=`awk -F= '/project=/{print $2}' credentials | tr -d '\r'`
fi
#check cipher script & region project
if [ -z "$CIPHER" ]; then
CIPHER=default
fi
if [ -z "$PROJECT" ]; then
PROJECT=cn-north-1
fi
if [ -z "$SK" ] || [ -z "$AK" ]; then
echo "Cannot find ak/sk in credentials file or system environment variables"
exit 1
fi
# override ak/sk in microservice.yaml
echo "APPLICATION_ID: weathermap" >> microservice.yaml
echo "cse:" >> microservice.yaml
echo " credentials:" >> microservice.yaml
echo " accessKey: $AK" >> microservice.yaml
echo " secretKey: $SK" >> microservice.yaml
echo " akskCustomCipher: $CIPHER" >> microservice.yaml
echo " project: $PROJECT" >> microservice.yaml
if [ -e "httpproxy.properties" ]; then
PROXY_ENABLED=`awk -F= '/proxy.enabled/{print $2}' httpproxy.properties | sed 's/ //g'`
if [ "$PROXY_ENABLED" = "true" ]; then
PROXY_HOST=`awk -F= '/proxy.host/{print $2}' httpproxy.properties`
PROXY_PORT=`awk -F= '/proxy.port/{print $2}' httpproxy.properties`
PROXY_USER=`awk -F= '/proxy.user/{print $2}' httpproxy.properties`
PROXY_PASSWORD=`awk -F= '/proxy.password/{print $2}' httpproxy.properties`
#override proxy settings in microservice.yaml
echo " proxy:" >> microservice.yaml
echo " enable: $PROXY_ENABLED" >> microservice.yaml
echo " host: $PROXY_HOST" >> microservice.yaml
echo " port: $PROXY_PORT" >> microservice.yaml
echo " username: $PROXY_USER" >> microservice.yaml
echo " passwd: $PROXY_PASSWORD" >> m icroservice.yaml
mkdir -p ./weather/conf && cp httpproxy.properties ./weather/conf
mkdir -p ./weather-beta/conf && cp httpproxy.properties ./weather-beta/conf
mkdir -p ./forecast/conf && cp httpproxy.properties ./forecast/conf
else
rm -rf ./weather/conf
rm -rf ./weather-beta/conf
rm -rf ./forecast/conf
fi
fi
# cp microservice
cp microservice.yaml ./weather/
cp microservice.yaml ./weather-beta/
cp microservice.yaml ./forecast/
cp microservice.yaml ./fusionweather/
rm microservice.yaml
# ln lib with all service
if [ ! -d "./weather/lib" ]; then
ln -s ../lib weather/lib
fi
if [ ! -d "./weather-beta/lib" ]; then
ln -s ../lib weather-beta/lib
fi
if [ ! -d "./forecast/lib" ]; then
ln -s ../lib forecast/lib
fi
if [ ! -d "./fusionweather/lib" ]; then
ln -s ../lib fusionweather/lib
fi
mkdir -p ./logs
# start all services
echo "start weather"
./weather/startup.sh
echo "start weather-beta"
./weather-beta/startup.sh
echo "start forecast"
./forecast/startup.sh
echo "start fusionweather"
./fusionweather/startup.sh
echo "start weathermapweb"
./weathermapweb/startup.sh