summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthewLi <matthew.lijun@huawei.com>2015-12-23 17:38:50 -0800
committerMatthewLi <matthew.lijun@huawei.com>2015-12-27 21:11:06 -0500
commit769843a58a4a93f202d97749d6ff8b7072d6fddf (patch)
tree635bd2cf328380cef6783182285084fcf9a6bade
parent0409b2b8b7e18efd94b6101c1a5e489f7a4f4bfc (diff)
download packages from public IP to local repo and create the dev workflow
JIRA: BOTTLENECK-36 Change-Id: I861a2eddb509c00f3418a6f15cb00c22be346ed0 Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
-rw-r--r--utils/infra_setup/vm_dev_setup/README.rst14
-rw-r--r--utils/infra_setup/vm_dev_setup/package.conf8
-rwxr-xr-xutils/infra_setup/vm_dev_setup/setup_env.sh65
3 files changed, 87 insertions, 0 deletions
diff --git a/utils/infra_setup/vm_dev_setup/README.rst b/utils/infra_setup/vm_dev_setup/README.rst
new file mode 100644
index 00000000..49a8f7f1
--- /dev/null
+++ b/utils/infra_setup/vm_dev_setup/README.rst
@@ -0,0 +1,14 @@
+.. this folder is used to setup env for bottlenecks after ssh into VMs.
+
+how to use the script in this directory
+=======================================
+
+The script vm_setup.sh is used to git clone the bottlenecks code repo
+and download the dependent packages into the Cache from the public IP
+where they stored.
+
+The parameters are defined in package.conf file.
+
+Revision: _sha1_
+
+Build date: |today|
diff --git a/utils/infra_setup/vm_dev_setup/package.conf b/utils/infra_setup/vm_dev_setup/package.conf
new file mode 100644
index 00000000..e7210f39
--- /dev/null
+++ b/utils/infra_setup/vm_dev_setup/package.conf
@@ -0,0 +1,8 @@
+TIMEOUT=10
+export PACKAGE_URL=${PACKAGE_URL:-http://artifacts.opnfv.org}
+
+export BOTTLENECKS_REPO=${BOTTLENECKS_REPO:-https://gerrit.opnfv.org/gerrit/bottlenecks}
+export BOTTLENECKS_REPO_DIR=${BOTTLENECKS_REPO_DIR:-/bottlenecks}
+export RUBBOS_CACHE_DIR=${CACHE_DIR:-$BOTTLENECKS_REPO_DIR/rubbos/app_tools}
+export RUBBOS_RUN_DIR=${RUBBOS_RUN_DIR:-$BOTTLENECKS_REPO_DIR/rubbos/rubbos_scripts/1-1-1/scripts}
+export RUBBOS_EXE_DIR=${RUBBOS_EXE_DIR:-$BOTTLENECKS_REPO_DIR/rubbos/rubbos_scripts/1-1-1/scripts}
diff --git a/utils/infra_setup/vm_dev_setup/setup_env.sh b/utils/infra_setup/vm_dev_setup/setup_env.sh
new file mode 100755
index 00000000..a0018c8e
--- /dev/null
+++ b/utils/infra_setup/vm_dev_setup/setup_env.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+set -ex
+
+bottlenecks_prepare_env()
+{
+ set +e
+ for i in $PreInstall_Packages; do
+ if ! apt --installed list 2>/dev/null |grep "\<$i\>"
+ then
+ sudo apt-get install -y --force-yes $i
+ fi
+ done
+ set -e
+
+ if [ -d $RUBBOS_CACHE_DIR ]; then
+ rm -rf $RUBBOS_CACHE_DIR
+ fi
+ mkdir -p $RUBBOS_CACHE_DIR
+}
+
+bottlenecks_download_repo()
+{
+ if [ -d $BOTTELENECKS_REPO_DIR/.git ]; then
+ cd $BOTTLENECKS_REPO_DIR
+ git pull origin master
+ cd -
+ else
+ rm -rf $BOTTLENECKS_REPO_DIR
+ git clone $BOTTLENECKS_REPO $BOTTLENECKS_REPO_DIR
+ fi
+}
+
+bottlenecks_download_packages()
+{
+ for i in ; do #list the packages
+ if [[ ! $i ]]; then
+ continue
+ fi
+ curl --connect-timeout 10 -o $RUBBOS_CACHE_DIR/$i $PACKAGE_URL 2>/dev/null
+ done
+}
+
+bottlenecks_rubbos_install_exe()
+{
+ cd $RUBBOS_RUN_DIR
+ ./run.sh
+ cd $RUBBOS_EXE_DIR
+ ./CONTROL_rubbos_exec.sh
+}
+
+main()
+{
+ PreInstall_Packages="gcc gettext g++ libaio1 libaio-dev make"
+ SCRIPT_DIR=`cd ${BASH_SOURCE[0]%/*};pwd`
+
+ source $SCRIPT_DIR/package.conf
+
+ bottlenecks_prepare_env
+ bottlenecks_download_repo
+ bottlenecks_download_packages
+ bottlenecks_rubbos_install_exe
+}
+
+main