aboutsummaryrefslogtreecommitdiffstats
path: root/boot
diff options
context:
space:
mode:
authorDominic Lunanuova <dgl@research.att.com>2018-04-06 22:05:42 +0000
committerDominic Lunanuova <dgl@research.att.com>2018-04-09 15:28:53 +0000
commit32bb82bea98eb20313c35600c7a58eec9359d8fa (patch)
tree69fdb9510c190b82ee4454261cea697b68cbdf29 /boot
parentdb228e6370e5257ca59e4f0e7154f45991c7defa (diff)
Iniital boot scripts for dmaap-buscontroller
Patch 2 corrects domain for integration: simpledemo.onap.org Patch 3 merge with mr scripts so share 1 VM. Also use correct bindings. Change-Id: I2431dcecab13c8ef480de59d79fb807d3b2e5b8d Signed-off-by: Dominic Lunanuova <dgl@research.att.com> Issue-ID: DMAAP-125 Signed-off-by: Dominic Lunanuova <dgl@research.att.com>
Diffstat (limited to 'boot')
-rw-r--r--boot/bind_zones_onap6
-rw-r--r--boot/dbcl_serv.sh116
-rw-r--r--boot/dbcl_vm_init.sh83
-rw-r--r--boot/mr_install.sh11
-rw-r--r--boot/mr_vm_init.sh4
5 files changed, 215 insertions, 5 deletions
diff --git a/boot/bind_zones_onap b/boot/bind_zones_onap
index d0cdf838..7f66e4ed 100644
--- a/boot/bind_zones_onap
+++ b/boot/bind_zones_onap
@@ -124,9 +124,9 @@ vid.api.simpledemo.onap.org. IN CNAME vm1.vid.simpledemo.onap.org.
portal.api.simpledemo.onap.org. IN CNAME vm1.portal.simpledemo.onap.org.
;Message Router
-;mr.api.simpledemo.onap.org. IN CNAME vm1.mr.simpledemo.onap.org.
+mr.api.simpledemo.onap.org. IN CNAME vm1.mr.simpledemo.onap.org.
ueb.api.simpledemo.onap.org. IN CNAME vm1.mr.simpledemo.onap.org.
-;dbc.api.simpledemo.onap.org. IN CNAME vm1.mr.simpledemo.onap.org.
+dbc.api.simpledemo.onap.org. IN CNAME vm1.mr.simpledemo.onap.org.
;drprov.api.simpledemo.onap.org. IN CNAME vm1.mr.simpledemo.onap.org.
;CLAMP
@@ -154,4 +154,4 @@ music.api.simpledemo.onap.org. IN CNAME vm1.music.simpledemo.onap.org.
oof.api.simpledemo.onap.org. IN CNAME vm1.oof.simpledemo.onap.org.
;NBI
-nbi.api.simpledemo.onap.org. IN CNAME vm1.nbi.simpledemo.onap.org. \ No newline at end of file
+nbi.api.simpledemo.onap.org. IN CNAME vm1.nbi.simpledemo.onap.org.
diff --git a/boot/dbcl_serv.sh b/boot/dbcl_serv.sh
new file mode 100644
index 00000000..dfb70206
--- /dev/null
+++ b/boot/dbcl_serv.sh
@@ -0,0 +1,116 @@
+
+#############################################################################
+#
+# Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#############################################################################
+
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start daemon at boot time
+# Description: Enable service provided by daemon.
+### END INIT INFO
+
+dir="/opt"
+cmd="./dbcl_vm_init.sh"
+user="root"
+
+name=`basename $0`
+pid_file="/var/run/$name.pid"
+stdout_log="/var/log/$name.log"
+stderr_log="/var/log/$name.err"
+
+get_pid() {
+ cat "$pid_file"
+}
+
+is_running() {
+ [ -f "$pid_file" ] && ps `get_pid` > /dev/null 2>&1
+}
+
+case "$1" in
+ start)
+ if is_running; then
+ echo "Already started"
+ else
+ echo "Starting $name"
+ cd "$dir"
+ if [ -z "$user" ]; then
+ sudo $cmd >> "$stdout_log" 2>> "$stderr_log" &
+ else
+ sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
+ fi
+ echo $! > "$pid_file"
+ if ! is_running; then
+ echo "Unable to start, see $stdout_log and $stderr_log"
+ exit 1
+ fi
+ fi
+ ;;
+ stop)
+ if is_running; then
+ echo -n "Stopping $name.."
+ kill `get_pid`
+ for i in {1..10}
+ do
+ if ! is_running; then
+ break
+ fi
+
+ echo -n "."
+ sleep 1
+ done
+ echo
+
+ if is_running; then
+ echo "Not stopped; may still be shutting down or shutdown may have failed"
+ exit 1
+ else
+ echo "Stopped"
+ if [ -f "$pid_file" ]; then
+ rm "$pid_file"
+ fi
+ fi
+ else
+ echo "Not running"
+ fi
+ ;;
+ restart)
+ $0 stop
+ if is_running; then
+ echo "Unable to stop, will not attempt to start"
+ exit 1
+ fi
+ $0 start
+ ;;
+ status)
+ if is_running; then
+ echo "Running"
+ else
+ echo "Stopped"
+ exit 1
+ fi
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|status}"
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/boot/dbcl_vm_init.sh b/boot/dbcl_vm_init.sh
new file mode 100644
index 00000000..ba9859ad
--- /dev/null
+++ b/boot/dbcl_vm_init.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+
+# Establish environment variables
+NEXUS_USERNAME=$(cat /opt/config/nexus_username.txt)
+NEXUS_PASSWD=$(cat /opt/config/nexus_password.txt)
+NEXUS_DOCKER_REPO=$(cat /opt/config/nexus_docker_repo.txt)
+DOCKER_IMAGE_VERSION=$(cat /opt/config/uui_docker.txt)
+
+# Refresh images
+docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO
+docker pull $NEXUS_DOCKER_REPO/onap/dmaap/buscontroller:$DOCKER_IMAGE_VERSION
+docker tag $NEXUS_DOCKER_REPO/onap/dmaap/buscontroller:$DOCKER_IMAGE_VERSION onap/dmaap/buscontroller:latest
+
+docker rm -f dmaap-buscontroller
+
+TMP_CFG=/tmp/docker-dmaap-buscontroller.conf
+cat >> $TMP_CFG <<!EOF
+DMAAPBC_INT_HTTPS_PORT=0
+DMAAPBC_PG_ENABLED=false
+DMAAPBC_INSTANCE_NAME=ONAP-CSIT
+DMAAPBC_AAF_URL=https://aaf.api.simpledemo.onap.org:8095/proxy/
+DMAAPBC_MR_CNAME=mr.api.simpledemo.onap.org
+DMAAPBC_DRPROV_FQDN=drprov.simpledemo.onap.org
+!EOF
+
+# Insert docker run instructions here
+docker run -i -t -d --name dmaap-buscontroller -p 8080:8080 -p 8443:8443 -v $TMP_CFG:/opt/app/config/conf $NEXUS_DOCKER_REPO/onap/dmaap/buscontroller:$DOCKER_IMAGE_VERSION
+
+DBCL_FQDN=dbc.api.simpledemo.onap.org
+DRPS_FQDN=drprov.simpledemo.onap.org
+MR_FQDN=mr.api.simpledemo.onap.org
+# INITIALIZE: dmaap object
+JSON=/tmp/$$.dmaap
+cat << EOF > $JSON
+{
+"version": "1",
+"topicNsRoot": "org.onap.dmaap",
+"drProvUrl": "http://${DRPS_FQDN}:8080",
+"dmaapName": "onapStable",
+"bridgeAdminTopic": "MM_AGENT_PROV"
+
+}
+EOF
+
+curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://${DBCL_FQDN}:8080/webapi/dmaap
+
+
+
+# INITIALIZE: dcaeLocation object
+JSON=/tmp/$$.loc
+cat << EOF > $JSON
+{
+"dcaeLocationName": "csit-sanfrancisco",
+"dcaeLayer": "central-cloud",
+"clli": "STABLE2345",
+"zone": "zoneA"
+
+}
+EOF
+
+curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://${DBCL_FQDN}:8080/webapi/dcaeLocations
+
+
+# INITIALIZE: MR object in 1 site
+# Note: the values in the hosts[] are fictitious, and anticipate a
+# future MR cluster deployment.
+JSON=/tmp/$$.mrc
+cat << EOF > $JSON
+{
+"dcaeLocationName": "stable-sanfrancisco",
+"fqdn": "${MR_FQDN}",
+"hosts" : [
+ "mrhost1.simpledemo.onap.org",
+ "mrhost2.simpledemo.onap.org",
+ "mrhost3.simpledemo.onap.org"
+ ],
+"protocol" : "https",
+"port": "3094"
+
+}
+EOF
+
+curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://${DBCL_FQDN}:8080/webapi/mr_clusters
diff --git a/boot/mr_install.sh b/boot/mr_install.sh
index e2168383..9bd56563 100644
--- a/boot/mr_install.sh
+++ b/boot/mr_install.sh
@@ -54,6 +54,7 @@ apt-get update
apt-get install --allow-unauthenticated -y apt-transport-https ca-certificates wget make openjdk-8-jdk git ntp ntpdate
# Download scripts from Nexus
+# a) scripts for message router (mr)
curl -k $NEXUS_REPO/org.onap.demo/boot/$ARTIFACTS_VERSION/mr_vm_init.sh -o /opt/mr_vm_init.sh
curl -k $NEXUS_REPO/org.onap.demo/boot/$ARTIFACTS_VERSION/mr_serv.sh -o /opt/mr_serv.sh
chmod +x /opt/mr_vm_init.sh
@@ -61,6 +62,14 @@ chmod +x /opt/mr_serv.sh
mv /opt/mr_serv.sh /etc/init.d
update-rc.d mr_serv.sh defaults
+# b) scripts for bus controller (dbcl)
+curl -k $NEXUS_REPO/org.onap.demo/boot/$ARTIFACTS_VERSION/dbcl_vm_init.sh -o /opt/dbcl_vm_init.sh
+curl -k $NEXUS_REPO/org.onap.demo/boot/$ARTIFACTS_VERSION/dbcl_serv.sh -o /opt/dbcl_serv.sh
+chmod +x /opt/dbcl_vm_init.sh
+chmod +x /opt/dbcl_serv.sh
+mv /opt/dbcl_serv.sh /etc/init.d
+update-rc.d dbcl_serv.sh defaults
+
# Download and install docker-engine and docker-compose
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
apt-get update
@@ -94,4 +103,4 @@ resolvconf -u
# Clone Gerrit repository and run docker containers
cd /opt
git clone -b $GERRIT_BRANCH --single-branch $CODE_REPO dcae-startup-vm-message-router
-./mr_vm_init.sh \ No newline at end of file
+./mr_vm_init.sh
diff --git a/boot/mr_vm_init.sh b/boot/mr_vm_init.sh
index af17781a..bfc44c7d 100644
--- a/boot/mr_vm_init.sh
+++ b/boot/mr_vm_init.sh
@@ -4,4 +4,6 @@ export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort
cd /opt/dcae-startup-vm-message-router
sed -i 's|wget .*|wget -q \"http://archive.apache.org/dist/kafka/${KAFKA_VERSION}/kafka_${SCALA_VERSION}-${KAFKA_VERSION}.tgz\" \\|g' deploy.sh
-bash deploy.sh \ No newline at end of file
+bash deploy.sh &
+
+bash dbcl_vm_init.sh &