diff options
Diffstat (limited to 'aai-traversal/src/main/swm/package/nix/dist_files/opt/app')
5 files changed, 128 insertions, 0 deletions
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 |