From f80e6a127d51d68ff6c77196767ea8ea10e73243 Mon Sep 17 00:00:00 2001 From: lj1412 Date: Tue, 14 Feb 2017 15:12:15 +0000 Subject: Init dcae.demo Change-Id: Ifc50405276e40c6458d236cd218764573551a7aa Signed-off-by: lj1412 --- dcae-demo-controller/src/assembly/assemble_zip.xml | 62 +++++++++++++++++++ .../src/main/docker-build/.gitignore | 3 + .../src/main/docker-build/Dockerfile | 18 ++++++ .../src/main/docker-build/bash.setup.sh | 15 +++++ .../src/main/docker-build/build.sh | 35 +++++++++++ .../src/main/docker-build/config/server.private | 12 ++++ .../src/main/docker-build/config/server.public | 3 + .../src/main/docker-build/controller-install.sh | 20 +++++++ .../src/main/docker-build/controller-shutdown.sh | 17 ++++++ .../src/main/docker-build/controller-startup.sh | 70 ++++++++++++++++++++++ .../src/main/docker-build/controller.makefile | 30 ++++++++++ dcae-demo-controller/src/main/docker-build/push.sh | 19 ++++++ .../src/main/resources/settings.xml | 66 ++++++++++++++++++++ 13 files changed, 370 insertions(+) create mode 100644 dcae-demo-controller/src/assembly/assemble_zip.xml create mode 100644 dcae-demo-controller/src/main/docker-build/.gitignore create mode 100644 dcae-demo-controller/src/main/docker-build/Dockerfile create mode 100644 dcae-demo-controller/src/main/docker-build/bash.setup.sh create mode 100644 dcae-demo-controller/src/main/docker-build/build.sh create mode 100644 dcae-demo-controller/src/main/docker-build/config/server.private create mode 100644 dcae-demo-controller/src/main/docker-build/config/server.public create mode 100644 dcae-demo-controller/src/main/docker-build/controller-install.sh create mode 100644 dcae-demo-controller/src/main/docker-build/controller-shutdown.sh create mode 100644 dcae-demo-controller/src/main/docker-build/controller-startup.sh create mode 100644 dcae-demo-controller/src/main/docker-build/controller.makefile create mode 100644 dcae-demo-controller/src/main/docker-build/push.sh create mode 100644 dcae-demo-controller/src/main/resources/settings.xml (limited to 'dcae-demo-controller/src') 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 @@ + + + + runtime + + zip + + + + false + + + + target + lib + + dcae-controller-platform-server-${project.version}.jar + + + + target/assembly/ + . + + + + + . + lib + + *.jar + + + + src/main/server-gen/bin + bin + 0744 + + + + + src/main/server/bin + bin + 0744 + + + + + src/main/server-gen/scripts + scripts + + + src/main/server/scripts + scripts + + + + + 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//') + +# 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//') +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 @@ + + + + + + + open-ecomp + + true + + + + osecomp-nexus-releases + OSECOMP Release Repository + https://ecomp-nexus:8443/repository/maven-releases + + + osecomp-nexus-snapshots + OSECOMP Snapshot Repository + https://ecomp-nexus:8443/repository/maven-snapshots + + + eclipse + https://repo.eclipse.org/content/repositories/releases + + true + daily + + + false + + + + + + + + + open-ecomp + + + + + osecomp-nexus + USER + PASSWORD + + + USER + PASSWORD + osecomp-nexus-releases + + + USER + PASSWORD + osecomp-nexus-snapshots + + + USER + PASSWORD + dcae-javadoc + + + -- cgit 1.2.3-korg