summaryrefslogtreecommitdiffstats
path: root/dcae-demo-controller/src
diff options
context:
space:
mode:
authorlj1412 <lji@research.att.com>2017-02-14 15:12:15 +0000
committerlj1412 <lji@research.att.com>2017-02-14 15:12:17 +0000
commitf80e6a127d51d68ff6c77196767ea8ea10e73243 (patch)
tree4d0cf0ec81578cedcf196940730685f2bbf28870 /dcae-demo-controller/src
parent055adf10fbc9893772f4d799c5af053fe098e144 (diff)
Init dcae.demo
Change-Id: Ifc50405276e40c6458d236cd218764573551a7aa Signed-off-by: lj1412 <lji@research.att.com>
Diffstat (limited to 'dcae-demo-controller/src')
-rw-r--r--dcae-demo-controller/src/assembly/assemble_zip.xml62
-rw-r--r--dcae-demo-controller/src/main/docker-build/.gitignore3
-rw-r--r--dcae-demo-controller/src/main/docker-build/Dockerfile18
-rw-r--r--dcae-demo-controller/src/main/docker-build/bash.setup.sh15
-rw-r--r--dcae-demo-controller/src/main/docker-build/build.sh35
-rw-r--r--dcae-demo-controller/src/main/docker-build/config/server.private12
-rw-r--r--dcae-demo-controller/src/main/docker-build/config/server.public3
-rw-r--r--dcae-demo-controller/src/main/docker-build/controller-install.sh20
-rw-r--r--dcae-demo-controller/src/main/docker-build/controller-shutdown.sh17
-rw-r--r--dcae-demo-controller/src/main/docker-build/controller-startup.sh70
-rw-r--r--dcae-demo-controller/src/main/docker-build/controller.makefile30
-rw-r--r--dcae-demo-controller/src/main/docker-build/push.sh19
-rw-r--r--dcae-demo-controller/src/main/resources/settings.xml66
13 files changed, 370 insertions, 0 deletions
diff --git a/dcae-demo-controller/src/assembly/assemble_zip.xml b/dcae-demo-controller/src/assembly/assemble_zip.xml
new file mode 100644
index 0000000..298661d
--- /dev/null
+++ b/dcae-demo-controller/src/assembly/assemble_zip.xml
@@ -0,0 +1,62 @@
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>runtime</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <!-- we want "system" and related files right at the root level as this
+ file is suppose to be unzip on top of a karaf distro. -->
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>lib</outputDirectory>
+ <includes>
+ <include>dcae-controller-platform-server-${project.version}.jar</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target/assembly/</directory>
+ <outputDirectory>.</outputDirectory>
+ <excludes>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>.</directory>
+ <outputDirectory>lib</outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/server-gen/bin</directory>
+ <outputDirectory>bin</outputDirectory>
+ <fileMode>0744</fileMode>
+ <excludes>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/server/bin</directory>
+ <outputDirectory>bin</outputDirectory>
+ <fileMode>0744</fileMode>
+ <excludes>
+ </excludes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/server-gen/scripts</directory>
+ <outputDirectory>scripts</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/server/scripts</directory>
+ <outputDirectory>scripts</outputDirectory>
+ </fileSet>
+
+ </fileSets>
+
+</assembly>
diff --git a/dcae-demo-controller/src/main/docker-build/.gitignore b/dcae-demo-controller/src/main/docker-build/.gitignore
new file mode 100644
index 0000000..f257a25
--- /dev/null
+++ b/dcae-demo-controller/src/main/docker-build/.gitignore
@@ -0,0 +1,3 @@
+/lib/
+/config.tar.gz
+/controller.zip
diff --git a/dcae-demo-controller/src/main/docker-build/Dockerfile b/dcae-demo-controller/src/main/docker-build/Dockerfile
new file mode 100644
index 0000000..24f7a38
--- /dev/null
+++ b/dcae-demo-controller/src/main/docker-build/Dockerfile
@@ -0,0 +1,18 @@
+FROM ubuntu:14.04
+
+ENV DEBIAN_FRONTEND noninteractive
+
+ADD controller-install.sh /tmp/controller-install.sh
+ADD controller.zip /tmp/controller.zip
+ADD config.tar.gz /opt/app/dcae-controller-platform-server
+ADD controller-startup.sh /opt/app/dcae-controller-platform-server/bin/controller-startup.sh
+ADD controller-shutdown.sh /opt/app/dcae-controller-platform-server/bin/controller-shutdown.sh
+ADD lib /opt/app/dcae-controller-platform-server/lib
+ADD config /opt/app/dcae-controller-platform-server/config
+ADD controller.makefile /opt/app/dcae-controller-platform-server/Makefile
+ADD bash.setup.sh /root/bash.setup.sh
+
+RUN /bin/bash /tmp/controller-install.sh
+
+CMD ["/bin/bash", "-c", "/opt/app/dcae-controller-platform-server/bin/controller-startup.sh"]
+
diff --git a/dcae-demo-controller/src/main/docker-build/bash.setup.sh b/dcae-demo-controller/src/main/docker-build/bash.setup.sh
new file mode 100644
index 0000000..b2120d4
--- /dev/null
+++ b/dcae-demo-controller/src/main/docker-build/bash.setup.sh
@@ -0,0 +1,15 @@
+export JAVA_HOME=/opt/app/java/jdk/jdk170
+export GROOVY_HOME=/opt/app/groovy/246
+
+PATH=$JAVA_HOME/bin:$GROOVY_HOME/bin:$PATH
+
+: ${USER:=root}
+PS1="${USER}@`hostname` \!:: "
+alias ll='ls -lrt'
+alias hi='history 100'
+alias rm='rm -i'
+bind '"\C-p": history-search-backward' '"\C-n": history-search-forward'
+
+cd /opt/app/*server
+
+export ZONE=$(grep ZONE /opt/app/dcae-controller/config.yaml | sed s/ZONE:.//)
diff --git a/dcae-demo-controller/src/main/docker-build/build.sh b/dcae-demo-controller/src/main/docker-build/build.sh
new file mode 100644
index 0000000..df42c9f
--- /dev/null
+++ b/dcae-demo-controller/src/main/docker-build/build.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+set -e
+set -x
+
+## ensure we are in the right directory.
+cd $(dirname $(readlink -e $0))
+
+ROOT=../../..
+
+## setup files
+
+rm -rf lib/
+mkdir -p lib
+
+# copy core controller ZIP file
+
+cp $ROOT/target/assembly/lib/*zip controller.zip
+VERSION=$(grep version $ROOT/pom.xml | head -1 | sed 'sX</.*XX' | sed 's/.*>//')
+
+# copy JAR required by controller
+cp $ROOT/target/assembly/lib/*.jar lib/
+
+# copy configuration files for controller
+(
+ cd $ROOT/..
+ tar cfz - OPENECOMP-DEMO OPENECOMP-DEMO-RACKSPACE
+) > config.tar.gz
+
+if [ "$1" == "nobuild" ]; then exit; fi
+
+## build Docker
+
+docker build -t dcae-controller:$VERSION .
+
diff --git a/dcae-demo-controller/src/main/docker-build/config/server.private b/dcae-demo-controller/src/main/docker-build/config/server.private
new file mode 100644
index 0000000..d22abd8
--- /dev/null
+++ b/dcae-demo-controller/src/main/docker-build/config/server.private
@@ -0,0 +1,12 @@
+MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKvTz/PWFys6+9A0XDVXxWXrwGbb
+xZgLjHRrmTCbHOFN2wRKUMAOuURxJoQ5iYs0mmKCwHqMph2CihQFNQE5oKYXa0LgZTzqLxlkqjso
+J+3hZ5dN2Vai+OUBP6z/ouJz9I+dsUHtjWdhcctXkqOq7eBxLvNVF9m7PrvdNTw3Wc8FAgMBAAEC
+gYAwVA38Vi4EEb37zI5Wzo4N4aYnCA9meXES2aSnoCkaUayVY1Wc/0cqseyUah5+kdgOdxouHdsn
+F61AfkpvQsclGhq9tstZZbX66ogFYJmzDccuKyRzOoJIv2R4wAskCaMirgXkRsPDHQqu/vaCidWP
+rWM3FIA6HV4iiPfP6KofLQJBANOpbMi6zVbxIzTzs0pCHJQRHJ57NlOCuahUTcJb6CC0fwGoRPCh
+k6YQdtVjtLwrId7GQx0UdlMBc3Dk/zyOcWMCQQDP0joQ0WrL+9TgIoaxCbkk3VHkHr/fKz1A7nsi
+K0wy5wJ/OSJdn64cmZcmEfg4EyZNmD+sXR/41tTbxlg4uJ53AkEAj3U+wRIzSKEpjqM6OrNycTzj
+29qA6LsqoJd7GKd4Pmp3xqTJDRtGWoDAOkNY5UyKqVZReK08wWezWaosAFw/JwJATI420aczXj1A
+p+hQEbtxNoFI/23MZJt7DwZK2cV1ZnLu2orje/Wsn+B8a4vHEnELdR4WppoPgw0wkF06dnqb9QJA
+PONjPqdGNsaaZU459UGImdjWXabfiVnbF5kJ1bFxSmleeewagrHL2O9dOJpgkf/izxJh/0K4aV/v
+KtwC4O8dSg==
diff --git a/dcae-demo-controller/src/main/docker-build/config/server.public b/dcae-demo-controller/src/main/docker-build/config/server.public
new file mode 100644
index 0000000..b2d3bb3
--- /dev/null
+++ b/dcae-demo-controller/src/main/docker-build/config/server.public
@@ -0,0 +1,3 @@
+MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCr08/z1hcrOvvQNFw1V8Vl68Bm28WYC4x0a5kw
+mxzhTdsESlDADrlEcSaEOYmLNJpigsB6jKYdgooUBTUBOaCmF2tC4GU86i8ZZKo7KCft4WeXTdlW
+ovjlAT+s/6Lic/SPnbFB7Y1nYXHLV5Kjqu3gcS7zVRfZuz673TU8N1nPBQIDAQAB
diff --git a/dcae-demo-controller/src/main/docker-build/controller-install.sh b/dcae-demo-controller/src/main/docker-build/controller-install.sh
new file mode 100644
index 0000000..51c4f82
--- /dev/null
+++ b/dcae-demo-controller/src/main/docker-build/controller-install.sh
@@ -0,0 +1,20 @@
+
+set -e
+
+apt-get update ; apt-get install -y maven openjdk-7-jdk curl dnsutils zip telnet
+
+### GROOVY
+(cd /opt/app ; curl -Lo apache-groovy-binary-2.4.6.zip https://dl.bintray.com/groovy/maven/apache-groovy-binary-2.4.6.zip )
+(cd /opt/app ; unzip apache-groovy-binary-2.4.6.zip )
+mkdir -p /opt/app/groovy
+ln -s /opt/app/groovy-2.4.6 /opt/app/groovy/246
+
+### JAVA
+mkdir -p /opt/app/java/jdk
+ln -s /usr /opt/app/java/jdk/jdk170
+
+mkdir -p /opt/app/dcae-controller-platform-server
+
+(cd /opt/app/dcae-controller-platform-server ; unzip -o /tmp/controller.zip)
+
+chmod +x /opt/app/dcae-controller-platform-server/bin/*
diff --git a/dcae-demo-controller/src/main/docker-build/controller-shutdown.sh b/dcae-demo-controller/src/main/docker-build/controller-shutdown.sh
new file mode 100644
index 0000000..7f8c6b3
--- /dev/null
+++ b/dcae-demo-controller/src/main/docker-build/controller-shutdown.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -v
+
+export JAVA_HOME=/opt/app/java/jdk/jdk170
+export GROOVY_HOME=/opt/app/groovy/246
+export PATH=$JAVA_HOME/bin:$GROOVY_HOME/bin:/opt/app/git/2.4.1/bin:$PATH
+
+export ZONE=$(grep ZONE /opt/app/dcae-controller/config.yaml | sed s/ZONE:.//)
+
+cd /opt/app/dcae-controller-platform-server
+
+bin/dcae-controller.sh restart
+
+bin/dcae-controller.sh undeploy-service-instance -i $ZONE -s vm-docker-host-1
+bin/dcae-controller.sh undeploy-service-instance -i $ZONE -s vm-postgresql
+bin/dcae-controller.sh undeploy-service-instance -i $ZONE -s vm-cdap-cluster
diff --git a/dcae-demo-controller/src/main/docker-build/controller-startup.sh b/dcae-demo-controller/src/main/docker-build/controller-startup.sh
new file mode 100644
index 0000000..b64f8cc
--- /dev/null
+++ b/dcae-demo-controller/src/main/docker-build/controller-startup.sh
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+set -v
+
+apt-get install -y make
+
+export JAVA_HOME=/opt/app/java/jdk/jdk170
+export GROOVY_HOME=/opt/app/groovy/246
+export PATH=$JAVA_HOME/bin:$GROOVY_HOME/bin:/opt/app/git/2.4.1/bin:$PATH
+
+
+cd /opt/app/dcae-controller-platform-server
+
+export ZONE=$(grep ZONE /opt/app/dcae-controller/config.yaml | sed s/ZONE:.//)
+
+OPENSTACK_KEYNAME=$(grep OPENSTACK-KEYNAME /opt/app/dcae-controller/config.yaml | sed s/OPENSTACK-KEYNAME:.//)
+NETWORK=$(grep OPENSTACK-PRIVATE-NETWORK /opt/app/dcae-controller/config.yaml | sed s/OPENSTACK-PRIVATE-NETWORK:.//)
+
+echo nameserver 10.0.0.1 >> /etc/resolv.conf
+
+make gen-config sync restart
+
+## need to do 2 syncs to get all references working.
+make sync
+
+cat OPENECOMP-DEMO-$ZONE/hosts >> /etc/hosts
+
+## Add SSL CAs to Java
+
+(echo changeit ; echo yes ) | keytool -importcert -keystore /etc/ssl/certs/java/cacerts -alias simpledemo-root-ca -file config/simpledemo-root-ca.crt
+(echo changeit ; echo yes ) | keytool -importcert -keystore /etc/ssl/certs/java/cacerts -alias simpledemo-server-ca -file config/simpledemo-server-ca.crt
+
+bin/dcae-controller.sh undeploy-service-instance -i $ZONE -s vm-docker-host-1 &
+bin/dcae-controller.sh undeploy-service-instance -i $ZONE -s vm-postgresql &
+bin/dcae-controller.sh undeploy-service-instance -i $ZONE -s vm-cdap-cluster &
+
+bin/dcae-controller.sh deploy-user -l $ZONE -p OPEN-ECOMP -u $OPENSTACK_KEYNAME
+
+NETWORKPATH=/openstack/locations/$ZONE/projects/OPEN-ECOMP/networks/$NETWORK
+
+sleep 1m
+bin/dcae-controller.sh wait-for --timeout 300 --frequency 5 --path $NETWORKPATH --exists --verbose
+bin/dcae-controller.sh deploy-service-instance -i $ZONE -s vm-docker-host-1
+
+sleep 1m
+bin/dcae-controller.sh wait-for --timeout 300 --frequency 5 --path $NETWORKPATH --exists --verbose
+bin/dcae-controller.sh deploy-service-instance -i $ZONE -s vm-postgresql
+
+sleep 2m
+bin/dcae-controller.sh wait-for --timeout 300 --frequency 5 --path $NETWORKPATH --exists --verbose
+bin/dcae-controller.sh deploy-service-instance -i $ZONE -s vm-cdap-cluster
+
+bin/dcae-controller.sh wait-for --timeout 900 --path /services/vm-docker-host-1/instances/$ZONE --attribute healthTestStatus --match GREEN --verbose
+bin/dcae-controller.sh wait-for --timeout 900 --path /services/vm-postgresql/instances/$ZONE --attribute healthTestStatus --match GREEN --verbose
+
+
+bin/dcae-controller.sh deploy-service-instance -i $ZONE -s docker-databus-controller
+
+
+
+bin/dcae-controller.sh wait-for --timeout 900 --path /services/vm-cdap-cluster/instances/$ZONE --attribute healthTestStatus --match GREEN --verbose
+#bin/dcae-controller.sh wait-for --timeout 900 --path /services/vm-controller/instances/$ZONE --attribute healthTestStatus --match GREEN --verbose
+
+bin/dcae-controller.sh deploy-service-instance -i $ZONE -s cdap-helloworld
+bin/dcae-controller.sh deploy-service-instance -i $ZONE -s cdap-tca-hi-lo
+bin/dcae-controller.sh deploy-service-instance -i $ZONE -s docker-common-event
+
+
+while [ 1 ]; do sleep 1d; done
+
diff --git a/dcae-demo-controller/src/main/docker-build/controller.makefile b/dcae-demo-controller/src/main/docker-build/controller.makefile
new file mode 100644
index 0000000..40b570e
--- /dev/null
+++ b/dcae-demo-controller/src/main/docker-build/controller.makefile
@@ -0,0 +1,30 @@
+
+restart: stop start
+gen-config:
+ bin/dcae-controller.sh rackspace-substitute --from OPENECOMP-DEMO-RACKSPACE --to OPENECOMP-DEMO-$(ZONE) --file /opt/app/dcae-controller/config.yaml
+ java -cp 'lib/*' org.openecomp.dcae.controller.operation.utils.GenControllerConfiguration $(ZONE) . GITLINK OPENECOMP-DEMO
+sync:
+ bin/dcae-controller.sh sync-configuration --environment OPENECOMP-DEMO-$(ZONE)
+sync-careful:
+ bin/dcae-controller.sh stop
+ rm -r data/resources/databus*
+ rm -r data/resources/services/vm-*/instances/*/steps
+ rm -r data/resources/services/docker-*/instances/*
+ rm -r data/resources/services/cdap-*/instances/*
+ bin/dcae-controller.sh sync-configuration --environment OPENECOMP-DEMO-$(ZONE)
+start:
+ bin/dcae-controller.sh start
+start-debug:
+ bin/controller-platform-server-controller start -Djavax.net.debug=all
+stop:
+ bin/dcae-controller.sh stop
+console:
+ bin/dcae-controller.sh console
+S=3600
+wait:
+ @GROOVY_HOME=/opt/app/groovy/246 bin/dcae-controller.sh wait-for --timeout $S --path /services/docker-common-event/instances/$(ZONE) --attribute healthTestStatus --match GREEN
+ @GROOVY_HOME=/opt/app/groovy/246 bin/dcae-controller.sh wait-for --timeout 300 --path /services/cdap-tca-hi-lo/instances/$(ZONE) --attribute healthTestStatus --match GREEN
+status:
+ @GROOVY_HOME=/opt/app/groovy/246 bin/dcae-controller.sh report -n /reports/dcae/service-instances | cut -d\| -f 2,3,4,5,6 | grep DEP | grep -v cells | cut -c1-120
+ @GROOVY_HOME=/opt/app/groovy/246 bin/dcae-controller.sh report -n /reports/dcae/vms | cut -d\| -f 4,8 | grep zldc | grep -v cells
+ @cat logs/error.log | cut -d\| -f 4,5,13 | sort | uniq -c
diff --git a/dcae-demo-controller/src/main/docker-build/push.sh b/dcae-demo-controller/src/main/docker-build/push.sh
new file mode 100644
index 0000000..dd43aa9
--- /dev/null
+++ b/dcae-demo-controller/src/main/docker-build/push.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+set -e
+set -x
+
+## ensure we are in the right directory.
+cd $(dirname $(readlink -e $0))
+
+GITROOT=../../../../..
+VERSION=$(grep version $GITROOT/pom.xml | head -1 | sed 'sX</.*XX' | sed 's/.*>//')
+USER=$1
+PASSWORD=$2
+DOCKER_REG=$3
+TAG=$DOCKER_REG/dcae-controller:$VERSION
+
+docker tag dcae-controller:$VERSION $TAG
+docker login -u $USER -p $PASSWORD $DOCKER_REG
+docker push $TAG
+
diff --git a/dcae-demo-controller/src/main/resources/settings.xml b/dcae-demo-controller/src/main/resources/settings.xml
new file mode 100644
index 0000000..6432c83
--- /dev/null
+++ b/dcae-demo-controller/src/main/resources/settings.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
+
+ <profiles>
+ <profile>
+ <id>open-ecomp</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <repositories>
+ <repository>
+ <id>osecomp-nexus-releases</id>
+ <name>OSECOMP Release Repository</name>
+ <url>https://ecomp-nexus:8443/repository/maven-releases</url>
+ </repository>
+ <repository>
+ <id>osecomp-nexus-snapshots</id>
+ <name>OSECOMP Snapshot Repository</name>
+ <url>https://ecomp-nexus:8443/repository/maven-snapshots</url>
+ </repository>
+ <repository>
+ <id>eclipse</id>
+ <url>https://repo.eclipse.org/content/repositories/releases</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>daily</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ </profile>
+
+ </profiles>
+
+ <activeProfiles>
+ <activeProfile>open-ecomp</activeProfile>
+ </activeProfiles>
+
+ <servers>
+ <server>
+ <id>osecomp-nexus</id>
+ <username>USER</username>
+ <password>PASSWORD</password>
+ </server>
+ <server>
+ <username>USER</username>
+ <password>PASSWORD</password>
+ <id>osecomp-nexus-releases</id>
+ </server>
+ <server>
+ <username>USER</username>
+ <password>PASSWORD</password>
+ <id>osecomp-nexus-snapshots</id>
+ </server>
+ <server>
+ <username>USER</username>
+ <password>PASSWORD</password>
+ <id>dcae-javadoc</id>
+ </server>
+ </servers>
+</settings>