summaryrefslogtreecommitdiffstats
path: root/osdfapp.sh
diff options
context:
space:
mode:
authorvrvarma <vikas.varma@att.com>2020-03-03 22:22:28 -0500
committervrvarma <vikas.varma@att.com>2020-03-04 20:55:57 -0500
commitde5fdaafad9fccba0b9a7f308d72f26816dd1a0f (patch)
treee8e683e21002c20f3d743375d742bf0819d82409 /osdfapp.sh
parent7d4f37c45d50c56dfe438c04dbecea3ca9f7c9d2 (diff)
Adding the generic solver code
Add docker file for optim engine Run pods as a non-root user Fix docker tag script Change-Id: If25fe66b839a70e83e35292031a2da012e81fe47 Signed-off-by: vrvarma <vikas.varma@att.com> Issue-ID: OPTFRA-712
Diffstat (limited to 'osdfapp.sh')
-rwxr-xr-xosdfapp.sh45
1 files changed, 41 insertions, 4 deletions
diff --git a/osdfapp.sh b/osdfapp.sh
index 25e3c05..3dc4679 100755
--- a/osdfapp.sh
+++ b/osdfapp.sh
@@ -18,16 +18,46 @@
# -------------------------------------------------------------------------
#
+usage() {
+ echo "Usage:"
+ echo " $0 -h Display this help message."
+ echo " $0 -c configfile_path(optional) -x app.py file"
+ exit 0
+}
+
cd $(dirname $0)
# bash ../etc/make-certs.sh # create the https certificates if they are not present
+while getopts ":hc:x:" opt; do
+ case ${opt} in
+ h )
+ usage
+ ;;
+ c )
+ # process option configuration
+ export OSDF_CONFIG_FILE=$OPTARG
+ ;;
+ x )
+ # process executable file
+ export EXEC_FILE=$OPTARG
+ ;;
+ ? )
+ usage
+ ;;
+ : )
+ echo "Invalid Option: -$OPTARG requires an argument" 1>&2
+ exit 1
+ ;;
+ esac
+done
+shift $(( OPTIND - 1 ))
+
+set -e
+
LOGS=logs
mkdir -p $LOGS
-export OSDF_CONFIG_FILE=${1:-/opt/app/config/osdf_config.yaml} # this file may be passed by invoker
-[ ! -e "$OSDF_CONFIG_FILE" ] && unset OSDF_CONFIG_FILE
-
if [ -e /opt/app/ssl_cert/aaf_root_ca.cer ]; then
#assuming that this would be an ubuntu vm.
cp /opt/app/ssl_cert/aaf_root_ca.cer /usr/local/share/ca-certificates/aafcacert.crt
@@ -41,4 +71,11 @@ else
export REQUESTS_CA_BUNDLE=/opt/app/ssl_cert/aaf_root_ca.cer
fi
-python osdfapp.py 2>$LOGS/err.log 1>$LOGS/out.log < /dev/null # running the app
+if [ ! -z "$EXEC_FILE" ]
+then
+ # flask run
+ echo "Running $EXEC_FILE"
+ python $EXEC_FILE # running the app
+else
+ usage
+fi