aboutsummaryrefslogtreecommitdiffstats
path: root/sdc-os-chef/scripts
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-06-09 03:19:04 +0300
committerMichael Lando <ml636r@att.com>2017-06-09 03:19:04 +0300
commited64b5edff15e702493df21aa3230b81593e6133 (patch)
treea4cb01fdaccc34930a8db403a3097c0d1e40914b /sdc-os-chef/scripts
parent280f8015d06af1f41a3ef12e8300801c7a5e0d54 (diff)
[SDC-29] catalog 1707 rebase commit.
Change-Id: I43c3dc5cf44abf5da817649bc738938a3e8388c1 Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'sdc-os-chef/scripts')
-rw-r--r--sdc-os-chef/scripts/docker_build.sh196
-rwxr-xr-xsdc-os-chef/scripts/docker_clean.sh1
-rwxr-xr-xsdc-os-chef/scripts/docker_health.sh2
-rwxr-xr-xsdc-os-chef/scripts/docker_run.sh4
4 files changed, 200 insertions, 3 deletions
diff --git a/sdc-os-chef/scripts/docker_build.sh b/sdc-os-chef/scripts/docker_build.sh
new file mode 100644
index 0000000000..03c922ee77
--- /dev/null
+++ b/sdc-os-chef/scripts/docker_build.sh
@@ -0,0 +1,196 @@
+#!/bin/bash
+#set -x
+
+
+function usage
+{
+ echo "usage: docker_run.sh [ -r|--release <RELEASE-NAME> ] [ -e|--environment <ENV-NAME> ] [ -p|--port <Docker-hub-port>] [ -h|--help ]"
+}
+
+
+function print_log () {
+ funcname=$1
+ lineno=$2
+ sev=$3
+ msg=$4
+ dd=`date +"%Y-%m-%d %H:%M:%S"`
+ case ${sev} in
+ "INFO")
+ COLOR="\033[1;32m" # GREEN
+ ;;
+ "ERROR")
+ COLOR="\033[1;31m" # RED
+ ;;
+ esac
+ echo -e "$dd: $fname, $funcname:$lineno --- ${COLOR} $msg\e[0m" |tee -a $LOG
+
+}
+
+
+
+function conf_proxy () {
+ grep http_proxy Dockerfile || /bin/sed -i '/FROM/a ARG http_proxy=http://one.proxy.att.com:8080\nARG https_proxy=http://one.proxy.att.com:8080' Dockerfile
+}
+
+###################################
+######### Parameters #########
+###################################
+
+WORKSPACE=$1
+WORK_DIR=/data/sdc-os-chef
+LOGFILE=`basename $0|awk -F. '{print $1".log"}'`
+LOG=$WORK_DIR/$LOGFILE
+DOCKER_REP=dockercentral.it.att.com:5100
+ECOMP_REP=${DOCKER_REP}/com.att.sdc/openecomp
+REL=`/usr/bin/xml_grep --text_only parent/version /data/sdc-os-chef/pom.xml`
+DOX_VER=` /bin/grep AMDOCS /data/sdc-os-chef/versions.properties | awk '{print $2}' | awk -F"." '{print $1}'`
+DOX_NUM=` /bin/grep AMDOCS /data/sdc-os-chef/versions.properties | awk '{print $2}' | awk -F"." '{print substr($NF,1,4)}' `
+VERSION=` /bin/grep ASDC /data/sdc-os-chef/versions.properties | awk '{print $2}' `
+MAVEN_REPO=mavencentral.it.att.com:8084/nexus/content/repositories
+ONBOARD_GR=com/att/asdc/onboarding/${DOX_VER}/${DOX_NUM}
+
+
+[ -f /opt/config/env_name.txt ] && DEP_ENV=$(cat /opt/config/env_name.txt) || DEP_ENV=__ENV-NAME__
+[ -f /opt/config/nexus_username.txt ] && NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt) || NEXUS_USERNAME=release
+[ -f /opt/config/nexus_password.txt ] && NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt) || NEXUS_PASSWD=sfWU3DFVdBr7GVxB85mTYgAW
+[ -f /opt/config/nexus_docker_repo.txt ] && NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt) || NEXUS_DOCKER_REPO=ecomp-nexus:${PORT}
+
+[ -f /opt/config/nexus_username.txt ] && docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
+#docker login -u m09875@sdc.att.com -p Aa1234%^! -e mg877n@att.com dockercentral.it.att.com:5100
+
+
+###################################
+######## MAIN ########
+###################################
+print_log Main $LINENO INFO "##### $0 completed #####"
+
+###################################
+######## sdc-elasticsearch ########
+###################################
+cd /data/sdc-os-chef/sdc-elasticsearch
+print_log Main $LINENO INFO "start creating sdc-elasticsearch ..."
+conf_proxy
+
+docker build -t ${ECOMP_REP}/sdc-elasticsearch:${VERSION} .
+docker tag ${ECOMP_REP}/sdc-elasticsearch:${VERSION} ${ECOMP_REP}/sdc-elasticsearch
+docker push ${ECOMP_REP}/sdc-elasticsearch:${VERSION}
+res=$?
+if [ ${res} -eq 0 ]; then
+ print_log Main $LINENO INFO "${ECOMP_REP}/sdc-elasticsearch:${VERSION} pushed successfully"
+else
+ print_log Main $LINENO ERROR "Error pushing ${ECOMP_REP}/sdc-elasticsearch:${VERSION}"
+fi
+
+
+###################################
+######## sdc-cassandra ########
+###################################
+cd /data/sdc-os-chef/sdc-cassandra
+print_log Main $LINENO INFO "start creating sdc-cassandra ..."
+
+conf_proxy
+
+docker build -t ${ECOMP_REP}/sdc-cassandra:${VERSION} .
+docker tag ${ECOMP_REP}/sdc-cassandra:$VERSION ${ECOMP_REP}/sdc-cassandra
+docker push ${ECOMP_REP}/sdc-cassandra:$VERSION
+res=$?
+if [ ${res} -eq 0 ]; then
+ print_log Main $LINENO INFO "${ECOMP_REP}/sdc-cassandra:${VERSION} pushed successfully"
+else
+ print_log Main $LINENO ERROR "Error pushing ${ECOMP_REP}/sdc-cassandra:${VERSION}"
+fi
+
+
+
+###################################
+######## sdc-kibana ########
+###################################
+cd /data/sdc-os-chef/sdc-kibana
+print_log Main $LINENO INFO "start creating sdc-kibana ..."
+
+conf_proxy
+
+docker build -t ${ECOMP_REP}/sdc-kibana:$VERSION .
+docker tag ${ECOMP_REP}/sdc-kibana:$VERSION ${ECOMP_REP}/sdc-kibana
+docker push ${ECOMP_REP}/sdc-kibana:$VERSION
+res=$?
+if [ ${res} -eq 0 ]; then
+ print_log Main $LINENO INFO "${ECOMP_REP}/sdc-kibana:${VERSION} pushed successfully"
+else
+ print_log Main $LINENO ERROR "Error pushing ${ECOMP_REP}/sdc-kibana:${VERSION}"
+fi
+
+
+###################################
+######## sdc-sanity ########
+###################################
+cd /data/sdc-os-chef/sdc-sanity
+print_log Main $LINENO INFO "start creating sdc-sanity ..."
+
+conf_proxy
+
+docker build -t ${ECOMP_REP}/sdc-sanity:$VERSION .
+docker tag ${ECOMP_REP}/sdc-sanity:$VERSION ${ECOMP_REP}/sdc-sanity
+docker push ${ECOMP_REP}/sdc-sanity:$VERSION
+res=$?
+if [ ${res} -eq 0 ]; then
+ print_log Main $LINENO INFO "${ECOMP_REP}/sdc-sanity:${VERSION} pushed successfully"
+else
+ print_log Main $LINENO ERROR "Error pushing ${ECOMP_REP}/sdc-sanity:${VERSION}"
+fi
+
+
+###################################
+######## sdc-backend ########
+###################################
+cd /data/sdc-os-chef/sdc-backend
+print_log Main $LINENO INFO "start creating sdc-backend ..."
+
+conf_proxy
+/bin/sed -i "s/__SDC-RELEASE__/${REL}/g" Dockerfile
+
+wget -q -nd -r --no-parent -A 'onboard-main*.tar' http://${MAVEN_REPO}/att-repository-snapshots/${ONBOARD_GR}/onboard-main
+if [ $? -ne 0 ] ; then
+ wget -q -nd -r --no-parent -A 'onboard-main*.tar' http://${MAVEN_REPO}/att-repository-releases/${ONBOARD_GR}/onboard-main
+fi
+/bin/tar -xf onboard-main-${DOX_VER}.*.tar --wildcards --no-anchored "onboarding-be-${DOX_VER}.*.war"
+rm onboard-main*.tar
+
+docker build -t ${ECOMP_REP}/sdc-backend:$VERSION .
+docker tag ${ECOMP_REP}/sdc-backend:$VERSION ${ECOMP_REP}/sdc-backend
+docker push ${ECOMP_REP}/sdc-backend:$VERSION
+res=$?
+if [ ${res} -eq 0 ]; then
+ print_log Main $LINENO INFO "${ECOMP_REP}/sdc-backend:${VERSION} pushed successfully"
+else
+ print_log Main $LINENO ERROR "Error pushing ${ECOMP_REP}/sdc-backend:${VERSION}"
+fi
+
+
+###################################
+######## sdc-frontend ########
+###################################
+cd /data/sdc-os-chef/sdc-frontend
+print_log Main $LINENO INFO "start creating sdc-frontend ..."
+
+conf_proxy
+
+/bin/sed -i "s/__SDC-RELEASE__/${REL}/g" Dockerfile
+wget -q -nd -r --no-parent -A 'onboard-main*.tar' http://${MAVEN_REPO}/att-repository-snapshots/${ONBOARD_GR}/onboard-main
+if [ $? -ne 0 ] ; then
+ wget -q -nd -r --no-parent -A 'onboard-main*.tar' http://${MAVEN_REPO}/att-repository-releases/${ONBOARD_GR}/onboard-main
+fi
+/bin/tar -xf onboard-main-${DOX_VER}.*.tar --wildcards --no-anchored "onboarding-fe-${DOX_VER}.*.war"
+rm onboard-main*.tar
+
+docker build -t ${ECOMP_REP}/sdc-frontend:$VERSION .
+docker tag ${ECOMP_REP}/sdc-frontend:$VERSION ${ECOMP_REP}/sdc-frontend
+docker push ${ECOMP_REP}/sdc-frontend:$VERSION
+res=$?
+if [ ${res} -eq 0 ]; then
+ print_log Main $LINENO INFO "${ECOMP_REP}/sdc-frontend:${VERSION} pushed successfully"
+else
+ print_log Main $LINENO ERROR "Error pushing ${ECOMP_REP}/sdc-frontend:${VERSION}"
+fi
+
+print_log Main $LINENO INFO "##### $0 completed #####"
diff --git a/sdc-os-chef/scripts/docker_clean.sh b/sdc-os-chef/scripts/docker_clean.sh
index 6fe1ff615d..3979de6e73 100755
--- a/sdc-os-chef/scripts/docker_clean.sh
+++ b/sdc-os-chef/scripts/docker_clean.sh
@@ -5,3 +5,4 @@ do
docker rm -f ${X}
done
+
diff --git a/sdc-os-chef/scripts/docker_health.sh b/sdc-os-chef/scripts/docker_health.sh
index 1db5282446..832b25a237 100755
--- a/sdc-os-chef/scripts/docker_health.sh
+++ b/sdc-os-chef/scripts/docker_health.sh
@@ -14,7 +14,7 @@ curl http://localhost:8181/sdc1/rest/healthCheck
echo ""
echo ""
res=`curl -s -X GET -H "Accept: application/json" -H "Content-Type: application/json" -H "USER_ID: jh0003" "http://localhost:8080/sdc2/rest/v1/user/demo" | wc -l`
-if [[ ! ${res} -eq 0 ]]
+if [[ ${res} != 0 ]]
then
echo "Error [${res}] while user existance check"
exit ${res}
diff --git a/sdc-os-chef/scripts/docker_run.sh b/sdc-os-chef/scripts/docker_run.sh
index f885c76d67..23c443e22d 100755
--- a/sdc-os-chef/scripts/docker_run.sh
+++ b/sdc-os-chef/scripts/docker_run.sh
@@ -73,12 +73,12 @@ docker run --detach --name sdc-es --env ENVNAME="${DEP_ENV}" --log-driver=json-f
# cassandra
echo "docker run sdc-cassandra..."
docker pull ${NEXUS_DOCKER_REPO}/openecomp/sdc-cassandra:${RELEASE}
-docker run --detach --name sdc-cs --env ENVNAME="${DEP_ENV}" --env HOST_IP=${IP} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume /data/CS:/var/lib/cassandra --volume /data/environments:/root/chef-solo/environments --publish 9042:9042 --publish 9160:9160 ${NEXUS_DOCKER_REPO}/openecomp/sdc-cassandra:${RELEASE}
+docker run --detach --name sdc-cs --env RELEASE="${RELEASE}" --env ENVNAME="${DEP_ENV}" --env HOST_IP=${IP} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume /data/CS:/var/lib/cassandra --volume /data/environments:/root/chef-solo/environments --publish 9042:9042 --publish 9160:9160 ${NEXUS_DOCKER_REPO}/openecomp/sdc-cassandra:${RELEASE}
echo "please wait while CS is starting..."
echo ""
-c=25 # seconds to wait
+c=120 # seconds to wait
REWRITE="\e[25D\e[1A\e[K"
while [ $c -gt 0 ]; do
c=$((c-1))