aboutsummaryrefslogtreecommitdiffstats
path: root/ajsc-aai/src/main/resources/docker/startup.sh
blob: 2d8ea02667ef65522df0135cbfa533b33b5798f2 (plain)
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
#!/bin/bash

###
# ============LICENSE_START=======================================================
# org.openecomp.aai
# ================================================================================
# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#      http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============LICENSE_END=========================================================
###

##############################################################################
#
# AAI Startup Script
# ------------------
#
# Changes to the aai application folder
# Adds the jar files into the classpath
# Start the init chef script
# Start the hbase creation of tables script
# Then run the java ajsc aai application via com.att.ajsc.runner.Runner
#
##############################################################################

cd /opt/app/aai;
ARG=$1;

CP=$(find extJars/ lib/ -name "*.jar" | sort | uniq | tr '\n' ':');
COMMONLIBS_PATH=$(find /opt/app/commonLibs -name "*.jar" | tr '\n' ':');

JAVA_OPTS="-XX:MaxPermSize=256m -XX:MaxPermSize=256m -XX:PermSize=32m";
JAVA_OPTS+=" -Dhttps.protocols=TLSv1.1,TLSv1.2";
JAVA_OPTS+=" -DSOACLOUD_SERVICE_VERSION=0.0.1";
JAVA_OPTS+=" -Dlogback.configurationFile=$(pwd)/bundleconfig/etc/logback.xml";
if [ ! -z "${HTTP_PROXY}" ]; then
	IFS=':' read -ra NAMES <<< "$HTTP_PROXY" 
    JAVA_OPTS+=" -Dhttp.proxyHost=${NAMES[0]}:${NAMES[1]}";
    JAVA_OPTS+=" -Dhttp.proxyPort=${NAMES[2]}";
fi
JAVA_OPTS+=" -DAJSC_HOME=$(pwd)";
JAVA_OPTS+=" -DAJSC_CONF_HOME=$(pwd)/bundleconfig/";
JAVA_OPTS+=" -DAJSC_SHARED_CONFIG=$(pwd)/bundleconfig";
JAVA_OPTS+=" -Dplatform=NON-PROD";
JAVA_OPTS+=" -DPid=1306";
JAVA_OPTS+=" -Xmx512m -Xms512m";

JAVA_ARGS="context=/ port=8080 sslport=8443";

JAVA_RUN_FILE="com.att.ajsc.runner.Runner";

if [ ! -z "$ARG" ] && [ "$ARG" = "simple" ]; then
    pkill java;
    java ${JAVA_OPTS} -cp ${CP}${COMMONLIBS_PATH} ${JAVA_RUN_FILE} ${JAVA_ARGS} > /opt/aaihome/aaiadmin/log.out 2>&1 &
else

    PROTOCOL=${PROTOCOL:-https};
    GITLAB_CERTNAME=${GITLAB_CERTNAME};
    GITLAB_USERNAME=${GITLAB_USERNAME};
    GITLAB_PASSWORD=${GITLAB_PASSWORD};

    docker_giturl=${PROTOCOL}://${GITLAB_USERNAME}:${GITLAB_PASSWORD}@${GITLAB_CERTNAME}/${AAI_REPO_PATH};

    cd /var/chef/

    git clone -b ${docker_gitbranch} --single-branch ${docker_giturl}/aai-config.git && \
    git clone -b ${docker_gitbranch} --single-branch ${docker_giturl}/aai-data.git

    /init-chef.sh

    sleep 45;

    cd /opt/app/aai;

    ./bin/createDBSchema.sh;

    java ${JAVA_OPTS} -cp ${CP}${COMMONLIBS_PATH} ${JAVA_RUN_FILE} ${JAVA_ARGS} > /opt/aaihome/aaiadmin/log.out 2>&1 &

    sleep 20;

    . /etc/profile.d/aai.sh

    ./bin/install/updateQueryData.sh

    tail -f /dev/null
fi