blob: 1dedb25868482c4ede87ea785ecfd1342bd0aeed [file] [log] [blame]
Blimkie, Steven (sb787e)9d2e5832017-05-17 17:45:08 +03001#!/bin/sh
Blackwell, Ian (ib733q)7b1f8132018-04-03 17:28:44 +01002#*******************************************************************************
3# ============LICENSE_START==========================================
4# org.onap.aai
5# ===================================================================
6# Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
mark.j.leonard6e4f04a2018-04-26 16:53:12 +01007# Copyright © 2017-2018 European Software Marketing Ltd.
Blackwell, Ian (ib733q)7b1f8132018-04-03 17:28:44 +01008# ===================================================================
9# Licensed under the Apache License, Version 2.0 (the "License");
10# you may not use this file except in compliance with the License.
11# You may obtain a copy of the License at
12#
13# http://www.apache.org/licenses/LICENSE-2.0
14#
15# Unless required by applicable law or agreed to in writing, software
16# distributed under the License is distributed on an "AS IS" BASIS,
17# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18# See the License for the specific language governing permissions and
19# limitations under the License.
20# ============LICENSE_END============================================
21#*******************************************************************************
Blimkie, Steven (sb787e)9d2e5832017-05-17 17:45:08 +030022
Dmitry Puzikov89d3d252019-04-16 16:52:05 +020023# jre-alpine image has $JAVA_HOME set and added to $PATH
24# ubuntu image requires to set $JAVA_HOME and add java to $PATH manually
25if ( uname -v | grep -i "ubuntu" ); then
26 export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-`dpkg --print-architecture | awk -F- '{ print $NF }'`
27 export PATH=${JAVA_HOME}:$PATH
28fi
29
mark.j.leonard6e4f04a2018-04-26 16:53:12 +010030# AJSC_HOME is required for EELF logging.
31# This path is referenced in the file logback.xml.
32AJSC_HOME="${AJSC_HOME-/opt/app/model-loader}"
Blimkie, Steven (sb787e)9d2e5832017-05-17 17:45:08 +030033
34if [ -z "$CONFIG_HOME" ]; then
mark.j.leonard6e4f04a2018-04-26 16:53:12 +010035 echo "CONFIG_HOME must be set in order to start up the process"
36 echo "The expected value is a folder containing the model-loader.properties file"
37 exit 1
Blimkie, Steven (sb787e)9d2e5832017-05-17 17:45:08 +030038fi
39
mark.j.leonard6e4f04a2018-04-26 16:53:12 +010040# Some properties are repeated here for debugging purposes.
Blimkie, Steven (sb787e)9d2e5832017-05-17 17:45:08 +030041PROPS="-DAJSC_HOME=$AJSC_HOME"
Blimkie, Steven (sb787e)9d2e5832017-05-17 17:45:08 +030042PROPS="$PROPS -DCONFIG_HOME=$CONFIG_HOME"
mark.j.leonard6e4f04a2018-04-26 16:53:12 +010043PROPS="$PROPS -Dcom.att.eelf.logging.path=$AJSC_HOME"
44PROPS="$PROPS -Dcom.att.eelf.logging.file=logback.xml"
45PROPS="$PROPS -Dlogback.configurationFile=$AJSC_HOME/logback.xml"
46PROPS="$PROPS -Dserver.port=9500"
abatos0cecd0b2017-06-09 09:36:30 -040047JVM_MAX_HEAP=${MAX_HEAP:-1024}
Blimkie, Steven (sb787e)9d2e5832017-05-17 17:45:08 +030048
mark.j.leonard6e4f04a2018-04-26 16:53:12 +010049if [ -z "${java_runtime_arguments}" ]; then
50 java_runtime_arguments="-Xms75m -Xmx${JVM_MAX_HEAP}m \
51 -Dcom.sun.management.jmxremote \
52 -Dcom.sun.management.jmxremote.authenticate=false \
53 -Dcom.sun.management.jmxremote.ssl=false \
54 -Dcom.sun.management.jmxremote.local.only=false \
55 -Dcom.sun.management.jmxremote.port=1099 \
56 -Dcom.sun.management.jmxremote.rmi.port=1099 \
57 -Djava.rmi.server.hostname=127.0.0.1"
58fi
Blimkie, Steven (sb787e)9d2e5832017-05-17 17:45:08 +030059
Dmitry Puzikov89d3d252019-04-16 16:52:05 +020060JARFILE=$(ls ./model-loader*.jar);
61
mark.j.leonard6e4f04a2018-04-26 16:53:12 +010062echo "java $java_runtime_arguments $PROPS -jar $JARFILE"
63java $java_runtime_arguments $PROPS -jar $JARFILE