diff options
Diffstat (limited to 'bootstrap/vagrant-onap/lib')
-rwxr-xr-x | bootstrap/vagrant-onap/lib/aai | 15 | ||||
-rwxr-xr-x | bootstrap/vagrant-onap/lib/dcae | 26 | ||||
-rwxr-xr-x | bootstrap/vagrant-onap/lib/functions | 58 | ||||
-rwxr-xr-x | bootstrap/vagrant-onap/lib/msb | 53 | ||||
-rwxr-xr-x | bootstrap/vagrant-onap/lib/robot | 2 | ||||
-rwxr-xr-x | bootstrap/vagrant-onap/lib/vfc | 10 | ||||
-rwxr-xr-x | bootstrap/vagrant-onap/lib/vid | 4 |
7 files changed, 109 insertions, 59 deletions
diff --git a/bootstrap/vagrant-onap/lib/aai b/bootstrap/vagrant-onap/lib/aai index 828d4d14e..a3e56725f 100755 --- a/bootstrap/vagrant-onap/lib/aai +++ b/bootstrap/vagrant-onap/lib/aai @@ -95,17 +95,12 @@ function start_aai_microservices { done } -# _pull_hbase_image() - Pull HBase container image from a Docker Registry Hub -function _pull_hbase_image { - docker_openecomp_login - docker pull $nexus_docker_repo/aaidocker/aai-hbase-${hbase_version} -} - # install_hbase() - Install HBase Service function install_hbase { docker rm -f hbase - _pull_hbase_image - docker run -d --net=host --name="hbase" $nexus_docker_repo/aaidocker/aai-hbase-${hbase_version} + docker_openecomp_login + docker pull $nexus_docker_repo/aaidocker/aai-hbase-${hbase_version} + run_docker_image -d --net=host --name="hbase" $nexus_docker_repo/aaidocker/aai-hbase-${hbase_version} } # install_ajsc() - Install ASJC Java service container @@ -123,7 +118,7 @@ EOL pull_openecomp_image ajsc-aai fi - docker run --env-file /etc/ajsc-aai.conf --name=aai-service --net=host -v /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt -it -d $nexus_docker_repo/openecomp/ajsc-aai:$docker_version + run_docker_image --env-file /etc/ajsc-aai.conf --name=aai-service --net=host -v /etc/ssl/certs/ca-certificates.crt:/etc/ssl/certs/ca-certificates.crt -it -d $nexus_docker_repo/openecomp/ajsc-aai:$docker_version } # install_model_loader() Install Model Loader @@ -152,7 +147,7 @@ EOL pull_openecomp_image model-loader ARGS+="--name=model-loader-service -it -d --env-file /etc/model-loader.conf $nexus_docker_repo/openecomp/model-loader:$docker_version" fi - docker run ${ARGS} + run_docker_image ${ARGS} } # _wait_for_sdc() - Function that determines if SDC is up and running diff --git a/bootstrap/vagrant-onap/lib/dcae b/bootstrap/vagrant-onap/lib/dcae index 67a43a028..9150b37da 100755 --- a/bootstrap/vagrant-onap/lib/dcae +++ b/bootstrap/vagrant-onap/lib/dcae @@ -39,33 +39,13 @@ GIT-MR-REPO: http://gerrit.onap.org/r/dcae/demo/startup/message-router.git EOL } -# _build_docker_image() - Function that clones, compiles and build a Docker image -function _build_docker_image { - local src_folder=$1 - local name=$2 - install_docker - - pushd $src_folder - # NOTE: Workaround for dmmapbc images - sed -i '/LocalKey/d' Dockerfile - local docker_build="docker build -t $name -f ./Dockerfile ." - if [ $http_proxy ]; then - docker_build+=" --build-arg http_proxy=$http_proxy" - fi - if [ $https_proxy ]; then - docker_build+=" --build-arg https_proxy=$https_proxy" - fi - eval $docker_build - popd -} - # _build_dcae_images() Function that builds DCAE docker images from source code. function _build_dcae_images { if [[ "$compile_repo" != "True" ]]; then compile_repos "dcae" fi - _build_docker_image $dcae_src_folder/dmaapbc openecomp/dcae-dmaapbc - _build_docker_image $dcae_src_folder/orch-dispatcher dcae/orch-dispatcher + build_docker_image $dcae_src_folder/dmaapbc openecomp/dcae-dmaapbc + build_docker_image $dcae_src_folder/orch-dispatcher dcae/orch-dispatcher pushd $dcae_src_folder/demo bash dcae-demo-controller/src/main/docker-build/build.sh @@ -99,7 +79,7 @@ function install_dcae { make up fi popd - # docker run -p 8080:8080 -d -v <some local directory>/config.yml:/opt/config.yml --name dcae-inventory <docker registry>/dcae-inventory:<version> + # run_docker_image -p 8080:8080 -d -v <some local directory>/config.yml:/opt/config.yml --name dcae-inventory <docker registry>/dcae-inventory:<version> } # init_dcae() - Function that initialize DCAE Controller services diff --git a/bootstrap/vagrant-onap/lib/functions b/bootstrap/vagrant-onap/lib/functions index 157c910de..907805e97 100755 --- a/bootstrap/vagrant-onap/lib/functions +++ b/bootstrap/vagrant-onap/lib/functions @@ -247,6 +247,12 @@ function pull_docker_image { fi } +# run_docker_image() - Starts a Docker instance +function run_docker_image { + install_docker + docker run $@ +} + # install_docker_compose() - Download and install docker-engine function install_docker_compose { local docker_compose_version=${1:-1.12.0} @@ -312,32 +318,48 @@ function compile_repos { function build_docker_image { local src_folder=$1 local profile=$2 - install_maven install_docker pushd $src_folder - # Cleanup external repo - sed -i 's|${docker.push.registry}/||g' pom.xml - local mvn_docker="mvn clean package docker:build" - if [ $profile ]; then - mvn_docker+=" -P $profile" - fi - if [ $http_proxy ]; then - if ! grep -ql "docker.buildArg.http_proxy" pom.xml ; then - mvn_docker+=" -Ddocker.buildArg.http_proxy=$http_proxy" + if [ -f pom.xml ]; then + install_maven + # Cleanup external repo + sed -i 's|${docker.push.registry}/||g' pom.xml + local docker_build="mvn clean package docker:build" + if [ $profile ]; then + docker_build+=" -P $profile" fi + if [ $http_proxy ]; then + if ! grep -ql "docker.buildArg.http_proxy" pom.xml ; then + docker_build+=" -Ddocker.buildArg.http_proxy=$http_proxy" + fi if ! grep -ql "docker.buildArg.HTTP_PROXY" pom.xml ; then - mvn_docker+=" -Ddocker.buildArg.HTTP_PROXY=$http_proxy" + docker_build+=" -Ddocker.buildArg.HTTP_PROXY=$http_proxy" fi - fi - if [ $https_proxy ]; then - if ! grep -ql "docker.buildArg.https_proxy" pom.xml ; then - mvn_docker+=" -Ddocker.buildArg.https_proxy=$https_proxy" fi - if ! grep -ql "docker.buildArg.HTTPS_PROXY" pom.xml ; then - mvn_docker+=" -Ddocker.buildArg.HTTPS_PROXY=$https_proxy" + if [ $https_proxy ]; then + if ! grep -ql "docker.buildArg.https_proxy" pom.xml ; then + docker_build+=" -Ddocker.buildArg.https_proxy=$https_proxy" + fi + if ! grep -ql "docker.buildArg.HTTPS_PROXY" pom.xml ; then + docker_build+=" -Ddocker.buildArg.HTTPS_PROXY=$https_proxy" + fi + fi + elif [ -f Dockerfile ]; then + # NOTE: Workaround for dmmapbc images + sed -i '/LocalKey/d' Dockerfile + sed -i "s/nexus3.onap.org\:10003\///g" Dockerfile + local docker_build="docker build -t $profile -f ./Dockerfile ." + if [ $http_proxy ]; then + docker_build+=" --build-arg http_proxy=$http_proxy" + docker_build+=" --build-arg HTTP_PROXY=$http_proxy" + fi + if [ $https_proxy ]; then + docker_build+=" --build-arg https_proxy=$https_proxy" + docker_build+=" --build-arg HTTPS_PROXY=$https_proxy" fi fi - eval $mvn_docker + echo $docker_build + eval $docker_build popd } diff --git a/bootstrap/vagrant-onap/lib/msb b/bootstrap/vagrant-onap/lib/msb new file mode 100755 index 000000000..262b29c0e --- /dev/null +++ b/bootstrap/vagrant-onap/lib/msb @@ -0,0 +1,53 @@ +#!/bin/bash + +source /var/onap/functions + +msb_src_folder=$git_src_folder/msb +msb_repos=("msb/apigateway" "msb/discovery" "msb/java-sdk" "msb/swagger-sdk") + +# _build_msb_images() - Function that creates Microservices Docker images from source code +function _build_msb_images { + if [[ "$compile_repo" != "True" ]]; then + compile_repos "msb" + fi + + build_docker_image $msb_src_folder/apigateway/distributions/msb-apigateway/src/main/basedocker onap/msb/msb_base + build_docker_image $msb_src_folder/apigateway/distributions/msb-apigateway/src/main/docker onap/msb/msb_apigateway + build_docker_image $msb_src_folder/discovery/distributions/msb-discovery/src/main/docker onap/msb/msb_discovery +} + +# get_msb_images() - Function that retrieves the Microservices Bus images +function get_msb_images { + pull_docker_image "consul:0.9.3" + if [[ "$build_image" == "True" ]]; then + _build_msb_images + else + unset docker_version + pull_onap_image msb/msb_base + pull_onap_image msb/msb_apigateway + pull_onap_image msb/msb_discovery + fi +} + +# install_msb() - Downloads and configure Microservices Bus source code +function install_msb { + run_docker_image -d --net=host --name msb_consul consul:0.9.3 + run_docker_image -d --net=host --name msb_discovery nexus3.onap.org:10001/onap/msb/msb_discovery + run_docker_image -d --net=host -e "ROUTE_LABELS=visualRange:1" --name msb_internal_apigateway nexus3.onap.org:10001/onap/msb/msb_apigateway +} + +# init_msb() - Function that initialize Message Router services +function init_msb { + if [[ "$clone_repo" == "True" ]]; then + clone_repos "msb" + if [[ "$compile_repo" == "True" ]]; then + compile_repos "msb" + fi + fi + if [[ "$skip_get_images" == "False" ]]; then + get_msb_images + if [[ "$skip_install" == "False" ]]; then + install_msb + fi + fi +} diff --git a/bootstrap/vagrant-onap/lib/robot b/bootstrap/vagrant-onap/lib/robot index d9b841757..374a2563c 100755 --- a/bootstrap/vagrant-onap/lib/robot +++ b/bootstrap/vagrant-onap/lib/robot @@ -27,7 +27,7 @@ function get_robot_images { # install_robot() - Run Robot services function install_robot { docker rm -f openecompete_container - docker run -d --name openecompete_container -v /opt/eteshare:/share -p 88:88 $nexus_docker_repo/openecomp/testsuite:$docker_version + run_docker_image -d --name openecompete_container -v /opt/eteshare:/share -p 88:88 $nexus_docker_repo/openecomp/testsuite:$docker_version } # init_robot() - Function that initialize Robot services diff --git a/bootstrap/vagrant-onap/lib/vfc b/bootstrap/vagrant-onap/lib/vfc index a1f4bef27..112f9a555 100755 --- a/bootstrap/vagrant-onap/lib/vfc +++ b/bootstrap/vagrant-onap/lib/vfc @@ -76,11 +76,11 @@ function install_vfc { vnfres_image=`docker images | grep vnfres | grep latest| awk '{print $1 ":" $2}'` gvnfmdriver_image=`docker images | grep gvnfmdriver | grep latest| awk '{print $1 ":" $2}'` - docker run -d --name vfc-nslcm -p 8403:8403 -e MSB_ADDR=127.0.0.1 $nslcm_image - docker run -d --name vfc-vnflcm -p 8801:8801 -e MSB_ADDR=127.0.0.1 $vnflcm_image - docker run -d --name vfc-vnfmgr -p 8803:8803 -e MSB_ADDR=127.0.0.1 $vnfmgr_image - docker run -d --name vfc-vnfres -p 8802:8802 -e MSB_ADDR=127.0.0.1 $vnfres_image - docker run -d --name vfc-gvnfmdriver -p 8484:8484 -e MSB_ADDR=127.0.0.1 $gvnfmdriver_image + run_docker_image -d --name vfc-nslcm -p 8403:8403 -e MSB_ADDR=127.0.0.1 $nslcm_image + run_docker_image -d --name vfc-vnflcm -p 8801:8801 -e MSB_ADDR=127.0.0.1 $vnflcm_image + run_docker_image -d --name vfc-vnfmgr -p 8803:8803 -e MSB_ADDR=127.0.0.1 $vnfmgr_image + run_docker_image -d --name vfc-vnfres -p 8802:8802 -e MSB_ADDR=127.0.0.1 $vnfres_image + run_docker_image -d --name vfc-gvnfmdriver -p 8484:8484 -e MSB_ADDR=127.0.0.1 $gvnfmdriver_image # TODO(sshank): Run other VFC component docker images. } diff --git a/bootstrap/vagrant-onap/lib/vid b/bootstrap/vagrant-onap/lib/vid index 6a358bf97..f253fdb59 100755 --- a/bootstrap/vagrant-onap/lib/vid +++ b/bootstrap/vagrant-onap/lib/vid @@ -30,8 +30,8 @@ function install_vid { docker rm -f vid-mariadb docker rm -f vid-server - docker run --name vid-mariadb -e MYSQL_DATABASE=vid_openecomp -e MYSQL_USER=vidadmin -e MYSQL_PASSWORD=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U -e MYSQL_ROOT_PASSWORD=LF+tp_1WqgSY -v /opt/vid/lf_config/vid-my.cnf:/etc/mysql/my.cnf -v /opt/vid/lf_config/vid-pre-init.sql:/docker-entrypoint-initdb.d/vid-pre-init.sql -v /var/lib/mysql -d mariadb:10 - docker run -e VID_MYSQL_DBNAME=vid_openecomp -e VID_MYSQL_PASS=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U --name vid-server -p 8080:8080 --link vid-mariadb:vid-mariadb-docker-instance -d $vid_image + run_docker_image --name vid-mariadb -e MYSQL_DATABASE=vid_openecomp -e MYSQL_USER=vidadmin -e MYSQL_PASSWORD=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U -e MYSQL_ROOT_PASSWORD=LF+tp_1WqgSY -v /opt/vid/lf_config/vid-my.cnf:/etc/mysql/my.cnf -v /opt/vid/lf_config/vid-pre-init.sql:/docker-entrypoint-initdb.d/vid-pre-init.sql -v /var/lib/mysql -d mariadb:10 + run_docker_image -e VID_MYSQL_DBNAME=vid_openecomp -e VID_MYSQL_PASS=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U --name vid-server -p 8080:8080 --link vid-mariadb:vid-mariadb-docker-instance -d $vid_image } # init_vid() - Function that initialize Vid services |