summaryrefslogtreecommitdiffstats
path: root/sdc-os-chef/sdc-backend/startup.sh
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-02-19 10:28:42 +0200
committerMichael Lando <ml636r@att.com>2017-02-19 10:51:01 +0200
commit451a3400b76511393c62a444f588a4ed15f4a549 (patch)
treee4f5873a863d1d3e55618eab48b83262f874719d /sdc-os-chef/sdc-backend/startup.sh
parent5abfe4e1fb5fae4bbd5fbc340519f52075aff3ff (diff)
Initial OpenECOMP SDC commit
Change-Id: I0924d5a6ae9cdc161ae17c68d3689a30d10f407b Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'sdc-os-chef/sdc-backend/startup.sh')
-rw-r--r--sdc-os-chef/sdc-backend/startup.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/sdc-os-chef/sdc-backend/startup.sh b/sdc-os-chef/sdc-backend/startup.sh
new file mode 100644
index 0000000000..d795ddde67
--- /dev/null
+++ b/sdc-os-chef/sdc-backend/startup.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+export CHEFNAME=${ENVNAME}
+# executing chef-solo for configuration
+cd /root/chef-solo
+echo "normal['HOST_IP'] = \"${HOST_IP}\"" > /root/chef-solo/cookbooks/sdc-catalog-be/attributes/default.rb
+chef-solo -c solo.rb -E ${CHEFNAME}
+
+sed -i '/^set -e/aJAVA_OPTIONS=\" -XX:MaxPermSize=256m -Xmx1500m -Dconfig.home=${JETTY_BASE}\/config -Dlog.home=${JETTY_BASE}\/logs -Dlogback.configurationFile=${JETTY_BASE}\/config\/catalog-be\/logback.xml -Dconfiguration.yaml=${JETTY_BASE}\/config\/catalog-be\/configuration.yaml\"' /docker-entrypoint.sh
+sed -i '/^set -e/aTMPDIR=${JETTY_BASE}\/temp' /docker-entrypoint.sh
+
+# executiong the jetty
+cd /var/lib/jetty
+/docker-entrypoint.sh &
+
+# add the consumers
+cd /root/chef-solo
+python /root/chef-solo/cookbooks/sdc-catalog-be/files/default/consumers.py &
+
+# add the user
+python /root/chef-solo/cookbooks/sdc-catalog-be/files/default/user.py &
+
+# check if BackEnd is up
+python /root/chef-solo/cookbooks/sdc-normatives/files/default/check_Backend_Health.py
+
+# executing the normatives
+cd /root/chef-solo
+check_normative="/tmp/check_normative.out"
+curl -s -X GET -H "Content-Type: application/json;charset=UTF-8" -H "USER_ID: jh0003" -H "X-ECOMP-RequestID: cbe744a0-037b-458f-aab5-df6e543c4090" -H "Cache-Control: no-cache" -H "Postman-Token: af08ca1c-302f-1431-404f-ed84246e07c9" "http://${HOST_IP}:8080/sdc2/rest/v1/screen" > ${check_normative}
+
+echo "normal['HOST_IP'] = \"${HOST_IP}\"" > /root/chef-solo/cookbooks/sdc-normatives/attributes/default.rb
+resources_len=`cat ${check_normative}| jq '.["resources"]|length'`
+if [ $resources_len -eq 0 ] ; then
+ chef-solo -c normatives.rb
+else
+ sed -i "s/import/upgrade/g" normatives.json
+ chef-solo -c normatives.rb
+fi
+
+while true; do sleep 2; done