4 # Copyright 2017 ZTE Corporation.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
20 RUNHOME=`cd $DIRNAME/; pwd`
21 echo @RUNHOME@ $RUNHOME
23 echo @JAVA_HOME@ $JAVA_HOME
24 JAVA="$JAVA_HOME/bin/java"
28 JAVA_OPTS="-Xms50m -Xmx128m"
30 #JAVA_OPTS="$JAVA_OPTS -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=$port,server=y,suspend=n"
31 echo @JAVA_OPTS@ $JAVA_OPTS
33 class_path="$main_path/:$main_path/holmes-rulemgt.jar"
34 echo @class_path@ $class_path
36 if [ -z ${JDBC_USERNAME} ]; then
37 export JDBC_USERNAME=holmes
38 echo "No user name is specified for the database. Use the default value \"$JDBC_USERNAME\"."
41 if [ -z ${JDBC_PASSWORD} ]; then
42 export JDBC_PASSWORD=holmespwd
43 echo "No password is specified for the database. Use the default value \"$JDBC_PASSWORD\"."
46 if [ -z ${DB_NAME} ]; then
48 echo "No database is name is specified. Use the default value \"$DB_NAME\"."
51 sed -i "s|user:.*|user: $JDBC_USERNAME|" "$main_path/conf/rulemgt.yml"
52 sed -i "s|password:.*|password: $JDBC_PASSWORD|" "$main_path/conf/rulemgt.yml"
53 sed -i "s|url:.*|url: jdbc:postgresql://$URL_JDBC/$DB_NAME|" "$main_path/conf/rulemgt.yml"
54 sed -i "s|msbServerAddr:.*|msbServerAddr: http://$MSB_ADDR|" "$main_path/conf/rulemgt.yml"
56 export SERVICE_IP=`hostname -i`
57 echo SERVICE_IP=${SERVICE_IP}
59 if [ ! -z ${TESTING} ] && [ ${TESTING} == 1 ]; then
60 if [ ! -z ${HOST_IP} ]; then
61 export HOSTNAME=${HOST_IP}:9101
63 export HOSTNAME=${SERVICE_IP}:9101
68 if [ ! -z ${URL_JDBC} ] && [ `expr index $URL_JDBC :` != 0 ]; then
69 export DB_PORT="${URL_JDBC##*:}"
73 KEY_PATH="$main_path/conf/holmes.keystore"
77 sed -i "s|keyStorePath:.*|keyStorePath: $KEY_PATH|" "$main_path/conf/rulemgt.yml"
78 sed -i "s|keyStorePassword:.*|keyStorePassword: $KEY_PASSWORD|" "$main_path/conf/rulemgt.yml"
81 ./bin/initDB.sh $JDBC_USERNAME $JDBC_PASSWORD $DB_NAME $DB_PORT "${URL_JDBC%:*}"
84 #Register the frontend to MSB
87 nginx -c /usr/local/openresty/nginx/conf/nginx.conf
89 "$JAVA" $JAVA_OPTS -classpath "$class_path" org.onap.holmes.rulemgt.RuleActiveApp server "$main_path/conf/rulemgt.yml"