From e112118754bbd297de52538d003fc21273e9cf3d Mon Sep 17 00:00:00 2001 From: xudan Date: Fri, 4 May 2018 05:48:28 -0400 Subject: Remove local DB Remove local DB and can just report without launch local DB. Need to do a little modification with the web portal code. JIRA: DOVETAIL-593 Change-Id: I595db39cce4156596ee0522d4b7e642a23d78ab9 Signed-off-by: xudan --- dovetail/utils/local_db/launch_db.sh | 92 ------------------------------------ 1 file changed, 92 deletions(-) delete mode 100755 dovetail/utils/local_db/launch_db.sh (limited to 'dovetail/utils/local_db/launch_db.sh') diff --git a/dovetail/utils/local_db/launch_db.sh b/dovetail/utils/local_db/launch_db.sh deleted file mode 100755 index 7d80cc7a..00000000 --- a/dovetail/utils/local_db/launch_db.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -export mongodb_port=${mongodb_port:-"27017"} -export testapi_port=${testapi_port:-"8000"} - -set -e - -echo "===================" -echo "Create the mongodb." -echo "===================" - -set +e -# pull image mongo:3.2.1 -mongodb_img="mongo:3.2.1" -echo "Step1: pull the image $mongodb_img." -sudo docker pull $mongodb_img -set -e - -container_name='mongodb_offline_dovetail' - -echo "Step2: remove the exist container with the same name '$container_name' if exists." -sudo docker ps -a -f "name=${container_name}" - -if [[ ! -z $(sudo docker ps -aq -f "name=${container_name}" -f "ancestor=${mongodb_img}") ]]; then - sudo docker ps -aq -f "name=${container_name}" -f "ancestor=${mongodb_img}" | xargs sudo docker rm -f -fi - -# run mongodb container -echo "Step3: run ${container_name} container." -cmd="sudo docker run -itd -p ${mongodb_port}:27017 -v ${DOVETAIL_HOME}/testapi/mongo:/data/db --name ${container_name} ${mongodb_img}" -echo $cmd -${cmd} - -echo "Successfully create mongo DB." - -echo "Step4: get the internal IP of ${container_name} container..." -get_ip_cmd="ip a | grep eth0 | grep inet | awk '{print \$2}' | cut -d'/' -f 1" -mongo_ip=$(sudo docker exec ${container_name} /bin/bash -c "${get_ip_cmd}") -echo "The internal IP of container ${container_name} is ${mongo_ip}" - - -echo "==========================" -echo "Create the testapi service." -echo "==========================" - -set +e -testapi_img="opnfv/testapi:ovp.1.0.0" -echo "Step1: pull the image $testapi_img." -sudo docker pull $testapi_img -set -e - -container_name='testapi_offline_dovetail' - -echo "Step2: remove the exist container with the same name '$container_name' if exists." -sudo docker ps -a -f "name=${container_name}" - -if [[ ! -z $(sudo docker ps -aq -f "name=${container_name}" -f "ancestor=${testapi_img}") ]]; then - sudo docker ps -aq -f "name=${container_name}" -f "ancestor=${testapi_img}" | xargs sudo docker rm -f -fi - -# run testapi container -echo "Step3: run ${container_name} container." -cmd="sudo docker run -itd -p ${testapi_port}:8000 --name ${container_name} -v ${DOVETAIL_HOME}/testapi/logs:/home/testapi/logs -e mongodb_url=mongodb://${mongo_ip}:27017/ ${testapi_img}" -echo $cmd -${cmd} - -echo "Step4: get the internal IP of ${container_name} container..." -get_ip_cmd="ip a | grep eth0 | grep inet | awk '{print \$2}' | cut -d'/' -f 1" -testapi_ip=$(sudo docker exec ${container_name} /bin/bash -c "${get_ip_cmd}") -echo "The internal IP of container ${container_name} is ${testapi_ip}" - -echo "Wait for testapi to work..." -sleep 10 - -echo "=================================" -echo "Upload default project info to DB" -echo "=================================" - -echo "Init DB info..." -cmd="python /home/opnfv/dovetail/dovetail/utils/local_db/init_db.py ${testapi_ip} 8000" -echo $cmd -${cmd} - -echo "Successfully load DB info." -- cgit 1.2.3-korg