creates the Zookeeper image 76/73176/1
authorsunil unnava <sunil.unnava@att.com>
Tue, 20 Nov 2018 19:43:42 +0000 (14:43 -0500)
committersunil unnava <sunil.unnava@att.com>
Tue, 20 Nov 2018 19:46:49 +0000 (14:46 -0500)
Change-Id: I79153cd5f89bb1897c3ec11a96113604378aacee
Issue-ID: DMAAP-888
Signed-off-by: sunil unnava <sunil.unnava@att.com>
LICENSE.txt [new file with mode: 0644]
pom.xml [new file with mode: 0644]
src/main/docker/Dockerfile [new file with mode: 0644]
src/main/docker/scripts/start-zookeeper [new file with mode: 0644]
src/main/docker/scripts/zookeeper-metrics [new file with mode: 0644]
src/main/docker/scripts/zookeeper-ready [new file with mode: 0644]
version.properties [new file with mode: 0644]

diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644 (file)
index 0000000..9f4d98d
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+* ============LICENSE_START==========================================
+* ===================================================================
+* Copyright © 2018 AT&T Intellectual Property. All rights reserved.
+* ===================================================================
+*
+* Unless otherwise specified, all software contained herein is licensed
+* under the Apache License, Version 2.0 (the “License”);
+* you may not use this software 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.
+*
+*
+*
+* Unless otherwise specified, all documentation contained herein is licensed
+* under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
+* you may not use this documentation except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*             https://creativecommons.org/licenses/by/4.0/
+*
+* Unless required by applicable law or agreed to in writing, documentation
+* 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============================================
+*
+* 
+*
+*/
diff --git a/pom.xml b/pom.xml
new file mode 100644 (file)
index 0000000..e137bed
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,241 @@
+<?xml version="1.0"?>
+<!-- ============LICENSE_START======================================================= 
+       org.onap.dmaap ================================================================================ 
+       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. ============LICENSE_END========================================================= 
+       ECOMP is a trademark and service mark of AT&T Intellectual Property. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+
+       <parent>
+               <groupId>org.onap.oparent</groupId>
+               <artifactId>oparent</artifactId>
+               <version>1.2.1</version>
+       </parent>
+
+       <groupId>org.onap.dmaap.zookeeper</groupId>
+       <artifactId>zookeepr</artifactId>
+       <version>1.0.0-SNAPSHOT</version>
+       <name>zookeeper</name>
+       <licenses>
+               <license>
+                       <name>Apache License Version 2.0</name>
+               </license>
+       </licenses>
+
+       <developers>
+               <developer>
+                       <name>Sunil Unnava</name>
+                       <email/>
+                       <organization>ATT</organization>
+                       <organizationUrl>www.att.com</organizationUrl>
+               </developer>
+       </developers>
+
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-site-plugin</artifactId>
+                               <version>3.6</version>
+                               <dependencies>
+                                       <dependency>
+                                               <groupId>org.apache.maven.wagon</groupId>
+                                               <artifactId>wagon-webdav-jackrabbit</artifactId>
+                                               <version>2.10</version>
+                                       </dependency>
+                               </dependencies>
+                       </plugin>
+
+                       <!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> 
+                               <version>3.0.2</version> </plugin> -->
+
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-source-plugin</artifactId>
+                               <version>3.0.0</version>
+                               <executions>
+                                       <execution>
+                                               <id>attach-sources</id>
+                                               <goals>
+                                                       <goal>jar-no-fork</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-release-plugin</artifactId>
+                               <version>2.5.3</version>
+                               <configuration>
+                                       <autoVersionSubmodules>true</autoVersionSubmodules>
+                                       <checkModificationExcludes>
+                                       </checkModificationExcludes>
+                               </configuration>
+                               <dependencies>
+                                       <dependency>
+                                               <groupId>org.apache.maven.scm</groupId>
+                                               <artifactId>maven-scm-provider-gitexe</artifactId>
+                                               <version>1.9.4</version>
+                                       </dependency>
+                               </dependencies>
+                       </plugin>
+
+                       <plugin>
+                               <groupId>org.sonatype.plugins</groupId>
+                               <artifactId>nexus-staging-maven-plugin</artifactId>
+                               <extensions>false</extensions>
+                               <executions>
+                                       <execution>
+                                               <id>injected-nexus-deploy</id>
+                                               <phase>none</phase>
+                                       </execution>
+                               </executions>
+                       </plugin>
+                       <plugin>
+                               <artifactId>maven-deploy-plugin</artifactId>
+                               <version>2.8</version>
+                               <executions>
+                                       <execution>
+                                               <id>default-deploy</id>
+                                               <phase>none</phase>
+                                               <configuration>
+                                                       <skip />
+                                               </configuration>
+                                       </execution>
+                               </executions>
+                               <configuration>
+                                       <skip />
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <groupId>com.spotify</groupId>
+                               <artifactId>docker-maven-plugin</artifactId>
+                               <version>1.0.0</version>
+                               <configuration>
+                                       <imageName>onap/dmaap/zookeeper</imageName>
+                                       <dockerDirectory>src/main/docker</dockerDirectory>
+                                       <serverId>docker-hub</serverId>
+                                       <imageTags>
+                                               <imageTag>${zookeeperImg}</imageTag>
+                                               <imageTag>latest</imageTag>
+                                       </imageTags>
+                                       <forceTags>true</forceTags>
+                                       <resources>
+                                               <!-- <resource> <targetPath>/</targetPath> <directory>${dockerLocation}</directory> 
+                                                       <include>${project.build.finalName}.jar</include> </resource> -->
+                                               <resource>
+                                                       <targetPath>/</targetPath>
+                                                       <directory>${project.build.directory}</directory>
+                                                       <include>**/**</include>
+                                               </resource>
+                                       </resources>
+                               </configuration>
+                               <executions>
+                                       <execution>
+                                               <id>build-image</id>
+                                               <phase>install</phase>
+                                               <goals>
+                                                       <goal>build</goal>
+                                               </goals>
+                                               <configuration>
+                                                       <skipDockerBuild>${skip.docker.build}</skipDockerBuild>
+                                               </configuration>
+                                       </execution>
+
+                                       <execution>
+                                               <id>tag-image-project-version</id>
+                                               <phase>install</phase>
+                                               <goals>
+                                                       <goal>tag</goal>
+                                               </goals>
+                                               <configuration>
+                                                       <image>onap/dmaap/zookeeper</image>
+                                                       <newName>${docker.push.registry}/onap/dmaap/zookeeper1:${zookeeperImg}</newName>
+                                                       <skipDockerTag>${skip.docker.push}</skipDockerTag>
+                                               </configuration>
+                                       </execution>
+
+                                       <execution>
+                                               <id>tag-image-latest</id>
+                                               <phase>install</phase>
+                                               <goals>
+                                                       <goal>tag</goal>
+                                               </goals>
+                                               <configuration>
+                                                       <image>onap/dmaap/zookeeper</image>
+                                                       <newName>${docker.push.registry}/onap/dmaap/zookeeper:latest</newName>
+                                                       <skipDockerTag>${skip.docker.push}</skipDockerTag>
+                                               </configuration>
+                                       </execution>
+
+                                       <execution>
+                                               <id>push-image</id>
+                                               <phase>deploy</phase>
+                                               <goals>
+                                                       <goal>push</goal>
+                                               </goals>
+                                               <configuration>
+                                                       <imageName>${docker.push.registry}/onap/dmaap/zookeeper:${zookeeperImg}</imageName>
+                                                       <skipDockerPush>${skip.docker.push}</skipDockerPush>
+                                               </configuration>
+                                       </execution>
+
+                                       <execution>
+                                               <id>push-image-latest</id>
+                                               <phase>deploy</phase>
+                                               <goals>
+                                                       <goal>push</goal>
+                                               </goals>
+                                               <configuration>
+                                                       <imageName>${docker.push.registry}/onap/dmaap/zookeeper:latest</imageName>
+                                                       <skipDockerPush>${skip.docker.push}</skipDockerPush>
+                                               </configuration>
+                                       </execution>
+                               </executions>
+                       </plugin>
+
+               </plugins>
+       </build>
+
+       <properties>
+               <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+               <zookeeperImg>1.0.0</zookeeperImg>
+               <sitePath>/content/sites/site/org/onap/dmaap/zookeeper/${project.artifactId}/${project.version}</sitePath>
+               <skip.docker.build>true</skip.docker.build>
+               <skip.docker.push>true</skip.docker.push>
+               <nexusproxy>https://nexus.onap.org</nexusproxy>
+               <docker.push.registry>nexus3.onap.org:10003</docker.push.registry>
+               <onap.nexus.url>https://nexus.onap.org</onap.nexus.url>
+       </properties>
+
+       <!-- Distribution management -->
+       <distributionManagement>
+               <site>
+                       <id>ecomp-site</id>
+                       <url>dav:${nexusproxy}${sitePath}</url>
+               </site>
+       </distributionManagement>
+
+       <dependencies>
+       </dependencies>
+
+       <profiles>
+               <profile>
+                       <id>docker</id>
+                       <properties>
+                               <skip.docker.build>false</skip.docker.build>
+                               <skip.docker.tag>false</skip.docker.tag>
+                               <skip.docker.push>false</skip.docker.push>
+                       </properties>
+               </profile>
+
+       </profiles>
+
+</project>
diff --git a/src/main/docker/Dockerfile b/src/main/docker/Dockerfile
new file mode 100644 (file)
index 0000000..905b27d
--- /dev/null
@@ -0,0 +1,55 @@
+FROM ubuntu:16.04 
+ENV ZK_USER=zookeeper \
+ZK_DATA_DIR=/var/lib/zookeeper/data \
+ZK_DATA_LOG_DIR=/var/lib/zookeeper/log \
+ZK_LOG_DIR=/var/log/zookeeper \
+JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
+
+ARG GPG_KEY=C823E3E5B12AF29C67F81976F5CECB3CB5E9BD2D
+ARG ZK_DIST=zookeeper-3.4.10
+RUN set -x \
+    && apt-get update \
+    && apt-get install -y openjdk-8-jre-headless wget netcat-openbsd \
+       && wget -q "http://www.apache.org/dist/zookeeper/$ZK_DIST/$ZK_DIST.tar.gz" \
+    && wget -q "http://www.apache.org/dist/zookeeper/$ZK_DIST/$ZK_DIST.tar.gz.asc" \
+    && export GNUPGHOME="$(mktemp -d)" \
+    && gpg --keyserver ha.pool.sks-keyservers.net --recv-key "$GPG_KEY" \
+    && gpg --batch --verify "$ZK_DIST.tar.gz.asc" "$ZK_DIST.tar.gz" \
+    && tar -xzf "$ZK_DIST.tar.gz" -C /opt \
+    && rm -r "$GNUPGHOME" "$ZK_DIST.tar.gz" "$ZK_DIST.tar.gz.asc" \
+    && ln -s /opt/$ZK_DIST /opt/zookeeper \
+    && rm -rf /opt/zookeeper/CHANGES.txt \
+    /opt/zookeeper/README.txt \
+    /opt/zookeeper/NOTICE.txt \
+    /opt/zookeeper/CHANGES.txt \
+    /opt/zookeeper/README_packaging.txt \
+    /opt/zookeeper/build.xml \
+    /opt/zookeeper/config \
+    /opt/zookeeper/contrib \
+    /opt/zookeeper/dist-maven \
+    /opt/zookeeper/docs \
+    /opt/zookeeper/ivy.xml \
+    /opt/zookeeper/ivysettings.xml \
+    /opt/zookeeper/recipes \
+    /opt/zookeeper/src \
+    /opt/zookeeper/$ZK_DIST.jar.asc \
+    /opt/zookeeper/$ZK_DIST.jar.md5 \
+    /opt/zookeeper/$ZK_DIST.jar.sha1 \
+       && apt-get autoremove -y wget \
+       && rm -rf /var/lib/apt/lists/*
+
+#Copy configuration generator script to bin
+COPY scripts /opt/zookeeper/bin/
+
+# Create a user for the zookeeper process and configure file system ownership 
+# for nessecary directories and symlink the distribution as a user executable
+RUN set -x \
+       && useradd $ZK_USER \
+    && [ `id -u $ZK_USER` -eq 1000 ] \
+    && [ `id -g $ZK_USER` -eq 1000 ] \
+    && mkdir -p $ZK_DATA_DIR $ZK_DATA_LOG_DIR $ZK_LOG_DIR /usr/share/zookeeper /tmp/zookeeper /usr/etc/ \
+       && chown -R "$ZK_USER:$ZK_USER" /opt/$ZK_DIST $ZK_DATA_DIR $ZK_LOG_DIR $ZK_DATA_LOG_DIR /tmp/zookeeper \
+       && ln -s /opt/zookeeper/conf/ /usr/etc/zookeeper \
+       && ln -s /opt/zookeeper/bin/* /usr/bin \
+       && ln -s /opt/zookeeper/$ZK_DIST.jar /usr/share/zookeeper/ \
+       && ln -s /opt/zookeeper/lib/* /usr/share/zookeeper 
diff --git a/src/main/docker/scripts/start-zookeeper b/src/main/docker/scripts/start-zookeeper
new file mode 100644 (file)
index 0000000..25fe466
--- /dev/null
@@ -0,0 +1,252 @@
+USER=`whoami`
+HOST=`hostname -s`
+DOMAIN=`hostname -d`
+LOG_LEVEL=INFO
+DATA_DIR="/var/lib/zookeeper/data"
+DATA_LOG_DIR="/var/lib/zookeeper/log"
+LOG_DIR="/var/log/zookeeper"
+CONF_DIR="/opt/zookeeper/conf"
+CLIENT_PORT=2181
+SERVER_PORT=2888
+ELECTION_PORT=3888
+TICK_TIME=2000
+INIT_LIMIT=10
+SYNC_LIMIT=5
+HEAP=2G
+MAX_CLIENT_CNXNS=60
+SNAP_RETAIN_COUNT=3
+PURGE_INTERVAL=0
+SERVERS=1
+
+function print_usage() {
+echo "\
+Usage: start-zookeeper [OPTIONS]
+Starts a ZooKeeper server based on the supplied options.
+    --servers           The number of servers in the ensemble. The default 
+                        value is 1.
+
+    --data_dir          The directory where the ZooKeeper process will store its
+                        snapshots. The default is /var/lib/zookeeper/data.
+
+    --data_log_dir      The directory where the ZooKeeper process will store its 
+                        write ahead log. The default is 
+                        /var/lib/zookeeper/data/log.
+
+    --conf_dir          The directoyr where the ZooKeeper process will store its
+                        configuration. The default is /opt/zookeeper/conf.
+
+    --client_port       The port on which the ZooKeeper process will listen for 
+                        client requests. The default is 2181.
+
+    --election_port     The port on which the ZooKeeper process will perform 
+                        leader election. The default is 3888.
+
+    --server_port       The port on which the ZooKeeper process will listen for 
+                        requests from other servers in the ensemble. The 
+                        default is 2888. 
+
+    --tick_time         The length of a ZooKeeper tick in ms. The default is 
+                        2000.
+
+    --init_limit        The number of Ticks that an ensemble member is allowed 
+                        to perform leader election. The default is 10.
+
+    --sync_limit        The maximum session timeout that the ensemble will 
+                        allows a client to request. The default is 5.
+
+    --heap              The maximum amount of heap to use. The format is the 
+                        same as that used for the Xmx and Xms parameters to the 
+                        JVM. e.g. --heap=2G. The default is 2G.
+
+    --max_client_cnxns  The maximum number of client connections that the 
+                        ZooKeeper process will accept simultaneously. The 
+                        default is 60.
+
+    --snap_retain_count The maximum number of snapshots the ZooKeeper process 
+                        will retain if purge_interval is greater than 0. The 
+                        default is 3.
+
+    --purge_interval    The number of hours the ZooKeeper process will wait 
+                        between purging its old snapshots. If set to 0 old 
+                        snapshots will never be purged. The default is 0.
+
+    --max_session_timeout The maximum time in milliseconds for a client session 
+                        timeout. The default value is 2 * tick time.
+
+    --min_session_timeout The minimum time in milliseconds for a client session 
+                        timeout. The default value is 20 * tick time.
+
+    --log_level         The log level for the zookeeeper server. Either FATAL,
+                        ERROR, WARN, INFO, DEBUG. The default is INFO.
+      
+    --pre_alloc_size    Allocates space in the transaction log file in blocks of preAllocSize kilobytes.
+                       The default block size is 64M. 
+"
+}
+
+function create_data_dirs() {
+    if [ ! -d $DATA_DIR  ]; then
+        mkdir -p $DATA_DIR
+        chown -R $USER:$USER $DATA_DIR
+    fi
+
+    if [ ! -d $DATA_LOG_DIR  ]; then
+        mkdir -p $DATA_LOG_DIR
+        chown -R $USER:USER $DATA_LOG_DIR
+    fi
+
+    if [ ! -d $LOG_DIR  ]; then
+        mkdir -p $LOG_DIR
+        chown -R $USER:$USER $LOG_DIR
+    fi
+    if [ ! -f $ID_FILE ] && [ $SERVERS -gt 1 ]; then
+        echo $MY_ID >> $ID_FILE
+    fi
+}
+
+function print_servers() {
+    for (( i=1; i<=$SERVERS; i++ ))
+    do
+        echo "server.$i=$NAME-$((i-1)).$DOMAIN:$SERVER_PORT:$ELECTION_PORT"
+    done
+}
+
+function create_config() {
+    rm -f $CONFIG_FILE
+    echo "#This file was autogenerated DO NOT EDIT" >> $CONFIG_FILE
+    echo "clientPort=$CLIENT_PORT" >> $CONFIG_FILE
+    echo "dataDir=$DATA_DIR" >> $CONFIG_FILE
+    echo "dataLogDir=$DATA_LOG_DIR" >> $CONFIG_FILE
+    echo "tickTime=$TICK_TIME" >> $CONFIG_FILE
+    echo "initLimit=$INIT_LIMIT" >> $CONFIG_FILE
+    echo "syncLimit=$SYNC_LIMIT" >> $CONFIG_FILE
+    echo "maxClientCnxns=$MAX_CLIENT_CNXNS" >> $CONFIG_FILE
+    echo "minSessionTimeout=$MIN_SESSION_TIMEOUT" >> $CONFIG_FILE
+    echo "maxSessionTimeout=$MAX_SESSION_TIMEOUT" >> $CONFIG_FILE
+    echo "autopurge.snapRetainCount=$SNAP_RETAIN_COUNT" >> $CONFIG_FILE
+    echo "autopurge.purgeInteval=$PURGE_INTERVAL" >> $CONFIG_FILE
+    echo "preAllocSize=$PRE_ALLOC_SIZE" >> $CONFIG_FILE
+     if [ $SERVERS -gt 1 ]; then
+        print_servers >> $CONFIG_FILE
+    fi
+    cat $CONFIG_FILE >&2
+}
+
+function create_jvm_props() {
+    rm -f $JAVA_ENV_FILE
+    echo "ZOO_LOG_DIR=$LOG_DIR" >> $JAVA_ENV_FILE
+    echo "JVMFLAGS=\"-Xmx$HEAP -Xms$HEAP\"" >> $JAVA_ENV_FILE
+}
+
+function create_log_props() {
+    rm -f $LOGGER_PROPS_FILE
+    echo "Creating ZooKeeper log4j configuration"
+    echo "zookeeper.root.logger=CONSOLE" >> $LOGGER_PROPS_FILE
+    echo "zookeeper.console.threshold="$LOG_LEVEL >> $LOGGER_PROPS_FILE
+    echo "log4j.rootLogger=\${zookeeper.root.logger}" >> $LOGGER_PROPS_FILE
+    echo "log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender" >> $LOGGER_PROPS_FILE
+    echo "log4j.appender.CONSOLE.Threshold=\${zookeeper.console.threshold}" >> $LOGGER_PROPS_FILE
+    echo "log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout" >> $LOGGER_PROPS_FILE
+    echo "log4j.appender.CONSOLE.layout.ConversionPattern=%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n" >> $LOGGER_PROPS_FILE
+}
+
+optspec=":hv-:"
+while getopts "$optspec" optchar; do
+
+    case "${optchar}" in
+        -)
+            case "${OPTARG}" in
+                servers=*)
+                    SERVERS=${OPTARG##*=}
+                    ;;
+                data_dir=*)
+                    DATA_DIR=${OPTARG##*=}
+                    ;;
+                data_log_dir=*)
+                    DATA_LOG_DIR=${OPTARG##*=}
+                    ;;
+                log_dir=*)
+                    LOG_DIR=${OPTARG##*=}
+                    ;;
+                conf_dir=*)
+                    CONF_DIR=${OPTARG##*=}
+                    ;;
+                client_port=*)
+                    CLIENT_PORT=${OPTARG##*=}
+                    ;;
+                election_port=*)
+                    ELECTION_PORT=${OPTARG##*=}
+                    ;;
+                server_port=*)
+                    SERVER_PORT=${OPTARG##*=}
+                    ;;
+                tick_time=*)
+                    TICK_TIME=${OPTARG##*=}
+                    ;;
+                init_limit=*)
+                    INIT_LIMIT=${OPTARG##*=}
+                    ;;
+                sync_limit=*)
+                    SYNC_LIMIT=${OPTARG##*=}
+                    ;;
+                heap=*)
+                    HEAP=${OPTARG##*=}
+                    ;;
+                max_client_cnxns=*)
+                    MAX_CLIENT_CNXNS=${OPTARG##*=}
+                    ;;
+                snap_retain_count=*)
+                    SNAP_RETAIN_COUNT=${OPTARG##*=}
+                    ;;
+                purge_interval=*)
+                    PURGE_INTERVAL=${OPTARG##*=}
+                    ;;
+                max_session_timeout=*)
+                    MAX_SESSION_TIMEOUT=${OPTARG##*=}
+                    ;;
+                min_session_timeout=*)
+                    MIN_SESSION_TIMEOUT=${OPTARG##*=}
+                    ;;
+                log_level=*)
+                    LOG_LEVEL=${OPTARG##*=}
+                    ;;
+                pre_alloc_size=*)
+                    PRE_ALLOC_SIZE=${OPTARG##*=}
+                    ;;
+                *)
+                    echo "Unknown option --${OPTARG}" >&2
+                    exit 1
+                    ;;
+            esac;;
+        h)
+            print_usage
+            exit
+            ;;
+        v)
+            echo "Parsing option: '-${optchar}'" >&2
+            ;;
+        *)
+            if [ "$OPTERR" != 1 ] || [ "${optspec:0:1}" = ":" ]; then
+                echo "Non-option argument: '-${OPTARG}'" >&2
+            fi
+            ;;
+    esac
+done
+
+MIN_SESSION_TIMEOUT=${MIN_SESSION_TIMEOUT:- $((TICK_TIME*2))}
+MAX_SESSION_TIMEOUT=${MAX_SESSION_TIMEOUT:- $((TICK_TIME*20))}
+ID_FILE="$DATA_DIR/myid"
+CONFIG_FILE="$CONF_DIR/zoo.cfg"
+LOGGER_PROPS_FILE="$CONF_DIR/log4j.properties"
+JAVA_ENV_FILE="$CONF_DIR/java.env"
+if [[ $HOST =~ (.*)-([0-9]+)$ ]]; then
+    NAME=${BASH_REMATCH[1]}
+    ORD=${BASH_REMATCH[2]}
+else
+    echo "Fialed to parse name and ordinal of Pod"
+    exit 1
+fi
+
+MY_ID=$((ORD+1))
+
+create_config && create_jvm_props && create_log_props && create_data_dirs && exec zkServer.sh start-foreground
\ No newline at end of file
diff --git a/src/main/docker/scripts/zookeeper-metrics b/src/main/docker/scripts/zookeeper-metrics
new file mode 100644 (file)
index 0000000..f7ed780
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+# Copyright 2017 The Kubernetes Authors.
+#
+# 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.
+
+echo mntr | nc localhost $1 >& 1
\ No newline at end of file
diff --git a/src/main/docker/scripts/zookeeper-ready b/src/main/docker/scripts/zookeeper-ready
new file mode 100644 (file)
index 0000000..2a27252
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+# Copyright 2017 The Kubernetes Authors.
+#
+# 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.
+
+# zkOk.sh uses the ruok ZooKeeper four letter work to determine if the instance
+# is health. The $? variable will be set to 0 if server responds that it is 
+# healthy, or 1 if the server fails to respond.
+
+OK=$(echo ruok | nc 127.0.0.1 $1)
+if [ "$OK" == "imok" ]; then
+       exit 0
+else
+       exit 1
+fi
\ No newline at end of file
diff --git a/version.properties b/version.properties
new file mode 100644 (file)
index 0000000..65e7bbc
--- /dev/null
@@ -0,0 +1,35 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP CLAMP
+# ================================================================================
+# 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============================================
+# ===================================================================
+###
+
+# Versioning variables
+# Note that these variables cannot be structured (e.g. : version.release or version.snapshot etc... )
+# because they are used in Jenkins, whose plug-in doesn't support
+
+major=1
+minor=0
+patch=0
+
+base_version=${major}.${minor}.${patch}
+
+# Release must be completed with git revision # in Jenkins
+release_version=${base_version}
+snapshot_version=${base_version}-SNAPSHOT