summaryrefslogtreecommitdiffstats
path: root/aai-traversal/src/main/resources/docker/docker-entrypoint.sh
diff options
context:
space:
mode:
Diffstat (limited to 'aai-traversal/src/main/resources/docker/docker-entrypoint.sh')
-rw-r--r--aai-traversal/src/main/resources/docker/docker-entrypoint.sh89
1 files changed, 63 insertions, 26 deletions
diff --git a/aai-traversal/src/main/resources/docker/docker-entrypoint.sh b/aai-traversal/src/main/resources/docker/docker-entrypoint.sh
index 0f14860..52c6bfa 100644
--- a/aai-traversal/src/main/resources/docker/docker-entrypoint.sh
+++ b/aai-traversal/src/main/resources/docker/docker-entrypoint.sh
@@ -18,39 +18,76 @@
# ============LICENSE_END=========================================================
###
-cd /var/chef;
+# Set the current path to be the application home and common libs home
+APP_HOME=$(pwd);
+COMMONLIBS_HOME="/opt/app/commonLibs";
-CHEF_CONFIG_REPO=${CHEF_CONFIG_REPO:-aai-config};
+export CHEF_CONFIG_REPO=${CHEF_CONFIG_REPO:-aai-config};
+export CHEF_GIT_URL=${CHEF_GIT_URL:-http://gerrit.onap.org/r/aai};
+export CHEF_CONFIG_GIT_URL=${CHEF_CONFIG_GIT_URL:-$CHEF_GIT_URL};
+export CHEF_DATA_GIT_URL=${CHEF_DATA_GIT_URL:-$CHEF_GIT_URL};
-CHEF_GIT_URL=${CHEF_GIT_URL:-http://nexus.onap.org/r/aai};
+USER_ID=${LOCAL_USER_ID:-9001}
-CHEF_CONFIG_GIT_URL=${CHEF_CONFIG_GIT_URL:-$CHEF_GIT_URL};
-CHEF_DATA_GIT_URL=${CHEF_DATA_GIT_URL:-$CHEF_GIT_URL};
+if [ $(cat /etc/passwd | grep aaiadmin | wc -l) -eq 0 ]; then
+ useradd --shell=/bin/bash -u ${USER_ID} -o -c "" -m aaiadmin || {
+ echo "Unable to create the user id for ${USER_ID}";
+ exit 1;
+ }
+fi;
-if [ ! -d "aai-config" ]; then
+chown -R aaiadmin:aaiadmin /opt/app /var/chef /opt/aai/logroot
- git clone --depth 1 -b ${CHEF_BRANCH} --single-branch ${CHEF_CONFIG_GIT_URL}/${CHEF_CONFIG_REPO}.git aai-config || {
- echo "Error: Unable to clone the aai-config repo with url: ${CHEF_GIT_URL}/${CHEF_CONFIG_REPO}.git";
- exit;
- }
-
- (cd aai-config/cookbooks/${project.artifactId}/ && \
- for f in $(ls); do mv $f ../; done && \
- cd ../ && rmdir ${project.artifactId});
-fi
+gosu aaiadmin ./init-chef.sh
-if [ ! -d "aai-data" ]; then
+httpPort=8086;
+httpsPort=8446;
- git clone --depth 1 -b ${CHEF_BRANCH} --single-branch ${CHEF_DATA_GIT_URL}/aai-data.git aai-data || {
- echo "Error: Unable to clone the aai-data repo with url: ${CHEF_GIT_URL}";
- exit;
- }
+cd ${APP_HOME};
-fi
+CP=${COMMONLIBS_HOME}/*;
+CP="$CP":${APP_HOME}/etc;
+CP="$CP":${APP_HOME}/lib/*;
+CP="$CP":${APP_HOME}/extJars/logback-access-1.1.7.jar;
+CP="$CP":${APP_HOME}/extJars/logback-core-1.1.7.jar;
+CP="$CP":${APP_HOME}/extJars/aai-core-${AAI_CORE_VERSION}.jar;
-chef-solo \
- -c /var/chef/aai-data/chef-config/dev/.knife/solo.rb \
- -j /var/chef/aai-config/cookbooks/runlist-${project.artifactId}.json \
- -E ${AAI_CHEF_ENV};
+# You can add additional jvm options by adding environment variable JVM_PRE_OPTS
+# If you need to add more jvm options at the end then you can use JVM_POST_OPTS
+JVM_OPTS="${JVM_PRE_OPTS} ${JVM_OPTS}";
+JVM_OPTS="${JVM_OPTS} -server -XX:NewSize=512m -XX:MaxNewSize=512m";
+JVM_OPTS="${JVM_OPTS} -XX:SurvivorRatio=8";
+JVM_OPTS="${JVM_OPTS} -XX:+DisableExplicitGC -verbose:gc -XX:+UseParNewGC";
+JVM_OPTS="${JVM_OPTS} -XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled";
+JVM_OPTS="${JVM_OPTS} -XX:+UseConcMarkSweepGC -XX:-UseBiasedLocking";
+JVM_OPTS="${JVM_OPTS} -XX:ParallelGCThreads=4";
+JVM_OPTS="${JVM_OPTS} -XX:LargePageSizeInBytes=128m ";
+JVM_OPTS="${JVM_OPTS} -XX:+PrintGCDetails -XX:+PrintGCTimeStamps";
+JVM_OPTS="${JVM_OPTS} -Xloggc:${APP_HOME}/logs/gc/graph-query_gc.log";
+JVM_OPTS="${JVM_OPTS} -XX:+HeapDumpOnOutOfMemoryError";
+JVM_OPTS="${JVM_OPTS} ${JVM_POST_OPTS}";
-java -cp ${CLASSPATH}:/opt/app/commonLibs/*:/opt/app/aai-traversal/etc:/opt/app/aai-traversal/lib/*:/opt/app/aai-traversal/extJars/logback-access-1.1.7.jar:/opt/app/aai-traversal/extJars/logback-core-1.1.7.jar:/opt/app/aai-traversal/extJars/aai-core-${AAI_CORE_VERSION}.jar -server -XX:NewSize=512m -XX:MaxNewSize=512m -XX:SurvivorRatio=8 -XX:+DisableExplicitGC -verbose:gc -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:-UseBiasedLocking -XX:ParallelGCThreads=4 -XX:LargePageSizeInBytes=128m -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Dsun.net.inetaddr.ttl=180 -XX:+HeapDumpOnOutOfMemoryError -Dhttps.protocols=TLSv1.1,TLSv1.2 -DSOACLOUD_SERVICE_VERSION=1.0.1 -DAJSC_HOME=/opt/app/aai-traversal/ -DAJSC_CONF_HOME=/opt/app/aai-traversal/bundleconfig -DAJSC_SHARED_CONFIG=/opt/app/aai-traversal/bundleconfig -DAFT_HOME=/opt/app/aai-traversal -DAAI_CORE_VERSION=${AAI_CORE_VERSION} -Daai-core.version=${AAI_CORE_VERSION} -Dlogback.configurationFile=/opt/app/aai-traversal/bundleconfig/etc/logback.xml -Xloggc:/opt/app/aai-traversal/logs/ajsc-jetty/gc/graph-query_gc.log com.att.ajsc.runner.Runner context=/ port=8086 sslport=8446
+# You can add additional java options by adding environment variable JAVA_PRE_OPTS
+# If you need to add more jvm options at the end then you can use JAVA_POST_OPTS
+JAVA_OPTS="${JAVA_PRE_OPTS} ${JAVA_OPTS}";
+JAVA_OPTS="${JAVA_OPTS} -Dsun.net.inetaddr.ttl=180";
+JAVA_OPTS="${JAVA_OPTS} -Dhttps.protocols=TLSv1.1,TLSv1.2";
+JAVA_OPTS="${JAVA_OPTS} -DSOACLOUD_SERVICE_VERSION=1.0.1";
+JAVA_OPTS="${JAVA_OPTS} -DAJSC_HOME=${APP_HOME}";
+JAVA_OPTS="${JAVA_OPTS} -DAJSC_CONF_HOME=${APP_HOME}/bundleconfig";
+JAVA_OPTS="${JAVA_OPTS} -DAJSC_SHARED_CONFIG=${APP_HOME}/bundleconfig";
+JAVA_OPTS="${JAVA_OPTS} -DAFT_HOME=${APP_HOME}";
+JAVA_OPTS="${JAVA_OPTS} -DAAI_CORE_VERSION=${AAI_CORE_VERSION}";
+JAVA_OPTS="${JAVA_OPTS} -Daai-core.version=${AAI_CORE_VERSION}";
+JAVA_OPTS="${JAVA_OPTS} -Dlogback.configurationFile=${APP_HOME}/bundleconfig/etc/logback.xml";
+JAVA_OPTS="${JAVA_OPTS} ${JAVA_POST_OPTS}";
+
+JAVA_ARGS="${JAVA_PRE_ARGS} ${JAVA_ARGS}";
+JAVA_ARGS="${JAVA_ARGS} context=/";
+JAVA_ARGS="${JAVA_ARGS} port=$httpPort";
+JAVA_ARGS="${JAVA_ARGS} sslport=$httpsPort";
+JAVA_ARGS="${JAVA_ARGS} ${JAVA_POST_ARGS}";
+
+JAVA_CMD="exec gosu aaiadmin java";
+# Run the following command as aai-admin using gosu and make that process main
+${JAVA_CMD} -cp ${CLASSPATH}:${CP} ${JVM_OPTS} ${JAVA_OPTS} com.att.ajsc.runner.Runner ${JAVA_ARGS} "$@"