diff options
Diffstat (limited to 'dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server')
10 files changed, 218 insertions, 0 deletions
diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/bin/cdap-cli.sh b/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/bin/cdap-cli.sh new file mode 100644 index 0000000..33fadd7 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/bin/cdap-cli.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +echo $(date) /opt/cdap/cli/bin/cdap-cli.sh "$@" >> logs/cdap-cli.log + +sleep 5 + +echo y | /opt/cdap/cli/bin/cdap-cli.sh "$@" + diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/bin/manager.sh b/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/bin/manager.sh new file mode 100644 index 0000000..4bf41b1 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/bin/manager.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +export JAVA_HOME=/opt/app/java/jdk/jdk170 +export GROOVY_HOME=/opt/app/groovy/246 + +PATH=$JAVA_HOME/bin:$GROOVY_HOME/bin:$PATH + +cd $(dirname $(dirname $0)) + +ROOT=$(pwd) +CMD=$ROOT/bin/controller-service-cdap-cluster-manager-controller + + +mkdir -p logs/ +echo $(date) bin/manager.sh "$@" >> logs/manager.sh.log + +CMD1=$1 +shift +VMTYPE=$(ls /tmp/vm-*manager.properties | sed s/-manager.properties// | sed sx/tmp/xx) + + +case $CMD1 in + start) + CLUSTER_FILE=data/resources/cluster.json + if [ ! -e $CLUSTER_FILE ]; then + mkdir -p $(dirname $CLUSTER_FILE) + echo '{ "baseUrl": "http://localhost:10000/v3", "pollingFrequency": "30000" }' > $CLUSTER_FILE + fi + JVMARGS=$(cat config/manager.properties | grep JVMARGS | sed 's/[^=]*=//') + $CMD $CMD1 $JVMARGS + ;; + stop|console) + $CMD $CMD1 + ;; + config) + CONFIGDIR=/var/config/DCAE/chef + if [ ! -e $CONFIGDIR/$VMTYPE-manager.properties ]; then CONFIGDIR=/tmp; fi + mkdir -p config + for FILE in $CONFIGDIR/$VMTYPE-*; do + FILE2=$(echo $FILE | sed s/.*$VMTYPE-//) + cp $FILE config/$FILE2 + done + /opt/app/dcae-controller-core-utils/bin/setup_https.sh config/manager.properties + ;; + restore|clean) + ;; + restart) + $0 stop + $0 start + ;; + restart2) + $CMD stop + JVMARGS=$(cat config/manager.properties | grep JVMARGS | sed 's/[^=]*=//') + $CMD start $JVMARGS + ;; + *) + echo unknown command: $CMD1 + ;; +esac + diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/config/console.properties b/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/config/console.properties new file mode 100644 index 0000000..4b63607 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/config/console.properties @@ -0,0 +1,3 @@ +localhost.endpoint=http://localhost:PORT +localhost.user=console +localhost.password=CONSOLE_PW diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/config/gui.properties b/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/config/gui.properties new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/config/gui.properties diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/config/log4j.properties b/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/config/log4j.properties new file mode 100644 index 0000000..8b3b8f9 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/config/log4j.properties @@ -0,0 +1,24 @@ +#log4j.debug=0 +log4j.rootLogger=warn, file +log4j.logger.org.openecomp.ncomp=info, file +log4j.additivity.org.openecomp.ncomp=false +log4j.logger.org.openecomp.ncomp.datarouter=warn, file +log4j.additivity.org.openecomp.ncomp.datarouter=false +log4j.logger.org.apache.http.headers=debug, file +log4j.logger.org.apache.http.wire=debug, file + +## uploaded logger +log4j.logger.org.openecomp.ncomp.sirius.manager.uploaded=info, uploaded +log4j.additivity.org.openecomp.ncomp.sirius.manager.uploaded=false +## request logging +log4j.logger.org.openecomp.ncomp.sirius.manager.ManagementServer.requests=info, requests +log4j.additivity.org.openecomp.ncomp.sirius.manager.ManagementServer.requests=false + + +log4j.appender.file=org.apache.log4j.RollingFileAppender +log4j.appender.file.File=logs/BBBB.log +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d %5p [%t] %m %C:%L%n +log4j.appender.file.MaxFileSize=50MB +log4j.appender.file.MaxBackupIndex=5 + diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/config/makefile b/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/config/makefile new file mode 100644 index 0000000..717823e --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/config/makefile @@ -0,0 +1,9 @@ + +restart: stop start + +start: + M2_HOME=/home/ncomp/.m2 bin/BBBB-controller start +stop: + bin/BBBB-controller stop +console: + bin/BBBB-controller console diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/config/manager.properties b/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/config/manager.properties new file mode 100644 index 0000000..4605389 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/config/manager.properties @@ -0,0 +1,7 @@ +server.dir = data/resources +metrics.dir = data/metrics +properties.dir = data/properties +server.port = PORT +server.user.console = CONSOLE_PW +server.user.gui = GUI_PW +server.user.client = CLIENT_PW diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/config/pw.sh.sh b/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/config/pw.sh.sh new file mode 100644 index 0000000..cd022ae --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/config/pw.sh.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +### used to generate random passwords + + +echo '#!/bin/bash' +echo "" + +echo 'cat \' + +for i in CONSOLE GUI CLIENT +do + echo ' |' sed s/${i}_PW/$(echo $i:$(date +%s) | sha256sum | base64 | head -c 20 ; echo)/ \\ +done +
\ No newline at end of file diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/scripts/console.groovy b/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/scripts/console.groovy new file mode 100644 index 0000000..4c21c49 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/scripts/console.groovy @@ -0,0 +1,27 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 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. + * ============LICENSE_END============================================ + */ + +import org.openecomp.dcae.controller.service.cdap.cluster.servers.manager.DcaeCdapClusterManagerConsole +import org.openecomp.ncomp.sirius.manager.console.Utils + +manager = new DcaeCdapClusterManagerConsole("console.properties","localhost") + +def p(x) { Utils.object2json(x).toString(2) } diff --git a/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/scripts/test.groovy b/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/scripts/test.groovy new file mode 100644 index 0000000..2bcbe82 --- /dev/null +++ b/dcae-controller-service-cdap/dcae-controller-service-cdap-cluster/dcae-controller-service-cdap-cluster-manager/src/main/server/scripts/test.groovy @@ -0,0 +1,65 @@ + +/*- + * ============LICENSE_START========================================== + * OPENECOMP - DCAE + * =================================================================== + * Copyright (c) 2017 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. + * ============LICENSE_END============================================ + */ + +import org.openecomp.dcae.controller.service.cdap.cluster.servers.manager.DcaeCdapClusterManagerConsole +import org.openecomp.ncomp.sirius.manager.console.Utils + +manager = new DcaeCdapClusterManagerConsole("cdap-service-test.properties","localhost") + +def p(x) { Utils.object2json(x).toString(2) } + +def m = manager + +// Begin Standard Configuration +try { + m.create("/cluster", [baseUrl:"http://localhost:10000/v3"]) +} catch (Exception e) { + println e.getMessage() +} + +def ns = "ca55" +def appId = "WebAnalytics" +def flowId = "WebAnalyticsFlow" + +// Files are on the target machine at /opt/dcae-artifact-cache +def jarfile = "/opt/app-data-cache/WebAnalytics-3.3.0.jar" +def ver = "3.3.0" + +m.createNamespace(ns) +m.deployApp(ns, jarfile) // may be rename it to deployApp? + +// we need a createApp command -- artifact + config +// m.loadArtifact(ns, "", jarfile) // for now, always use the null or blank space for the name +// there is a m.createApp() missing + +m.startFlow(ns, appId, flowId, null) + +//we have sendEvent but not loadEvents! + +//m.stopFlow(ns, appId, flowId) + +//m.deleteApp(ns, appId) + +// there is a m.deleteArtifact() missing + +// one code issue is tab-indentation? Should we convert to spaces, or keep as tabs? + +// we need some additional items! |