diff options
Diffstat (limited to 'run-dockers.sh')
-rwxr-xr-x | run-dockers.sh | 97 |
1 files changed, 92 insertions, 5 deletions
diff --git a/run-dockers.sh b/run-dockers.sh index f8ae249..569957c 100755 --- a/run-dockers.sh +++ b/run-dockers.sh @@ -1,7 +1,94 @@ +#!/bin/bash ### example run - provide the conductor configuration file as input to the run script # ./run-dockers.sh <path-to>/conductor.conf -docker run -v $1:/usr/local/bin/conductor.conf data & -docker run -v $1:/usr/local/bin/conductor.conf controller & -docker run -p "8091:8091" -v $1:/usr/local/bin/conductor.conf api & -docker run -v $1:/usr/local/bin/conductor.conf solver & -docker run -v $1:/usr/local/bin/conductor.conf reservation & + +BUILD_ARGS="--no-cache" +ORG="onap" +VERSION="1.1.1" +STAGING="1.1.1-STAGING" +PROJECT="optf-has" +DOCKER_REPOSITORY="nexus3.onap.org:10003" +IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}" + +function print_usage { + echo Usage: + echo 1. conductor.conf file location + echo 2. log.conf file location + echo 3. AAI Certificate file location + echo 4. AAI Key file location + echo 5. AAI CA bundle file location +} + +function get_default_location(){ + [ -f "$1" ] # run the test + return $? # store the result +} + +function get_from_arguments_or_default(){ + default_name=$1 + arg_num=$2 + echo $arg_num argument $default_name file. Not provided + echo ... Trying to get using default name $default_name in current direcotry. + + get_default_location $default_name + if(($? == 0)); then + echo ... Found $default_name in the current directory using this as $arg_num argument + echo default_name is $arg_num + if (($arg_num == 1)); then + COND_CONF=$(pwd)/$default_name + elif (($arg_num == 2)); then + LOG_CONF=$(pwd)/$default_name + elif (($arg_num == 3)); then + CERT=$(pwd)/$default_name + elif (($arg_num == 4)); then + KEY=$(pwd)/$default_name + elif (($arg_num == 5)); then + BUNDLE=$(pwd)/$default_name + fi + else + echo ... Could not find $default_name in the location you are running this script from. Either provide as $arg_num argument to the script or copy as $default_name in current directory. + print_usage + exit 0; + fi +} +#conductor.conf +if [ -z "$1" ] + then + get_from_arguments_or_default 'conductor.conf' 1 +fi + +#log.conf +if [ -z "$2" ] + then + get_from_arguments_or_default 'log.conf' 2 +fi + +#aai_cert.cer +if [ -z "$3" ] + then + get_from_arguments_or_default './aai_cert.cer' 3 +fi + + +#aai_key.key +if [ -z "$4" ] + then + get_from_arguments_or_default './aai_key.key' 4 +fi + + +#aai_ca_bundle.pem +if [ -z "$5" ] + then + get_from_arguments_or_default 'aai_ca_bundle.pem' 5 +fi + +echo Value is .... $COND_CONF $LOG_FILE +echo Attempting to run multiple containers on image .... ${IMAGE_NAME} +docker login -u anonymous -p anonymous ${DOCKER_REPOSITORY} +docker run -d --name controller -v $COND_CONF:/usr/local/bin/conductor.conf -v $LOG_CONF:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-controller --config-file=/usr/local/bin/conductor.conf +docker run -d --name api -p "8091:8091" -v $COND_CONF:/usr/local/bin/conductor.conf -v $LOG_CONF:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-api --port=8091 -- --config-file=/usr/local/bin/conductor.conf +docker run -d --name solver -v $COND_CONF:/usr/local/bin/conductor.conf -v $LOG_CONF:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-solver --config-file=/usr/local/bin/conductor.conf +docker run -d --name reservation -v $COND_CONF:/usr/local/bin/conductor.conf -v $LOG_CONF:/usr/local/bin/log.conf ${IMAGE_NAME}:latest python /usr/local/bin/conductor-reservation --config-file=/usr/local/bin/conductor.conf +docker run -d --name data -v $COND_CONF:/usr/local/bin/conductor.conf -v $LOG_CONF:/usr/local/bin/log.conf -v $CERT:/usr/local/bin/aai_cert.cer -v $KEY:/usr/local/bin/aai_key.key -v $BUNDLE:/usr/local/bin/bundle.pem ${IMAGE_NAME}:latest python /usr/local/bin/conductor-data --config-file=/usr/local/bin/conductor.conf + |