diff options
-rw-r--r-- | pom.xml | 308 | ||||
-rw-r--r-- | src/main/docker/Dockerfile | 40 | ||||
-rw-r--r-- | src/main/docker/include/etc/confluent/docker/configure | 33 | ||||
-rw-r--r-- | src/main/docker/include/etc/confluent/docker/log4j.properties.template | 2 | ||||
-rw-r--r-- | src/main/docker/include/etc/confluent/docker/run | 2 | ||||
-rw-r--r-- | src/main/docker/include/etc/confluent/docker/tools-log4j.properties.template | 1 | ||||
-rw-r--r-- | src/main/docker/include/etc/confluent/docker/zookeeper.properties.template | 51 | ||||
-rw-r--r-- | src/main/docker/scripts/start-zookeeper.sh | 157 | ||||
-rw-r--r-- | src/main/docker/scripts/zookeeper-metrics.sh | 4 | ||||
-rw-r--r-- | src/main/docker/scripts/zookeeper-ready.sh | 9 | ||||
-rw-r--r-- | src/main/docker/zk_server_jaas.conf | 4 | ||||
-rw-r--r-- | version.properties | 4 |
12 files changed, 167 insertions, 448 deletions
@@ -10,211 +10,107 @@ 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>2.1.0</version> - </parent> - - <groupId>org.onap.dmaap.zookeeper</groupId> - <artifactId>zookeeper</artifactId> - <version>6.0.4-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> - <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> - </plugins> - </build> - - <properties> - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <timestamp>${maven.build.timestamp}</timestamp> +<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>3.2.0</version> + </parent> + <groupId>org.onap.dmaap.zookeeper</groupId> + <artifactId>zookeeper</artifactId> + <version>6.1.0-SNAPSHOT</version> + <name>zookeeper</name> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <timestamp>${maven.build.timestamp}</timestamp> <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format> - <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> - <zookeeper.dist.version>3.4.13</zookeeper.dist.version> - </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> - <build> - <plugins> - <plugin> - <groupId>org.codehaus.groovy.maven</groupId> - <artifactId>gmaven-plugin</artifactId> - <executions> - <execution> - <phase>validate</phase> - <goals> - <goal>execute</goal> - </goals> - <configuration> - <properties> - <ver>${project.version}</ver> - <timestamp>${maven.build.timestamp}</timestamp> - </properties> - <source> - println project.properties['ver']; - if ( project.properties['ver'].endsWith("-SNAPSHOT") ) { - project.properties['dockertag1']=project.properties['ver'] + "-latest"; - project.properties['dockertag2']=project.properties['ver'] + "-" + project.properties['timestamp']; - } else { - project.properties['dockertag1']=project.properties['ver'] + "-STAGING-latest"; - project.properties['dockertag2']=project.properties['ver'] + "-STAGING-" + project.properties['timestamp']; - } - println 'docker tag 1: ' + project.properties['dockertag1']; - println 'docker tag 2: ' + project.properties['dockertag2']; - </source> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>io.fabric8</groupId> - <artifactId>docker-maven-plugin</artifactId> - <version>0.28.0</version> - <configuration> - <verbose>${docker.verbose}</verbose> - <apiVersion>${docker.apiVersion}</apiVersion> - <pullRegistry>${docker.pull.registry}</pullRegistry> - <pushRegistry>${docker.push.registry}</pushRegistry> - <images> - <image> - <name>onap/dmaap/zookeeper</name> - <build> - <cleanup>try</cleanup> - <dockerFile>Dockerfile</dockerFile> - <tags> - <tag>${dockertag1}</tag> - <tag>${dockertag2}</tag> - </tags> - </build> - </image> - </images> - </configuration> - <executions> - <execution> - <id>generate-images</id> - <phase>install</phase> - <goals> - <goal>build</goal> - </goals> - </execution> - <execution> - <id>push-images</id> - <phase>deploy</phase> - <goals> - <goal>push</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - - </profiles> - + <docker.push.registry>nexus3.onap.org:10003</docker.push.registry> + <onap.nexus.url>https://nexus.onap.org</onap.nexus.url> + </properties> + <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> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.groovy.maven</groupId> + <artifactId>gmaven-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <phase>validate</phase> + <goals> + <goal>execute</goal> + </goals> + <configuration> + <properties> + <ver>${project.version}</ver> + <timestamp>${maven.build.timestamp}</timestamp> + </properties> + <source> + println project.properties['ver']; + if (project.properties['ver'].endsWith("-SNAPSHOT")) { + project.properties['dockertag1'] = project.properties['ver'] + "-latest"; + project.properties['dockertag2'] = project.properties['ver'] + "-" + project.properties['timestamp']; + } else { + project.properties['dockertag1'] = project.properties['ver'] + "-STAGING-latest"; + project.properties['dockertag2'] = project.properties['ver'] + "-STAGING-" + project.properties['timestamp']; + } + println 'docker tag 1: ' + project.properties['dockertag1']; + println 'docker tag 2: ' + project.properties['dockertag2']; + </source> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>io.fabric8</groupId> + <artifactId>docker-maven-plugin</artifactId> + <version>0.28.0</version> + <configuration> + <pullRegistry>${docker.pull.registry}</pullRegistry> + <pushRegistry>${docker.push.registry}</pushRegistry> + <images> + <image> + <name>onap/dmaap/zookeeper</name> + <build> + <cleanup>try</cleanup> + <dockerFile>Dockerfile</dockerFile> + <tags> + <tag>${dockertag1}</tag> + <tag>${dockertag2}</tag> + </tags> + </build> + </image> + </images> + </configuration> + <executions> + <execution> + <id>generate-images</id> + <phase>install</phase> + <goals> + <goal>build</goal> + </goals> + </execution> + <execution> + <id>push-images</id> + <phase>deploy</phase> + <goals> + <goal>push</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> </project> diff --git a/src/main/docker/Dockerfile b/src/main/docker/Dockerfile index 30d73c5..e372915 100644 --- a/src/main/docker/Dockerfile +++ b/src/main/docker/Dockerfile @@ -1,31 +1,19 @@ -FROM confluentinc/cp-base:5.3.1 +FROM confluentinc/cp-zookeeper:6.2.0 ENV COMPONENT=zookeeper \ - ZK_USER=mrzookeeper - -RUN echo "===> installing ${COMPONENT}..." \ - && wget -qO - http://packages.confluent.io/deb/3.0/archive.key | apt-key add - \ - && echo "deb [arch=amd64] http://packages.confluent.io/deb/3.0 stable main" | tee -a /etc/apt/sources.list \ - && apt-key update && apt-get update && apt-get install -y confluent-kafka-2.11 --force-yes \ - && echo "===> clean up ..." \ - && apt-get autoremove -y && apt-get clean && rm -rf /tmp/* /var/lib/apt/lists/* \ - && echo "===> clean up ..." \ - && apt-get clean && rm -rf /tmp/* /var/lib/apt/lists/* \ - && echo "===> Setting up ${COMPONENT} dirs" \ - && mkdir -p /var/lib/${COMPONENT}/data /var/lib/${COMPONENT}/log /etc/${COMPONENT}/secrets/jaas /etc/${COMPONENT}/data /var/log/kafka /var/log/confluent \ - && chmod -R ag+w /etc/kafka /var/lib/${COMPONENT}/data /var/lib/${COMPONENT}/log /etc/${COMPONENT}/secrets /etc/${COMPONENT}/data /var/log/kafka /var/log/confluent \ - && chown -R root:root /var/log/kafka /var/log/confluent /var/lib/kafka /var/lib/zookeeper - -RUN set -x \ - && apt-get update \ - && apt-get install -y git --force-yes \ - && git clone -b master --single-branch http://gerrit.onap.org/r/dmaap/messagerouter/messageservice.git /tmp/zookeeper/gerrit - -COPY include/etc/confluent/docker /etc/confluent/docker -RUN chmod -R +x /etc/confluent/docker - -RUN useradd -u 1000 -g 0 $ZK_USER -RUN chown -R $ZK_USER:0 /tmp/zookeeper + ZK_USER=mrzookeeper \ + ZK_GROUP=onap + +USER root + +RUN userdel -r appuser && groupadd $ZK_GROUP && useradd $ZK_USER -u 1000 -G 1000,$ZK_GROUP + +WORKDIR /home/$ZK_USER + +COPY include/etc/confluent/docker/* /etc/confluent/docker/ +RUN chmod -R +x /etc/confluent/docker \ +&& chown -R $ZK_USER:$ZK_GROUP /var/lib/${COMPONENT} /etc/kafka /etc/confluent/docker /var/log/kafka /var/lib/kafka /var/log/confluent + USER $ZK_USER EXPOSE 2181 2888 3888 diff --git a/src/main/docker/include/etc/confluent/docker/configure b/src/main/docker/include/etc/confluent/docker/configure index 74e1c11..742207d 100644 --- a/src/main/docker/include/etc/confluent/docker/configure +++ b/src/main/docker/include/etc/confluent/docker/configure @@ -44,36 +44,3 @@ fi dub template "/etc/confluent/docker/${COMPONENT}.properties.template" "/etc/kafka/${COMPONENT}.properties" dub template "/etc/confluent/docker/log4j.properties.template" "/etc/kafka/log4j.properties" dub template "/etc/confluent/docker/tools-log4j.properties.template" "/etc/kafka/tools-log4j.properties" - - -ZK_REPLICAS=${ZOOKEEPER_REPLICAS:-1} -HOST=$(hostname -s) -DOMAIN=$(hostname -d) -ZK_SERVER_PORT=${ZOOKEEPER_SERVER_PORT:-2888} -ZK_ELECTION_PORT=${ZOOKEEPER_ELECTION_PORT:-3888} - -function print_servers() { - if [[ $HOST =~ (.*)-([0-9]+)$ ]]; then - NAME=${BASH_REMATCH[1]} - for (( i=1; i<=$ZK_REPLICAS; i++ )) - do - echo "server.$i=$NAME-$((i-1)).$DOMAIN:$ZK_SERVER_PORT:$ZK_ELECTION_PORT" - done - - fi -} - - -if [ $ZK_REPLICAS -gt 1 ]; then -print_servers >> /etc/kafka/${COMPONENT}.properties -fi - -if [ -d /var/lib/zookeeper/data/version-2 ]; then - echo "API Keys already loaded"; - else - cp -var /tmp/zookeeper/gerrit/oom-topics/data-zookeeper/* /var/lib/zookeeper/data/; - rm -rf /tmp/zookeeper/gerrit; - echo "Copying API Keys completed."; - fi - - diff --git a/src/main/docker/include/etc/confluent/docker/log4j.properties.template b/src/main/docker/include/etc/confluent/docker/log4j.properties.template index 972bab3..9487292 100644 --- a/src/main/docker/include/etc/confluent/docker/log4j.properties.template +++ b/src/main/docker/include/etc/confluent/docker/log4j.properties.template @@ -7,7 +7,7 @@ log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c)%n {% if env['ZOOKEEPER_LOG4J_LOGGERS'] %} {% set loggers = parse_log4j_loggers(env['ZOOKEEPER_LOG4J_LOGGERS']) %} -{% for logger,loglevel in loggers.iteritems() %} +{% for logger,loglevel in loggers.items() %} log4j.logger.{{logger}}={{loglevel}}, stdout {% endfor %} {% endif %} diff --git a/src/main/docker/include/etc/confluent/docker/run b/src/main/docker/include/etc/confluent/docker/run index 7d311e8..ee104fa 100644 --- a/src/main/docker/include/etc/confluent/docker/run +++ b/src/main/docker/include/etc/confluent/docker/run @@ -17,7 +17,7 @@ . /etc/confluent/docker/bash-config echo "===> ENV Variables ..." -show_env +env echo "===> User" id diff --git a/src/main/docker/include/etc/confluent/docker/tools-log4j.properties.template b/src/main/docker/include/etc/confluent/docker/tools-log4j.properties.template index b8ad39c..d27685c 100644 --- a/src/main/docker/include/etc/confluent/docker/tools-log4j.properties.template +++ b/src/main/docker/include/etc/confluent/docker/tools-log4j.properties.template @@ -1,4 +1,3 @@ - log4j.rootLogger={{ env["ZOOKEEPER_TOOLS_LOG4J_LOGLEVEL"] | default('WARN') }}, stderr log4j.appender.stderr=org.apache.log4j.ConsoleAppender diff --git a/src/main/docker/include/etc/confluent/docker/zookeeper.properties.template b/src/main/docker/include/etc/confluent/docker/zookeeper.properties.template index e87e6b6..e46a3c9 100644 --- a/src/main/docker/include/etc/confluent/docker/zookeeper.properties.template +++ b/src/main/docker/include/etc/confluent/docker/zookeeper.properties.template @@ -1,10 +1,10 @@ -clientPort={{ env['ZOOKEEPER_CLIENT_PORT'] }} dataDir=/var/lib/zookeeper/data -dataLogDir=/var/lib/zookeeper/data +dataLogDir=/var/lib/zookeeper/log {# optional properties #} {% set other_props = { + 'ZOOKEEPER_CLIENT_PORT' : 'clientPort', 'ZOOKEEPER_TICK_TIME': 'tickTime', 'ZOOKEEPER_GLOBAL_OUTSTANDING_LIMIT' : 'globalOutstandingLimit', 'ZOOKEEPER_PRE_ALLOC_SIZE': 'preAllocSize', @@ -26,10 +26,53 @@ dataLogDir=/var/lib/zookeeper/data 'ZOOKEEPER_FORCE_SYNC': 'forceSync', 'ZOOKEEPER_JUTE_MAX_BUFFER': 'jute.maxbuffer', 'ZOOKEEPER_SKIP_ACL': 'skipACL', - 'ZOOKEEPER_QUORUM_LISTEN_ON_ALL_IPS': 'quorumListenOnAllIPs' + 'ZOOKEEPER_QUORUM_LISTEN_ON_ALL_IPS': 'quorumListenOnAllIPs', + 'ZOOKEEPER_CLIENT_CNXN_SOCKET' : 'clientCnxnSocket', + 'ZOOKEEPER_SECURE_CLIENT_PORT' : 'secureClientPort', + 'ZOOKEEPER_SERVER_CNXN_SOCKET' : 'serverCnxnSocket', + 'ZOOKEEPER_X509_AUTHENTICATION_PROVIDER_SUPER_USER' : 'X509AuthenticationProvider.superUser', + 'ZOOKEEPER_SSL_AUTH_PROVIDER' : 'ssl.authProvider', + 'ZOOKEEPER_SSL_CLIENT_AUTH' : 'ssl.clientAuth', + 'ZOOKEEPER_SSL_KEYSTORE_LOCATION' : 'ssl.keyStore.location', + 'ZOOKEEPER_SSL_KEYSTORE_PASSWORD' : 'ssl.keyStore.password', + 'ZOOKEEPER_SSL_KEYSTORE_TYPE' : 'ssl.keyStore.type', + 'ZOOKEEPER_SSL_TRUSTSTORE_LOCATION' : 'ssl.trustStore.location', + 'ZOOKEEPER_SSL_TRUSTSTORE_PASSWORD' : 'ssl.trustStore.password', + 'ZOOKEEPER_SSL_TRUSTSTORE_TYPE' : 'ssl.trustStore.type', + 'ZOOKEEPER_SSL_ENABLED_PROTOCOLS' : 'ssl.enabledProtocols', + 'ZOOKEEPER_SSL_CONTEXT_SUPPLIER_CLASS' : 'ssl.context.supplier.class', + 'ZOOKEEPER_SSL_CIPHER_SUITES' : 'ssl.ciphersuites', + 'ZOOKEEPER_SSL_HOSTNAME_VERIFICATION' : 'ssl.hostnameVerification', + 'ZOOKEEPER_SSL_CRL' : 'ssl.crl', + 'ZOOKEEPER_SSL_OCPS' : 'ssl.ocsp', + 'ZOOKEEPER_SSL_HANDSHAKE_DETECTION_TIMEOUT_MILLIS' : 'ssl.handshakeDetectionTimeoutMillis', + 'ZOOKEEPER_SSL_QUORUM' : 'sslQuorum', + 'ZOOKEEPER_SSL_QUORUM_CLIENT_AUTH' : 'ssl.quorum.clientAuth', + 'ZOOKEEPER_SSL_QUORUM_KEYSTORE_LOCATION' : 'ssl.quorum.keyStore.location', + 'ZOOKEEPER_SSL_QUORUM_KEYSTORE_PASSWORD' : 'ssl.quorum.keyStore.password', + 'ZOOKEEPER_SSL_QUORUM_KEYSTORE_TYPE' : 'ssl.quorum.keyStore.type', + 'ZOOKEEPER_SSL_QUORUM_TRUSTSTORE_LOCATION' : 'ssl.quorum.trustStore.location', + 'ZOOKEEPER_SSL_QUORUM_TRUSTSTORE_PASSWORD' : 'ssl.quorum.trustStore.password', + 'ZOOKEEPER_SSL_QUORUM_TRUSTSTORE_TYPE' : 'ssl.quorum.trustStore.type', + 'ZOOKEEPER_SSL_QUORUM_ENABLED_PROTOCOLS' : 'ssl.quorum.enabledProtocols', + 'ZOOKEEPER_SSL_QUORUM_CIPHER_SUITES' : 'ssl.quorum.ciphersuites', + 'ZOOKEEPER_SSL_QUORUM_CONTEXT_SUPPLIER_CLASS' : 'ssl.quorum.context.supplier.class', + 'ZOOKEEPER_SSL_QUORUM_HOSTNAME_VERIFICATION' : 'ssl.quorum.hostnameVerification', + 'ZOOKEEPER_SSL_QUORUM_CRL' : 'ssl.quorum.crl', + 'ZOOKEEPER_SSL_QUORUM_OCPS' : 'ssl.quorum.ocsp', + 'ZOOKEEPER_SSL_QUORUM_HANDSHAKE_DETECTION_TIMEOUT_MILLIS' : 'ssl.quorum.handshakeDetectionTimeoutMillis', + 'ZOOKEEPER_SERVER_CNXN_FACTORY' : 'serverCnxnFactory', + 'ZOOKEEPER_AUTH_PROVIDER_X509' : 'authProvider.x509', + 'ZOOKEEPER_AUTH_PROVIDER_SASL' : 'authProvider.sasl', + 'ZOOKEEPER_CLIENT_PORT_UNIFICATION' : 'client.portUnification', + 'ZOOKEEPER_ADMIN_ENABLE_SERVER' : 'admin.enableServer', + 'ZOOKEEPER_ADMIN_SERVER_ADDRESS' : 'admin.serverAddress', + 'ZOOKEEPER_ADMIN_SERVER_PORT' : 'admin.serverPort', + 'ZOOKEEPER_ADMIN_IDLE_TIMEOUT' : 'admin.idleTimeout', + 'ZOOKEEPER_ADMIN_COMMAND_URL' : 'admin.commandURL' } -%} -{% for k, property in other_props.iteritems() -%} +{% for k, property in other_props.items() -%} {% if env.get(k) != None -%} {{property}}={{env[k]}} {% endif -%} diff --git a/src/main/docker/scripts/start-zookeeper.sh b/src/main/docker/scripts/start-zookeeper.sh deleted file mode 100644 index ce3a758..0000000 --- a/src/main/docker/scripts/start-zookeeper.sh +++ /dev/null @@ -1,157 +0,0 @@ -#!/usr/bin/env bash - -ZK_REPLICAS=${ZK_REPLICAS:-1} -ZK_USER=${ZK_USER:-"mrzookeeper"} -ZK_LOG_LEVEL=${ZK_LOG_LEVEL:-"INFO"} -ZK_DATA_DIR=${ZK_DATA_DIR:-"/var/lib/zookeeper/data"} -ZK_DATA_LOG_DIR=${ZK_DATA_LOG_DIR:-"/var/lib/zookeeper/data"} -ZK_LOG_DIR=${ZK_LOG_DIR:-"var/log/zookeeper"} -ZK_CONF_DIR=${ZK_CONF_DIR:-"/opt/zookeeper/conf"} -ZK_CLIENT_PORT=${ZK_CLIENT_PORT:-2181} -ZK_SERVER_PORT=${ZK_SERVER_PORT:-2888} -ZK_ELECTION_PORT=${ZK_ELECTION_PORT:-3888} -ZK_TICK_TIME=${ZK_TICK_TIME:-2000} -ZK_INIT_LIMIT=${ZK_INIT_LIMIT:-10} -ZK_SYNC_LIMIT=${ZK_SYNC_LIMIT:-5} -ZK_HEAP_SIZE=${ZK_HEAP_SIZE:-2G} -ZK_MAX_CLIENT_CNXNS=${ZK_MAX_CLIENT_CNXNS:-60} -ZK_MIN_SESSION_TIMEOUT=${ZK_MIN_SESSION_TIMEOUT:- $((ZK_TICK_TIME*2))} -ZK_MAX_SESSION_TIMEOUT=${ZK_MAX_SESSION_TIMEOUT:- $((ZK_TICK_TIME*20))} -ZK_SNAP_RETAIN_COUNT=${ZK_SNAP_RETAIN_COUNT:-3} -ZK_PURGE_INTERVAL=${ZK_PURGE_INTERVAL:-0} -ZK_PRE_ALLOC_SIZE=${ZK_PRE_ALLOC_SIZE:-5000} -ID_FILE="$ZK_DATA_DIR/myid" -ZK_CONFIG_FILE="$ZK_CONF_DIR/zoo.cfg" -LOGGER_PROPS_FILE="$ZK_CONF_DIR/log4j.properties" -JAVA_ENV_FILE="$ZK_CONF_DIR/java.env" -HOST=$(hostname -s) -DOMAIN=$(hostname -d) - -function print_servers() { - for (( i=1; i<=$ZK_REPLICAS; i++ )) - do - echo "server.$i=$NAME-$((i-1)).$DOMAIN:$ZK_SERVER_PORT:$ZK_ELECTION_PORT" - done -} - -function validate_env() { - echo "Validating environment" - - if [[ $HOST =~ (.*)-([0-9]+)$ ]]; then - NAME=${BASH_REMATCH[1]} - ORD=${BASH_REMATCH[2]} - MY_ID=$((ORD+1)) - echo "MY_ID=$MY_ID" - else - echo "Failed to extract ordinal from hostname $HOST" - fi - - - - echo "ZK_REPLICAS=$ZK_REPLICAS" - echo "ZK_LOG_LEVEL=$ZK_LOG_LEVEL" - echo "ZK_DATA_DIR=$ZK_DATA_DIR" - echo "ZK_DATA_LOG_DIR=$ZK_DATA_LOG_DIR" - echo "ZK_LOG_DIR=$ZK_LOG_DIR" - echo "ZK_CLIENT_PORT=$ZK_CLIENT_PORT" - echo "ZK_SERVER_PORT=$ZK_SERVER_PORT" - echo "ZK_ELECTION_PORT=$ZK_ELECTION_PORT" - echo "ZK_TICK_TIME=$ZK_TICK_TIME" - echo "ZK_INIT_LIMIT=$ZK_INIT_LIMIT" - echo "ZK_SYNC_LIMIT=$ZK_SYNC_LIMIT" - echo "ZK_MAX_CLIENT_CNXNS=$ZK_MAX_CLIENT_CNXNS" - echo "ZK_MIN_SESSION_TIMEOUT=$ZK_MIN_SESSION_TIMEOUT" - echo "ZK_MAX_SESSION_TIMEOUT=$ZK_MAX_SESSION_TIMEOUT" - echo "ZK_HEAP_SIZE=$ZK_HEAP_SIZE" - echo "ZK_SNAP_RETAIN_COUNT=$ZK_SNAP_RETAIN_COUNT" - echo "ZK_PURGE_INTERVAL=$ZK_PURGE_INTERVAL" - echo "ZK_PRE_ALLOC_SIZE=$ZK_PRE_ALLOC_SIZE" - - if [ $ZK_REPLICAS -gt 1 ]; then - echo "ENSEMBLE" - print_servers - fi - - echo "Environment validation successful" -} - -function create_config() { - rm -f $ZK_CONFIG_FILE - echo "Creating ZooKeeper configuration" - echo "#This file was autogenerated by k8szk DO NOT EDIT" >> $ZK_CONFIG_FILE - echo "clientPort=$ZK_CLIENT_PORT" >> $ZK_CONFIG_FILE - echo "dataDir=$ZK_DATA_DIR" >> $ZK_CONFIG_FILE - echo "dataLogDir=$ZK_DATA_LOG_DIR" >> $ZK_CONFIG_FILE - echo "tickTime=$ZK_TICK_TIME" >> $ZK_CONFIG_FILE - echo "initLimit=$ZK_INIT_LIMIT" >> $ZK_CONFIG_FILE - echo "syncLimit=$ZK_SYNC_LIMIT" >> $ZK_CONFIG_FILE - echo "maxClientCnxns=$ZK_MAX_CLIENT_CNXNS" >> $ZK_CONFIG_FILE - echo "minSessionTimeout=$ZK_MIN_SESSION_TIMEOUT" >> $ZK_CONFIG_FILE - echo "maxSessionTimeout=$ZK_MAX_SESSION_TIMEOUT" >> $ZK_CONFIG_FILE - echo "autopurge.snapRetainCount=$ZK_SNAP_RETAIN_COUNT" >> $ZK_CONFIG_FILE - echo "autopurge.purgeInterval=$ZK_PURGE_INTERVAL" >> $ZK_CONFIG_FILE - echo "preAllocSize=$ZK_PRE_ALLOC_SIZE" >> $ZK_CONFIG_FILE - - if [ $ZK_REPLICAS -gt 1 ]; then - print_servers >> $ZK_CONFIG_FILE - fi - - echo "Wrote ZooKeeper configuration file to $ZK_CONFIG_FILE" -} - -function create_data_dirs() { - echo "Creating ZooKeeper data directories and setting permissions" - - if [ ! -d $ZK_DATA_DIR ]; then - mkdir -p $ZK_DATA_DIR - chown -R $ZK_USER:$ZK_USER $ZK_DATA_DIR - fi - - if [ -d $ZK_DATA_DIR/version-2 ]; then - echo "API Keys already loaded"; - else - cp -var /tmp/zookeeper/gerrit/oom-topics/data-zookeeper/* $ZK_DATA_DIR; - rm -rf /tmp/zookeeper/gerrit; - echo "Copying API Keys completed."; - fi - - if [ ! -d $ZK_DATA_LOG_DIR ]; then - mkdir -p $ZK_DATA_LOG_DIR - chown -R $ZK_USER:$ZK_USER $ZK_DATA_LOG_DIR - fi - - if [ ! -d $ZK_LOG_DIR ]; then - mkdir -p $ZK_LOG_DIR - chown -R $ZK_USER:$ZK_USER $ZK_LOG_DIR - fi - - if [ ! -f $ID_FILE ] && [ $ZK_REPLICAS -gt 1 ]; then - echo $MY_ID >> $ID_FILE - fi - - - echo "Created ZooKeeper data directories and set permissions in $ZK_DATA_DIR" -} - -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="$ZK_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 - echo "Wrote log4j configuration to $LOGGER_PROPS_FILE" -} - -function create_java_env() { - rm -f $JAVA_ENV_FILE - echo "Creating JVM configuration file" - echo "ZOO_LOG_DIR=$ZK_LOG_DIR" >> $JAVA_ENV_FILE - echo "JVMFLAGS=\"-Xmx$ZK_HEAP_SIZE -Xms$ZK_HEAP_SIZE\"" >> $JAVA_ENV_FILE - echo "Wrote JVM configuration to $JAVA_ENV_FILE" -} - -validate_env && create_config && create_log_props && create_data_dirs && create_java_env && exec zkServer.sh start-foreground
\ No newline at end of file diff --git a/src/main/docker/scripts/zookeeper-metrics.sh b/src/main/docker/scripts/zookeeper-metrics.sh deleted file mode 100644 index 7cd0b29..0000000 --- a/src/main/docker/scripts/zookeeper-metrics.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -ZK_CLIENT_PORT=${ZK_CLIENT_PORT:-2181} -echo mntr | nc localhost $ZK_CLIENT_PORT >& 1
\ No newline at end of file diff --git a/src/main/docker/scripts/zookeeper-ready.sh b/src/main/docker/scripts/zookeeper-ready.sh deleted file mode 100644 index fd4ea5a..0000000 --- a/src/main/docker/scripts/zookeeper-ready.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -ZK_CLIENT_PORT=${ZK_CLIENT_PORT:-2181} -OK=$(echo ruok | nc 127.0.0.1 $ZK_CLIENT_PORT) -if [ "$OK" == "imok" ]; then - exit 0 -else - exit 1 -fi
\ No newline at end of file diff --git a/src/main/docker/zk_server_jaas.conf b/src/main/docker/zk_server_jaas.conf deleted file mode 100644 index 0d11df9..0000000 --- a/src/main/docker/zk_server_jaas.conf +++ /dev/null @@ -1,4 +0,0 @@ -Server { - org.apache.zookeeper.server.auth.DigestLoginModule required - user_kafka="kafka_secret"; -}; diff --git a/version.properties b/version.properties index 352582b..b65f91b 100644 --- a/version.properties +++ b/version.properties @@ -25,8 +25,8 @@ # because they are used in Jenkins, whose plug-in doesn't support major=6 -minor=0 -patch=4 +minor=1 +patch=0 base_version=${major}.${minor}.${patch} |