diff options
author | Ikram Ikramullah <ikram@research.att.com> | 2018-03-14 11:37:06 -0400 |
---|---|---|
committer | Ikram Ikramullah <ikram@research.att.com> | 2018-03-16 11:28:54 -0400 |
commit | 589264e69c389524b390c2daa0dc33539e9b929b (patch) | |
tree | 9b5001e50262c3f58207a9840fd47419add2bc0a /run-dockers.sh | |
parent | e73422283d5075d038a4ac95b97d8f089431e5ff (diff) |
All compnents on Single docker image
Made changes to docker settings to make a single
image instead of multiple. Also made changes to the
run and build scripts to work on this single image.
The data component requires certs, keys and ca bundles
settings too. For this, made changes to the run script.
Also, do to this, added the feature of picking the default
values from the current directory if arguments are
not provided to the run-docker.scripts.
For example: sudo ./run-dockers.sh will run without providing
any arguments to it IF the directory from where it is run
has these files in it.
1. conductor.conf -- configuration file
2. log.conf -- log settings files
3. aai_cert.cer
4. aai_key.key
5. aai_ca_bunlde.pem (pem) file
The first two from the above have been created and provided
in the current directory (has/). However, since certs will
be different from env to env, the last three needs to be provided
either by copying in the current direcotry or as the arguments 3, 4 and 5.
The script will give a detailed message on what may be missing and
how an attempt was made to get the default files. Checkt it out by
playing with run-docker.sh file.
Finally, the build script also calls the push script now. Since
there can be no testing of this in ONAP artifcats prod BEFORE being
merged to master, we can only test the push part once merged to master.
Issue-ID: OPTFRA-123
Change-Id: I83c54c97953b71aae18166b937dd89195e705f73
Signed-off-by: Ikram Ikramullah <ikram@research.att.com>
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 + |