diff options
Diffstat (limited to 'aai-traversal/src/main/swm')
11 files changed, 193 insertions, 0 deletions
diff --git a/aai-traversal/src/main/swm/package/nix/common/deinstall.env b/aai-traversal/src/main/swm/package/nix/common/deinstall.env new file mode 100644 index 0000000..fb0a9f5 --- /dev/null +++ b/aai-traversal/src/main/swm/package/nix/common/deinstall.env @@ -0,0 +1,10 @@ + +# This file is used to set the environment which the install_*.sh files +# will use when executing. Only set variables that must be derived at +# installation time here. For variables that should be set by the installer +# in SWM, add VariableDescriptor elements to the descriptor.xml. Place +# logical steps in the install_preproc.sh or install_postproc.sh. + +. `dirname $0`/common.env + +AAI_USER=aaiadmin;export AAI_USER diff --git a/aai-traversal/src/main/swm/package/nix/common/install_postproc.sh b/aai-traversal/src/main/swm/package/nix/common/install_postproc.sh new file mode 100644 index 0000000..ab5f2b7 --- /dev/null +++ b/aai-traversal/src/main/swm/package/nix/common/install_postproc.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +### +# ============LICENSE_START======================================================= +# org.onap.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========================================================= +### + +############################################################################## +# - SCLD GRM SERVICE +# - Copyright 2009 AT&T Intellectual Properties +############################################################################## + + +. `dirname $0`/install.env + +cd ${ROOT_DIR}; + +TEMPLATE_YAML_FILE=${ROOT_DIR}/docker-compose.template.yaml +YAML_FILE=${ROOT_DIR}/docker-compose.yaml + +sh ${UTILPATH}/findreplace.sh ${TEMPLATE_YAML_FILE} ${YAML_FILE} || exit 200 +rm ${TEMPLATE_YAML_FILE} + +exit 0 diff --git a/aai-traversal/src/main/swm/package/nix/deinstall/preproc/pre_proc b/aai-traversal/src/main/swm/package/nix/deinstall/preproc/pre_proc new file mode 100644 index 0000000..5f88c41 --- /dev/null +++ b/aai-traversal/src/main/swm/package/nix/deinstall/preproc/pre_proc @@ -0,0 +1,4 @@ +#!/bin/sh + +cd ../../common +exec sh -x ./deinstall_preproc.sh diff --git a/aai-traversal/src/main/swm/package/nix/dist_files/opt/app/aai-traversal/docker-compose.template.yaml b/aai-traversal/src/main/swm/package/nix/dist_files/opt/app/aai-traversal/docker-compose.template.yaml new file mode 100644 index 0000000..74ae555 --- /dev/null +++ b/aai-traversal/src/main/swm/package/nix/dist_files/opt/app/aai-traversal/docker-compose.template.yaml @@ -0,0 +1,51 @@ +# +# ============LICENSE_START======================================================= +# org.onap.aai +# ================================================================================ +# Copyright © 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========================================================= +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# + +# SCLD_ENV is for the environment context for dme2 +# AAI_CHEF_ENV is used for both dme2 properites and +# also used by chef to generate appropriate properties + +version: '2' +services: + aai-traversal: + image: __REGISTRY__/__NAMESPACE__/aai-traversal:__IMAGE_VERSION__ + network_mode: host + environment: + - LOCAL_USER_ID=__LOCAL_USER_ID__ + - LOCAL_GROUP_ID=__LOCAL_GROUP_ID__ + volumes: + - /opt/aai/logroot/AAI-GQ:/opt/aai/logroot/AAI-GQ + - /opt/app/aai-traversal/appconfig/aai-client-cert.p12:/opt/app/aai-traversal/resources/etc/auth/aai-client-cert.p12 + - /opt/app/aai-traversal/appconfig/tomcat_keystore:/opt/app/aai-traversal/resources/etc/auth/tomcat_keystore + - /opt/app/aai-traversal/appconfig/aai_policy.json:/opt/app/aai-traversal/resources/etc/auth/aai_policy.json + - /opt/app/aai-traversal/appconfig/aaiconfig.properties:/opt/app/aai-traversal/resources/etc/appprops/aaiconfig.properties + - /opt/app/aai-traversal/appconfig/application.properties:/opt/app/aai-traversal/resources/application.properties + - /opt/app/aai-traversal/appconfig/dme2.properties:/opt/app/aai-traversal/resources/dme2.properties + - /opt/app/aai-traversal/appconfig/localhost-access-logback.xml:/opt/app/aai-traversal/resources/localhost-access-logback.xml + - /opt/app/aai-traversal/appconfig/logback.xml:/opt/app/aai-traversal/resources/logback.xml + - /opt/app/aai-traversal/appconfig/titan-cached.properties:/opt/app/aai-traversal/resources/etc/appprops/titan-cached.properties + - /opt/app/aai-traversal/appconfig/titan-realtime.properties:/opt/app/aai-traversal/resources/etc/appprops/titan-realtime.properties + logging: + driver: "json-file" + options: + max-size: "30m" + max-file: "5" diff --git a/aai-traversal/src/main/swm/package/nix/dist_files/opt/app/aai-traversal/execTool.sh b/aai-traversal/src/main/swm/package/nix/dist_files/opt/app/aai-traversal/execTool.sh new file mode 100644 index 0000000..ab634c0 --- /dev/null +++ b/aai-traversal/src/main/swm/package/nix/dist_files/opt/app/aai-traversal/execTool.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +export WORKING_DIR="$( cd "$(dirname "$0")" ; pwd -P )/" + +DOCKER_COMPOSE_CMD="docker-compose -f ${WORKING_DIR}/docker-compose.yaml"; + +ARG=$1; + +if [ -z "$ARG" ]; then + echo "Error: You need to at least provide one argument which is the script to execute"; + exit 1; +fi; + +if [ "${ARG}" = "--debug" ]; then + + SCRIPT_NAME=$2; + + if [ -z "$SCRIPT_NAME" ]; then + echo "Error: You need to provide the tool name after specifying the --debug flag"; + exit 1; + fi; + + shift 2; + +else + SCRIPT_NAME=$1; + shift 1; +fi; + +CONTAINER_NAME=$(${DOCKER_COMPOSE_CMD} ps -q aai-traversal); + +if [ $? -ne 0 ]; then + echo "Error: seems like the container is not running, please run the commands to start aai-traversal"; + exit 1; +fi; + +if [ ${SCRIPT_NAME} = "putTool.sh" ]; then + + PAYLOAD_FILE=$2; + + if [ ! -z "${PAYLOAD_FILE}" ] && [ -f "${PAYLOAD_FILE}" ]; then + docker cp ${PAYLOAD_FILE} ${CONTAINER_NAME}:/tmp/$(basename ${PAYLOAD_FILE}) + fi; +fi; + +${DOCKER_COMPOSE_CMD} exec --user aaiadmin aai-traversal ls /opt/app/aai-traversal/scripts/${SCRIPT_NAME} && { + + if [ "${ARG}" = "--debug" ]; then + ${DOCKER_COMPOSE_CMD} exec --user aaiadmin aai-traversal bash -x /opt/app/aai-traversal/scripts/${SCRIPT_NAME} "$@" + else + ${DOCKER_COMPOSE_CMD} exec --user aaiadmin aai-traversal /opt/app/aai-traversal/scripts/${SCRIPT_NAME} "$@" + fi; + + exit 0; +} || { + echo "Unable to find the tool in the /opt/app/aai-traversal/scripts"; + exit 1; +} diff --git a/aai-traversal/src/main/swm/package/nix/dist_files/opt/app/aai-traversal/kill_resources.sh b/aai-traversal/src/main/swm/package/nix/dist_files/opt/app/aai-traversal/kill_resources.sh new file mode 100644 index 0000000..00855da --- /dev/null +++ b/aai-traversal/src/main/swm/package/nix/dist_files/opt/app/aai-traversal/kill_resources.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +. /etc/profile.d/aai.sh +PROJECT_HOME=/opt/app/aai-traversal + +docker-compose -f ${PROJECT_HOME}/docker-compose.yaml stop && \ + docker-compose -f ${PROJECT_HOME}/docker-compose.yaml rm -f diff --git a/aai-traversal/src/main/swm/package/nix/dist_files/opt/app/aai-traversal/start_resources.sh b/aai-traversal/src/main/swm/package/nix/dist_files/opt/app/aai-traversal/start_resources.sh new file mode 100644 index 0000000..61819d4 --- /dev/null +++ b/aai-traversal/src/main/swm/package/nix/dist_files/opt/app/aai-traversal/start_resources.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +. /etc/profile.d/aai.sh +PROJECT_HOME=/opt/app/aai-traversal + +docker-compose -f ${PROJECT_HOME}/docker-compose.yaml up -d || exit 200 diff --git a/aai-traversal/src/main/swm/package/nix/dist_files/opt/app/aai-traversal/stop_resources.sh b/aai-traversal/src/main/swm/package/nix/dist_files/opt/app/aai-traversal/stop_resources.sh new file mode 100644 index 0000000..009e597 --- /dev/null +++ b/aai-traversal/src/main/swm/package/nix/dist_files/opt/app/aai-traversal/stop_resources.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +. /etc/profile.d/aai.sh +PROJECT_HOME=/opt/app/aai-traversal + +docker-compose -f ${PROJECT_HOME}/docker-compose.yaml stop || exit 200 diff --git a/aai-traversal/src/main/swm/package/nix/initinst/postproc/post_proc b/aai-traversal/src/main/swm/package/nix/initinst/postproc/post_proc new file mode 100644 index 0000000..d017750 --- /dev/null +++ b/aai-traversal/src/main/swm/package/nix/initinst/postproc/post_proc @@ -0,0 +1,4 @@ +#!/bin/sh + +cd ../../common +exec sh -x ./install_postproc.sh diff --git a/aai-traversal/src/main/swm/package/nix/install/postproc/post_proc b/aai-traversal/src/main/swm/package/nix/install/postproc/post_proc new file mode 100644 index 0000000..d017750 --- /dev/null +++ b/aai-traversal/src/main/swm/package/nix/install/postproc/post_proc @@ -0,0 +1,4 @@ +#!/bin/sh + +cd ../../common +exec sh -x ./install_postproc.sh diff --git a/aai-traversal/src/main/swm/package/nix/install/preproc/pre_proc b/aai-traversal/src/main/swm/package/nix/install/preproc/pre_proc new file mode 100644 index 0000000..3f1b26f --- /dev/null +++ b/aai-traversal/src/main/swm/package/nix/install/preproc/pre_proc @@ -0,0 +1,4 @@ +#!/bin/sh + +cd ../../common +exec sh -x ./install_preproc.sh |