aboutsummaryrefslogtreecommitdiffstats
path: root/sdc-os-chef/scripts
diff options
context:
space:
mode:
authorYuli Shlosberg <ys9693@att.com>2018-01-25 13:53:36 +0200
committerMichael Lando <ml636r@att.com>2018-02-04 10:39:20 +0000
commit0875ce0faad191c21b32cc9c95ffc20ebd57d586 (patch)
tree28520da212637e0f67697d9ff837e80da6eaa408 /sdc-os-chef/scripts
parentb676b6dcada5549348003191c09142e92de4d352 (diff)
Cassandra OOM Alignment
Change-Id: If9792919dba17936965b45361888a44a12a76b67 Issue-ID: SDC-911 Signed-off-by: Yuli Shlosberg <ys9693@att.com>
Diffstat (limited to 'sdc-os-chef/scripts')
-rwxr-xr-xsdc-os-chef/scripts/docker_run.sh66
1 files changed, 50 insertions, 16 deletions
diff --git a/sdc-os-chef/scripts/docker_run.sh b/sdc-os-chef/scripts/docker_run.sh
index 7e5498e765..5307a9cd7a 100755
--- a/sdc-os-chef/scripts/docker_run.sh
+++ b/sdc-os-chef/scripts/docker_run.sh
@@ -1,5 +1,8 @@
#!/bin/bash
+CS_PASSWORD="onap123#@!"
+SDC_USER="asdc_user"
+SDC_PASSWORD="Aa1234%^!"
function usage {
echo "usage: docker_run.sh [ -r|--release <RELEASE-NAME> ] [ -e|--environment <ENV-NAME> ] [ -p|--port <Docker-hub-port>] [ -l|--local <Run-without-pull>] [ -t|--runTests <Run-with-sanityDocker>] [ -h|--help ]"
@@ -21,7 +24,29 @@ function dir_perms {
mkdir -p ${WORKSPACE}/data/logs/FE/SDC/SDC-FE
chmod -R 777 ${WORKSPACE}/data/logs
}
+function probe_cs {
+
+cs_stat=false
+docker exec -it $1 /var/lib/ready-probe.sh > /dev/null 2>&1
+rc=$?
+if [[ $rc == 0 ]]; then
+ echo DOCKER start finished in $2 seconds
+ cs_stat=true
+fi
+
+}
+
+function probe_docker {
+
+match_result=false
+MATCH=`docker logs --tail 30 $1 | grep "DOCKER STARTED"`
+echo MATCH is -- $MATCH
+if [ -n "$MATCH" ]; then
+ echo DOCKER start finished in $2 seconds
+ match_result=true
+fi
+}
function monitor_docker {
echo monitor $1 Docker
@@ -30,15 +55,13 @@ function monitor_docker {
INTERVAL=20
TIME=0
while [ "$TIME" -lt "$TIME_OUT" ]; do
-
- MATCH=`docker logs --tail 30 $1 | grep "DOCKER STARTED"`
- echo MATCH is -- $MATCH
-
- if [ -n "$MATCH" ]; then
- echo DOCKER start finished in $TIME seconds
- break
+ if [ "$1" == "sdc-cs" ]; then
+ probe_cs $1 $TIME
+ if [[ $cs_stat == true ]]; then break; fi
+ else
+ probe_docker $1 $TIME
+ if [[ $match_result == true ]]; then break; fi
fi
-
echo Sleep: $INTERVAL seconds before testing if $1 DOCKER is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds
sleep $INTERVAL
TIME=$(($TIME+$INTERVAL))
@@ -76,7 +99,7 @@ function healthCheck {
function elasticHealthCheck {
echo "Elastic Health-Check:"
-
+
COUNTER=0
while [ $COUNTER -lt 20 ]; do
echo "Waiting ES docker to start"
@@ -85,10 +108,10 @@ function elasticHealthCheck {
then
break
fi
- let COUNTER=COUNTER+1
+ let COUNTER=COUNTER+1
sleep 4
done
-
+
healthCheck_http_code=$(curl -o /dev/null -w '%{http_code}' http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=120s)
if [[ "$health_Check_http_code" != 200 ]]
then
@@ -141,7 +164,7 @@ while [ $# -gt 0 ]; do
done
-[ -f /opt/config/env_name.txt ] && DEP_ENV=$(cat /opt/config/env_name.txt) || DEP_ENV=__ENV-NAME__
+[ -f /opt/config/env_name.txt ] && DEP_ENV=$(cat /opt/config/env_name.txt) || echo ${DEP_ENV}
[ -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=nexus3.onap.org:${PORT}
@@ -176,7 +199,7 @@ if [ ${LOCAL} = false ]; then
echo "pulling code"
docker pull ${PREFIX}/sdc-init-elasticsearch:${RELEASE}
fi
-docker run --name sdc-init-es --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --memory 750m --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments ${PREFIX}/sdc-init-elasticsearch:${RELEASE}
+docker run --name sdc-init-es --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --memory 750m --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments ${PREFIX}/sdc-init-elasticsearch:${RELEASE}
# Checking Elastic-Search-Init chef status
if [ ! $? -eq 0 ]; then
@@ -189,12 +212,23 @@ echo "docker run sdc-cassandra..."
if [ ${LOCAL} = false ]; then
docker pull ${PREFIX}/sdc-cassandra:${RELEASE}
fi
-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 ${WORKSPACE}/data/CS:/var/lib/cassandra --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9042:9042 --publish 9160:9160 ${PREFIX}/sdc-cassandra:${RELEASE}
+docker run -dit --name sdc-cs --env RELEASE="${RELEASE}" --env CS_PASSWORD="${CS_PASSWORD}" --env ENVNAME="${DEP_ENV}" --env HOST_IP=${IP} --env JVM_OPTS="-Xms1024m -Xmx1024m" --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 ${WORKSPACE}/data/CS:/var/lib/cassandra --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 9042:9042 --publish 9160:9160 ${PREFIX}/sdc-cassandra:${RELEASE} /bin/sh
echo "please wait while CS is starting..."
monitor_docker sdc-cs
+
+# cassandra-init
+echo "docker run sdc-cassandra-init..."
+if [ ${LOCAL} = false ]; then
+ docker pull ${PREFIX}/sdc-cassandra-init:${RELEASE}
+fi
+docker run --name sdc-cs-init --env RELEASE="${RELEASE}" --env SDC_USER="${SDC_USER}" --env SDC_PASSWORD="${SDC_PASSWORD}" --env CS_PASSWORD="${CS_PASSWORD}" --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 ${WORKSPACE}/data/CS:/var/lib/cassandra --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --volume ${WORKSPACE}/data/CS-Init:/root/chef-solo/cache ${PREFIX}/sdc-cassandra-init:${RELEASE} > /dev/null 2>&1
+rc=$?
+if [[ $rc != 0 ]]; then exit $rc; fi
+
+
# kibana
echo "docker run sdc-kibana..."
if [ ${LOCAL} = false ]; then
@@ -241,7 +275,7 @@ healthCheck
if [[ (${RUNTESTS} = true) && (${healthCheck_http_code} == 200) ]]; then
echo "docker run sdc-sanity..."
echo "Triger sanity docker, please wait..."
-
+
if [ ${LOCAL} = false ]; then
docker pull ${PREFIX}/sdc-sanity:${RELEASE}
fi
@@ -250,4 +284,4 @@ docker run --detach --name sdc-sanity --env HOST_IP=${IP} --env ENVNAME="${DEP_E
echo "please wait while SANITY is starting....."
monitor_docker sdc-sanity
-fi
+fi \ No newline at end of file