aboutsummaryrefslogtreecommitdiffstats
path: root/ajsc-aai/src/main/resources
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2017-02-09 15:27:43 -0500
committerSteve Smokowski <ss835w@att.com>2017-02-09 15:28:15 -0500
commit4c790f64daf7822de00405140d17e08f296a642f (patch)
tree1a608a463115640bc59260eef90a08a70c93880c /ajsc-aai/src/main/resources
parent2f3dcb75d2f658fd7af04ea908c70c5104c2b9ef (diff)
Initial OpenECOMP A&AI commit
Change-Id: I8b06519995d9dc0f220b80a6d9a71865b23e4edb Signed-off-by: Steve Smokowski <ss835w@att.com>
Diffstat (limited to 'ajsc-aai/src/main/resources')
-rw-r--r--ajsc-aai/src/main/resources/docker/Dockerfile86
-rw-r--r--ajsc-aai/src/main/resources/docker/Dockerfile.ext76
-rw-r--r--ajsc-aai/src/main/resources/docker/aai.sh42
-rw-r--r--ajsc-aai/src/main/resources/docker/commonLibs/README1
-rw-r--r--ajsc-aai/src/main/resources/docker/init-chef.sh32
-rw-r--r--ajsc-aai/src/main/resources/docker/startup.sh96
6 files changed, 333 insertions, 0 deletions
diff --git a/ajsc-aai/src/main/resources/docker/Dockerfile b/ajsc-aai/src/main/resources/docker/Dockerfile
new file mode 100644
index 0000000..16a785d
--- /dev/null
+++ b/ajsc-aai/src/main/resources/docker/Dockerfile
@@ -0,0 +1,86 @@
+FROM ubuntu:14.04
+
+ENV HTTP_PROXY ${HTTP_PROXY}
+
+RUN if [ ! -z ${HTTP_PROXY} ]; then echo "Acquire::http::proxy \"${HTTP_PROXY}\";" >> /etc/apt/apt.conf; fi
+RUN if [ ! -z ${HTTP_PROXY} ]; then echo "Acquire::https::proxy \"${HTTP_PROXY}\";" >> /etc/apt/apt.conf; fi
+
+ENV DEBIAN_FRONTEND noninteractive
+
+ENV HTTP_PROXY ${HTTP_PROXY}
+ENV HTTPS_PROXY ${HTTP_PROXY}
+ENV https_proxy ${HTTP_PROXY}
+ENV http_proxy ${HTTP_PROXY}
+
+RUN apt-get update && apt-get install -y software-properties-common
+
+# sudo -E is required to preserve the environment
+# If you remove that line, it will most like freeze at this step
+
+RUN sudo -E add-apt-repository ppa:openjdk-r/ppa && \
+ apt-get update && \
+ apt-get -qq install -y openjdk-8-jre-headless git curl ksh
+
+# Setup JAVA_HOME, this is useful for docker commandline
+ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
+
+# Install Chef
+RUN curl -LO https://packages.chef.io/stable/ubuntu/14.04/chefdk_0.17.17-1_amd64.deb
+RUN dpkg -i chefdk_0.17.17-1_amd64.deb
+RUN rm chefdk_0.17.17-1_amd64.deb
+
+# Add the application folder and common libs to /opt inside container
+# Add the chef script and startup script to docker container
+# Change the permissions to enable execute access
+
+ADD ./opt/app /opt/app
+ADD ./commonLibs/ /opt/app/commonLibs/
+
+ADD init-chef.sh /init-chef.sh
+ADD startup.sh /startup.sh
+ADD aai.sh /etc/profile.d/aai.sh
+
+RUN chmod 755 /init-chef.sh /startup.sh
+RUN chmod 644 /etc/profile.d/aai.sh
+
+# When the container is started this is the entrypoint script
+# that docker will run. Make sure this script doesn't end abruptly
+# If you want the container running even if the main application stops
+# You can run a ever lasting process like tail -f /dev/null
+# Or something like that at the end of the startup script
+# So if the main application you are planning on running fails
+# the docker container keeps on running forever
+
+ENTRYPOINT ./startup.sh
+
+# Expose the ports for outside linux to use
+# 8443 is the important one to be used
+
+EXPOSE 8443
+EXPOSE 8080
+
+# Create the directory structure of aai application resembling the development server
+# hard-coding path to match ajsc version
+
+RUN mkdir /opt/aaihome && \
+ useradd -ms /bin/bash -d /opt/aaihome/aaiadmin aaiadmin && \
+ ln -s /opt/app/${project.artifactId}/${project.version} /opt/app/aai && \
+ chown aaiadmin:aaiadmin /opt/app/aai && \
+ chown -R aaiadmin:aaiadmin /opt/app/${project.artifactId}/${project.version} && \
+ mkdir -p /opt/aai/logroot && \
+ chown -R aaiadmin:aaiadmin /opt/aai/logroot && \
+ ln -s /opt/app/aai/bin scripts && \
+ mkdir /opt/app/aai/extApps && chown -R aaiadmin:aaiadmin /opt/app/aai/extApps && \
+ find /opt/app/aai/bin -name "*.sh" -exec chmod 755 {} +
+
+WORKDIR /var/chef
+
+RUN chown aaiadmin:aaiadmin /startup.sh && \
+ chown -R aaiadmin:aaiadmin /var/chef
+
+RUN mkdir /opt/aai/logroot/AAI && chown aaiadmin:aaiadmin /opt/aai/logroot/AAI
+VOLUME /opt/aai/logroot/AAI
+
+WORKDIR /
+
+USER aaiadmin
diff --git a/ajsc-aai/src/main/resources/docker/Dockerfile.ext b/ajsc-aai/src/main/resources/docker/Dockerfile.ext
new file mode 100644
index 0000000..6beaf58
--- /dev/null
+++ b/ajsc-aai/src/main/resources/docker/Dockerfile.ext
@@ -0,0 +1,76 @@
+FROM ubuntu:14.04
+
+ENV DEBIAN_FRONTEND noninteractive
+
+RUN apt-get update && apt-get install -y software-properties-common
+
+# sudo -E is required to preserve the environment
+# If you remove that line, it will most like freeze at this step
+
+RUN sudo -E add-apt-repository ppa:openjdk-r/ppa && \
+ apt-get update && \
+ apt-get -qq install -y openjdk-8-jre-headless git curl ksh
+
+# Setup JAVA_HOME, this is useful for docker commandline
+ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64
+
+# Install Chef
+RUN curl -LO https://packages.chef.io/stable/ubuntu/14.04/chefdk_0.17.17-1_amd64.deb
+RUN dpkg -i chefdk_0.17.17-1_amd64.deb
+RUN rm chefdk_0.17.17-1_amd64.deb
+
+# Add the application folder and common libs to /opt inside container
+# Add the chef script and startup script to docker container
+# Change the permissions to enable execute access
+
+ADD ./opt/app /opt/app
+ADD ./commonLibs/ /opt/app/commonLibs/
+
+ADD init-chef.sh /init-chef.sh
+ADD startup.sh /startup.sh
+ADD aai.sh /etc/profile.d/aai.sh
+
+RUN chmod 755 /init-chef.sh /startup.sh
+RUN chmod 644 /etc/profile.d/aai.sh
+
+# When the container is started this is the entrypoint script
+# that docker will run. Make sure this script doesn't end abruptly
+# If you want the container running even if the main application stops
+# You can run a ever lasting process like tail -f /dev/null
+# Or something like that at the end of the startup script
+# So if the main application you are planning on running fails
+# the docker container keeps on running forever
+
+ENTRYPOINT ./startup.sh
+
+# Expose the ports for outside linux to use
+# 8443 is the important one to be used
+
+EXPOSE 8443
+EXPOSE 8080
+
+# Create the directory structure of aai application resembling the development server
+# hard-coding path to match ajsc version
+
+RUN mkdir /opt/aaihome && \
+ useradd -ms /bin/bash -d /opt/aaihome/aaiadmin aaiadmin && \
+ ln -s /opt/app/${project.artifactId}/${project.version} /opt/app/aai && \
+ chown aaiadmin:aaiadmin /opt/app/aai && \
+ chown -R aaiadmin:aaiadmin /opt/app/${project.artifactId}/${project.version} && \
+ mkdir -p /opt/aai/logroot && \
+ chown -R aaiadmin:aaiadmin /opt/aai/logroot && \
+ ln -s /opt/app/aai/bin scripts && \
+ mkdir /opt/app/aai/extApps && chown -R aaiadmin:aaiadmin /opt/app/aai/extApps && \
+ find /opt/app/aai/bin -name "*.sh" -exec chmod 755 {} +
+
+WORKDIR /var/chef
+
+RUN chown aaiadmin:aaiadmin /startup.sh && \
+ chown -R aaiadmin:aaiadmin /var/chef
+
+RUN mkdir /opt/aai/logroot/AAI && chown aaiadmin:aaiadmin /opt/aai/logroot/AAI
+VOLUME /opt/aai/logroot/AAI
+
+WORKDIR /
+
+USER aaiadmin
diff --git a/ajsc-aai/src/main/resources/docker/aai.sh b/ajsc-aai/src/main/resources/docker/aai.sh
new file mode 100644
index 0000000..ed93aab
--- /dev/null
+++ b/ajsc-aai/src/main/resources/docker/aai.sh
@@ -0,0 +1,42 @@
+###
+# ============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=========================================================
+###
+
+PROJECT_HOME=/opt/app/aai
+export PROJECT_HOME
+
+JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
+export JAVA_HOME
+
+AAIENV=dev
+export AAIENV
+
+PATH=/usr/lib/jvm/java-8-openjdk-amd64:$PATH
+
+PROJECT_OWNER=aaiadmin
+PROJECT_GROUP=aaiadmin
+PROJECT_UNIXHOMEROOT=/opt/aaihome
+export PROJECT_OWNER PROJECT_GROUP PROJECT_UNIXHOMEROOT
+umask 0022
+
+export idns_api_url=
+export idnscred=
+export idnstenant=
+
+
diff --git a/ajsc-aai/src/main/resources/docker/commonLibs/README b/ajsc-aai/src/main/resources/docker/commonLibs/README
new file mode 100644
index 0000000..00e36c0
--- /dev/null
+++ b/ajsc-aai/src/main/resources/docker/commonLibs/README
@@ -0,0 +1 @@
+// this file's presence ensures commonLibs folder is present when image is created \ No newline at end of file
diff --git a/ajsc-aai/src/main/resources/docker/init-chef.sh b/ajsc-aai/src/main/resources/docker/init-chef.sh
new file mode 100644
index 0000000..112b0b3
--- /dev/null
+++ b/ajsc-aai/src/main/resources/docker/init-chef.sh
@@ -0,0 +1,32 @@
+#!/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=========================================================
+###
+
+##############################################################################
+# Script to initialize the chef-repo branch and.chef
+#
+##############################################################################
+
+#echo "AAI_CHEF_ENV=${AAI_CHEF_ENV}" >> /etc/environment
+#echo "AAI_CHEF_LOC=${AAI_CHEF_LOC}" >> /etc/environment
+#touch /root/.bash_profile
+chef-solo -c /var/chef/aai-data/chef-config/dev/.knife/solo.rb -j /var/chef/aai-config/cookbooks/runlist-app-server.json -E ${AAI_CHEF_ENV}
+
diff --git a/ajsc-aai/src/main/resources/docker/startup.sh b/ajsc-aai/src/main/resources/docker/startup.sh
new file mode 100644
index 0000000..2d8ea02
--- /dev/null
+++ b/ajsc-aai/src/main/resources/docker/startup.sh
@@ -0,0 +1,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