You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by zh...@apache.org on 2018/01/09 12:49:50 UTC

[bookkeeper] branch master updated: Docker image for testing

This is an automated email from the ASF dual-hosted git repository.

zhaijia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 0d42fae  Docker image for testing
0d42fae is described below

commit 0d42faead06db0d9ea1a1d19f806f9f97c4dd54a
Author: Ivan Kelly <iv...@apache.org>
AuthorDate: Tue Jan 9 20:49:40 2018 +0800

    Docker image for testing
    
    Contains all released versioned and the current version (from the
    current source tree). The image only gets built if the docker maven
    profile is enabled:
    
    ```
    mvn package -Pdocker
    ```
    
    Supervisord is used to start and stop bookkeeper. Each version has its
    own supervisord config. The same journal and ledger directories are
    used for all versions. Logs are written to per version log files in
    /var/log/bookkeeper.
    
    Author: Ivan Kelly <iv...@apache.org>
    
    Reviewers: Enrico Olivelli <eo...@gmail.com>, Sijie Guo <si...@apache.org>
    
    This closes #959 from ivankelly/all-version-docker
---
 bookkeeper-dist/server/pom.xml                     |  2 +-
 tests/docker-all-versions-image/Dockerfile         | 58 ++++++++++++++
 tests/docker-all-versions-image/pom.xml            | 88 ++++++++++++++++++++++
 .../scripts/install-all-tarballs.sh                | 84 +++++++++++++++++++++
 .../scripts/update-conf-and-boot.sh                | 27 +++++++
 tests/pom.xml                                      |  1 +
 6 files changed, 259 insertions(+), 1 deletion(-)

diff --git a/bookkeeper-dist/server/pom.xml b/bookkeeper-dist/server/pom.xml
index 10bd5b7..1b19f46 100644
--- a/bookkeeper-dist/server/pom.xml
+++ b/bookkeeper-dist/server/pom.xml
@@ -78,7 +78,7 @@
         <version>${maven-assembly-plugin.version}</version>
         <configuration>
           <finalName>bookkeeper-server-${project.version}</finalName>
-          <attach>false</attach>
+          <attach>true</attach>
           <descriptors>
             <descriptor>../src/assemble/bin-server.xml</descriptor>
           </descriptors>
diff --git a/tests/docker-all-versions-image/Dockerfile b/tests/docker-all-versions-image/Dockerfile
new file mode 100644
index 0000000..c389d2d
--- /dev/null
+++ b/tests/docker-all-versions-image/Dockerfile
@@ -0,0 +1,58 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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.
+#
+
+FROM centos:7
+MAINTAINER Apache BookKeeper <de...@bookkeeper.apache.org>
+
+ARG BK_TARBALL=DOESNOTEXIST
+ENV BK_JOURNALDIR=/opt/bookkeeper/data/journal
+ENV BK_LEDGERDIR=/opt/bookkeeper/data/ledgers
+ENV BK_ZKCONNECTSTRING=zookeeper1,zookeeper2,zookeeper3
+
+RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
+RUN yum install -y java-1.8.0-openjdk-headless wget bash python sudo supervisor which
+
+RUN mkdir /tarballs
+WORKDIR /tarballs
+RUN wget -nv https://archive.apache.org/dist/zookeeper/bookkeeper/bookkeeper-4.0.0/binaries/bookkeeper-server-4.0.0-bin.tar.gz{,.sha1,.md5,.asc}
+RUN wget -nv https://archive.apache.org/dist/zookeeper/bookkeeper/bookkeeper-4.1.0/bookkeeper-server-4.1.0-bin.tar.gz{,.sha1,.md5,.asc}
+RUN wget -nv https://archive.apache.org/dist/zookeeper/bookkeeper/bookkeeper-4.2.0/bookkeeper-server-4.2.0-bin.tar.gz{,.sha1,.md5,.asc}
+RUN wget -nv https://archive.apache.org/dist/zookeeper/bookkeeper/bookkeeper-4.2.1/bookkeeper-server-4.2.1-bin.tar.gz{,.sha1,.md5,.asc}
+RUN wget -nv https://archive.apache.org/dist/zookeeper/bookkeeper/bookkeeper-4.2.2/bookkeeper-server-4.2.2-bin.tar.gz{,.sha1,.md5,.asc}
+RUN wget -nv https://archive.apache.org/dist/zookeeper/bookkeeper/bookkeeper-4.2.3/bookkeeper-server-4.2.3-bin.tar.gz{,.sha1,.md5,.asc}
+RUN wget -nv https://archive.apache.org/dist/zookeeper/bookkeeper/bookkeeper-4.3.0/bookkeeper-server-4.3.0-bin.tar.gz{,.sha1,.md5,.asc}
+RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.2.4/bookkeeper-server-4.2.4-bin.tar.gz{,.sha1,.md5,.asc}
+RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.3.0/bookkeeper-server-4.3.0-bin.tar.gz{,.sha1,.md5,.asc}
+RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.3.1/bookkeeper-server-4.3.1-bin.tar.gz{,.sha1,.md5,.asc}
+RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.3.2/bookkeeper-server-4.3.2-bin.tar.gz{,.sha1,.md5,.asc}
+RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.4.0/bookkeeper-server-4.4.0-bin.tar.gz{,.sha1,.md5,.asc}
+RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.5.0/bookkeeper-server-4.5.0-bin.tar.gz{,.sha1,.md5,.asc}
+RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.5.1/bookkeeper-server-4.5.1-bin.tar.gz{,.sha1,.md5,.asc}
+RUN wget -nv https://archive.apache.org/dist/bookkeeper/bookkeeper-4.6.0/bookkeeper-server-4.6.0-bin.tar.gz{,.sha1,.md5,.asc}
+RUN wget -nv https://dist.apache.org/repos/dist/release/bookkeeper/KEYS
+RUN wget -nv http://svn.apache.org/repos/asf/zookeeper/bookkeeper/dist/KEYS?p=1620552 -O KEYS.old
+COPY ${BK_TARBALL} /tarballs/
+
+ADD scripts/install-all-tarballs.sh /install-all-tarballs.sh
+RUN bash /install-all-tarballs.sh && rm -rf /tarballs
+
+WORKDIR /
+ADD scripts/update-conf-and-boot.sh /update-conf-and-boot.sh
+RUN chmod +x /update-conf-and-boot.sh
+CMD ["/update-conf-and-boot.sh"]
\ No newline at end of file
diff --git a/tests/docker-all-versions-image/pom.xml b/tests/docker-all-versions-image/pom.xml
new file mode 100644
index 0000000..2a6893d
--- /dev/null
+++ b/tests/docker-all-versions-image/pom.xml
@@ -0,0 +1,88 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You 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.
+-->
+
+<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">
+  <parent>
+    <groupId>org.apache.bookkeeper.tests</groupId>
+    <artifactId>tests-parent</artifactId>
+    <version>4.7.0-SNAPSHOT</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.bookkeeper.tests</groupId>
+  <artifactId>docker-all-versions-image</artifactId>
+  <name>Apache BookKeeper :: Tests :: Docker All Versions Image</name>
+  <packaging>pom</packaging>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.bookkeeper</groupId>
+      <artifactId>bookkeeper-dist-server</artifactId>
+      <version>${project.parent.version}</version>
+      <classifier>bin</classifier>
+      <type>tar.gz</type>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+  <profiles>
+    <profile>
+      <id>docker</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>com.spotify</groupId>
+            <artifactId>dockerfile-maven-plugin</artifactId>
+            <version>1.3.7</version>
+            <executions>
+              <execution>
+                <id>default</id>
+                <goals>
+                  <goal>build</goal>
+                  <goal>push</goal>
+                </goals>
+              </execution>
+            </executions>
+            <configuration>
+              <repository>apachebookkeeper/bookkeeper-all-versions</repository>
+              <tag>${project.version}</tag>
+              <buildArgs>
+                <BK_TARBALL>target/bookkeeper-dist-server-${project.version}-bin.tar.gz</BK_TARBALL>
+              </buildArgs>
+            </configuration>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-dependency-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>copy-tarball</id>
+                <goals>
+                  <goal>copy-dependencies</goal>
+                </goals>
+                <phase>generate-resources</phase>
+                <configuration>
+                  <outputDirectory>${project.build.directory}/</outputDirectory>
+                  <includeArtifactIds>bookkeeper-dist-server</includeArtifactIds>
+                  <excludeTransitive>true</excludeTransitive>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>
diff --git a/tests/docker-all-versions-image/scripts/install-all-tarballs.sh b/tests/docker-all-versions-image/scripts/install-all-tarballs.sh
new file mode 100644
index 0000000..261bf7b
--- /dev/null
+++ b/tests/docker-all-versions-image/scripts/install-all-tarballs.sh
@@ -0,0 +1,84 @@
+#!/usr/bin/env bash
+#
+#/**
+# * Licensed to the Apache Software Foundation (ASF) under one
+# * or more contributor license agreements.  See the NOTICE file
+# * distributed with this work for additional information
+# * regarding copyright ownership.  The ASF licenses this file
+# * to you 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.
+# */
+
+set -e
+
+BK_LOGDIR=/var/log/bookkeeper
+
+mkdir -p /etc/supervisord/conf.d
+cat > /etc/supervisord.conf <<EOF
+[supervisord]
+nodaemon=true
+logfile=/var/log/supervisord.log
+logfile_maxbytes=50MB
+logfile_backups=10
+loglevel=info
+pidfile=/var/run/supervisord.pid
+minfds=1024
+minprocs=200
+
+[unix_http_server]
+file=/var/run/supervisor/supervisor.sock
+
+[supervisorctl]
+serverurl=unix:///var/run/supervisor/supervisor.sock
+
+[rpcinterface:supervisor]
+supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
+
+[include]
+files = /etc/supervisord/conf.d/*.conf
+EOF
+
+set -x
+
+gpg --import KEYS
+gpg --import KEYS.old
+
+mkdir -p /opt/bookkeeper
+mkdir -p $BK_LOGDIR
+
+for T in bookkeeper-{,dist-}server-*-bin.tar.gz; do
+    if [ -f $T.sha1 ]; then
+        sha1sum --check $T.sha1 > /dev/null
+    fi
+    if [ -f $T.md5 ]; then
+        md5sum --check $T.md5 > /dev/null
+    fi
+    if [ -f $T.asc ]; then
+        gpg --verify $T.asc
+    fi
+
+    VERSION=$(echo $T | sed -nE 's!^bookkeeper-(dist-)?server-([^-]*(-SNAPSHOT)?)-bin.tar.gz$!\2!p')
+
+    tar -zxf $T
+    mv bookkeeper-server-$VERSION /opt/bookkeeper/$VERSION
+
+    cat > /etc/supervisord/conf.d/bookkeeper-$VERSION.conf <<EOF
+[program:bookkeeper-$VERSION]
+autostart=false
+redirect_stderr=true
+stdout_logfile=$BK_LOGDIR/stdout-$VERSION.log
+directory=/opt/bookkeeper/$VERSION
+command=/opt/bookkeeper/$VERSION/bin/bookkeeper bookie
+EOF
+
+done
+
diff --git a/tests/docker-all-versions-image/scripts/update-conf-and-boot.sh b/tests/docker-all-versions-image/scripts/update-conf-and-boot.sh
new file mode 100644
index 0000000..4248862
--- /dev/null
+++ b/tests/docker-all-versions-image/scripts/update-conf-and-boot.sh
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+#
+#/**
+# * Licensed to the Apache Software Foundation (ASF) under one
+# * or more contributor license agreements.  See the NOTICE file
+# * distributed with this work for additional information
+# * regarding copyright ownership.  The ASF licenses this file
+# * to you 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.
+# */
+
+mkdir -p $BK_JOURNALDIR $BK_LEDGERDIR
+
+sed -i "s|journalDirectory=.*|journalDirectory=$BK_JOURNALDIR|" /opt/bookkeeper/*/conf/bk_server.conf
+sed -i "s|ledgerDirectories=.*|ledgerDirectories=$BK_LEDGERDIR|" /opt/bookkeeper/*/conf/bk_server.conf
+sed -i "s|zkServers=.*|zkServers=$BK_ZKCONNECTSTRING|" /opt/bookkeeper/*/conf/bk_server.conf
+
+exec /usr/bin/supervisord -c /etc/supervisord.conf
diff --git a/tests/pom.xml b/tests/pom.xml
index 22a58fc..2bc561d 100644
--- a/tests/pom.xml
+++ b/tests/pom.xml
@@ -35,6 +35,7 @@
     <module>bookkeeper-server-shaded-artifact-test</module>
     <module>bookkeeper-server-shaded-test</module>
     <module>bookkeeper-server-tests-shaded-test</module>
+    <module>docker-all-versions-image</module>
   </modules>
   <build>
     <plugins>

-- 
To stop receiving notification emails like this one, please contact
['"commits@bookkeeper.apache.org" <co...@bookkeeper.apache.org>'].