3 # ============LICENSE_START==========================================
5 # ===================================================================
6 # Copyright © 2017 AT&T Intellectual Property. All rights reserved.
7 # Copyright © 2017 Amdocs
8 # ===================================================================
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
13 # http://www.apache.org/licenses/LICENSE-2.0
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 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
24 APP_HOME="/opt/app/champ-service"
25 GRAPH_DEPS_HOME="${APP_HOME}/graph-deps"
27 if [ -z "$CONFIG_HOME" ]; then
28 echo "CONFIG_HOME must be set in order to start up process"
32 if [ -z "$KEY_STORE_PASSWORD" ]; then
33 echo "KEY_STORE_PASSWORD must be set in order to start up process"
37 if [ -z "$SERVICE_BEANS" ]; then
38 echo "SERVICE_BEANS must be set in order to start up process"
42 for dir in $( find ${GRAPH_DEPS_HOME}/* -maxdepth 0 -type d ); do
43 CURRIMPL=$(basename $dir)
44 if [ "x$GRAPHIMPL" = "x$CURRIMPL" ]; then
45 GRAPHIMPL_DEPS="${GRAPH_DEPS_HOME}/${GRAPHIMPL}"
46 echo "Setting up graph implementation to $GRAPHIMPL"
48 SUPPORTED_GRAPHIMPL="$SUPPORTED_GRAPHIMPL $CURRIMPL"
52 if [ -z "$GRAPHIMPL_DEPS" ]; then
53 echo "Configured graph implementation '$GRAPHIMPL' is not supported. Acceptable implementations are one of: $SUPPORTED_GRAPHIMPL"
57 # Changes related to:AAI-2175
58 # Change aai champ container processes to run as non-root on the host
59 USER_ID=${LOCAL_USER_ID:-9001}
60 GROUP_ID=${LOCAL_GROUP_ID:-9001}
61 CHAMP_LOGS=/var/log/onap/AAI-CHAMP
63 if [ $(cat /etc/passwd | grep aaiadmin | wc -l) -eq 0 ]; then
65 groupadd aaiadmin -g ${GROUP_ID} || {
66 echo "Unable to create the group id for ${GROUP_ID}";
69 useradd --shell=/bin/bash -u ${USER_ID} -g ${GROUP_ID} -o -c "" -m aaiadmin || {
70 echo "Unable to create the user id for ${USER_ID}";
75 chown -R aaiadmin:aaiadmin ${MICRO_HOME}
76 chown -R aaiadmin:aaiadmin ${APP_HOME}
77 chown -R aaiadmin:aaiadmin ${CHAMP_LOGS}
79 find ${MICRO_HOME} -name "*.sh" -exec chmod +x {} +
81 gosu aaiadmin ln -s /logs $MICRO_HOME/logs
82 JAVA_CMD="exec gosu aaiadmin java";
83 PROPS="-DAPP_HOME=$APP_HOME"
84 PROPS="$PROPS -DCONFIG_HOME=$CONFIG_HOME"
85 PROPS="$PROPS -Dlogging.config=$APP_HOME/bundleconfig/etc/logback.xml"
86 PROPS="$PROPS -DKEY_STORE_PASSWORD=$KEY_STORE_PASSWORD"
88 if [ ! -z "$TRUST_STORE_PASSWORD" ]; then
89 PROPS="$PROPS -DTRUST_STORE_PASSWORD=${TRUST_STORE_PASSWORD}"
92 if [ ! -z "$TRUST_STORE_LOCATION" ]; then
93 PROPS="$PROPS -DTRUST_STORE_LOCATION=${TRUST_STORE_LOCATION}"
96 JVM_MAX_HEAP=${MAX_HEAP:-1024}
99 ${JAVA_CMD} -Xmx${JVM_MAX_HEAP}m $PROPS -Dloader.path="${GRAPHIMPL_DEPS}" -jar "${APP_HOME}/champ-service.jar"