3 # ============LICENSE_START==========================================
5 # ===================================================================
6 # Copyright © 2018 AT&T Intellectual Property. All rights reserved.
7 # ===================================================================
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
19 # ============LICENSE_END============================================
20 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
27 APP_ROOT=/opt/app/$COMPONENT
31 PATH=/usr/local/openjdk-11/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
34 CLASSPATH=`echo $APP_ROOT/etc $APP_ROOT/lib/*.jar | tr ' ' ':'`
36 CONFIGMAP_ROOT=${CONFIGMAP_ROOT:-/opt/app/config}
37 CONFIGMAP_PROPS=${CONFIGMAP_PROPS:-$CONFIGMAP_ROOT/conf/dmaapbc.properties}
38 CONTAINER_CONFIG=$CONFIGMAP_ROOT/conf/buscontroller.env
39 MAIN=org.onap.dmaap.dbcapi.server.Main
45 if [ "$ID" != "$USER" ]
47 echo $COMPONENT must be started as user $USER not $ID
50 if [ "$GRP" != "$GROUP" ]
52 echo $COMPONENT must be started as group $GROUP not $GRP
60 ps -ef | grep java | grep $MAIN | sed -e 's/[^ ]* *//' -e 's/ .*//'
69 echo "Expected app root directory $APP_ROOT does not exist"
74 if [ ! -f $CONTAINER_CONFIG ]
76 echo "WARNING: Expected env file $CONTAINER_CONFIG not found. Default behaviors in effect"
77 find $CONTAINER_ROOT -type f
79 source $CONTAINER_CONFIG
82 if [ "$DMAAPBC_WAIT_TO_EXIT" != "Y" ]
84 echo "Creating $APP_ROOT/ok_to_exit so no waiting..."
85 > $APP_ROOT/ok_to_exit
87 echo "Not creating $APP_ROOT/ok_to_exit"
90 . misc/havecert.tmpl > etc/havecert
93 # These files might be better provided in kubernetes configmaps
94 # so if they are there, use them
95 if [ -f $CONFIGMAP_PROPS ]
97 PROPS=$CONFIGMAP_PROPS
99 PROPS=etc/dmaapbc.properties
100 . misc/dmaapbc.properties.tmpl > $PROPS
102 if [ ! -f config/PolicyEngineApi.properties ]
104 . misc/PolicyEngineApi.properties.tmpl > config/PolicyEngineApi.properties
120 echo No certificate file available. Cannot start
126 echo $COMPONENT already running
129 rm -f $APP_ROOT/etc/SHUTDOWN
132 #old line from Dockerfile...keep for reference only
133 FLAGS="-cp etc:lib/* -Dlog4j.configuration=etc/log4j.properties -DConfigFile=$PROPS -Dlogback.configurationFile=etc/logback.xml -Dhttps.protocols=TLSv1.2 -Dhttps.cipherSuites=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256"
134 #nohup java $FLAGS $MAIN </dev/null >/dev/null 2>&1 &
135 nohup java $FLAGS $MAIN </dev/null &
144 touch $APP_ROOT/etc/SHUTDOWN
151 echo $COMPONENT stopped
153 echo $COMPONENT not running
162 echo $COMPONENT running
164 echo $COMPONENT not running
170 if [ ! -d $CONFIGMAP_ROOT ]
172 echo $CONFIGMAP_ROOT does not exist
176 #loop on get /dmaap until we get a good response to indicate other provisioning can continue
178 while [ $rc != "200" ]
181 rc=`curl -s -o /dev/null -I -w "%{http_code}" -X GET -H "Content-Type: application/json" http://dmaap-bc:8080/webapi/dmaap`
182 echo "get dmaap response=${rc}"
187 # order is important in this next list
188 for uri in dmaap dcaeLocations mr_clusters topics feeds
192 for j in `ls ${uri}/*.json`
194 echo "POST $j to $uri"
195 rc=`curl -v -X POST -w "%{http_code}" -H "Content-Type: application/json" -d @${j} http://dmaap-bc:8080/webapi/${uri}`
225 echo "Usage: $0 { start | stop | restart }"
229 ls -l $APP_ROOT/logs/ONAP
230 echo "------------ tail -100 error.log ---------------"
231 tail -100 $APP_ROOT/logs/ONAP/error.log
232 echo "------------ tail -100 server.log ---------------"
233 tail -100 $APP_ROOT/logs/ONAP/server.log
234 echo "------------ tail -100 application.log ---------------"
235 tail -100 $APP_ROOT/logs/ONAP/application.log
237 echo "Check $APP_ROOT/ok_to_exit"
238 while [ ! -f $APP_ROOT/ok_to_exit ]
240 echo "$APP_ROOT/ok_to_exit does not exist. Sticking around for debugging..."