From b0a2b7ecfe86cf10135e25991b34b887f53a793b Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Thu, 17 Oct 2019 14:18:29 +0800 Subject: [PATCH] Adds elasticsearch6 and elasticsearch7 images These are used in our integration tests for zipkin-storage/elasticsearch See https://github.com/openzipkin/docker-zipkin/issues/86 --- docker/README.md | 2 + docker/elasticsearch6/Dockerfile | 47 ++++++++++++++++++ docker/elasticsearch6/README.md | 21 ++++++++ .../elasticsearch6/config/elasticsearch.yml | 17 +++++++ docker/elasticsearch7/Dockerfile | 49 +++++++++++++++++++ docker/elasticsearch7/README.md | 21 ++++++++ .../elasticsearch7/config/elasticsearch.yml | 20 ++++++++ .../elasticsearch7/config/log4j2.properties | 24 +++++++++ docker/hooks/post_build | 2 +- docker/hooks/post_push | 2 +- docker/kafka/README.md | 2 +- 11 files changed, 204 insertions(+), 3 deletions(-) create mode 100644 docker/elasticsearch6/Dockerfile create mode 100644 docker/elasticsearch6/README.md create mode 100644 docker/elasticsearch6/config/elasticsearch.yml create mode 100644 docker/elasticsearch7/Dockerfile create mode 100644 docker/elasticsearch7/README.md create mode 100644 docker/elasticsearch7/config/elasticsearch.yml create mode 100644 docker/elasticsearch7/config/log4j2.properties diff --git a/docker/README.md b/docker/README.md index 2ee69d0d17a..4a66dccfb08 100644 --- a/docker/README.md +++ b/docker/README.md @@ -25,6 +25,8 @@ integration tests. We designed these to be small and start easily. We did this b base layer `openzipkin/zipkin`, and setting up schema where relevant. * [zipkin-cassandra](cassandra/README.md) - runs Cassandra initialized with Zipkin's schema +* [zipkin-elasticsearch6](elasticsearch6/README.md) - runs Elasticsearch 6.x +* [zipkin-elasticsearch7](elasticsearch7/README.md) - runs Elasticsearch 7.x * [zipkin-kafka](kafka/README.md) - runs both Kafka+ZooKeeper * [zipkin-ui](lens/README.md) - serves the (Lens) UI directly with NGINX diff --git a/docker/elasticsearch6/Dockerfile b/docker/elasticsearch6/Dockerfile new file mode 100644 index 00000000000..d1435fd9d30 --- /dev/null +++ b/docker/elasticsearch6/Dockerfile @@ -0,0 +1,47 @@ +# +# Copyright 2015-2019 The OpenZipkin 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. +# + +FROM alpine + +ENV ELASTICSEARCH_VERSION 6.8.3 + +RUN apk add --update curl + +WORKDIR /elasticsearch + +RUN curl -sSL https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ELASTICSEARCH_VERSION.tar.gz| tar xz && \ + mv elasticsearch-$ELASTICSEARCH_VERSION/* /elasticsearch/ + +FROM openzipkin/jre-full:11.0.4-11.33 +LABEL MAINTAINER Zipkin "https://zipkin.io/" + +# https://github.com/elastic/elasticsearch/pull/31003 was closed won't fix +ENV ES_TMPDIR /tmp + +RUN ["/busybox/sh", "-c", "adduser -g '' -h /elasticsearch -D elasticsearch"] + +COPY --from=0 --chown=elasticsearch /elasticsearch /elasticsearch + +WORKDIR /elasticsearch + +# elasticsearch complains if run as root +USER elasticsearch + +COPY config ./config + +EXPOSE 9200 9300 + +ENV JAVA_OPTS " " + +ENTRYPOINT ["/busybox/sh", "/elasticsearch/bin/elasticsearch"] diff --git a/docker/elasticsearch6/README.md b/docker/elasticsearch6/README.md new file mode 100644 index 00000000000..bb2d37a9438 --- /dev/null +++ b/docker/elasticsearch6/README.md @@ -0,0 +1,21 @@ +## zipkin-elasticsearch6 Docker image + +The `zipkin-elasticsearch6` testing image runs Elasticsearch 6.x for [Elasticsearch storage](../../zipkin-storage/elasticsearch) +integration. + +To build `openzipkin/zipkin-elasticsearch6`, from the top level of the repository, run: +```bash +$ docker build -t openzipkin/zipkin-elasticsearch6:test -f docker/elasticsearch6/Dockerfile . +``` + +#### Host setup +Elasticsearch is [strict](https://github.com/docker-library/docs/tree/master/elasticsearch#host-setup) +about virtual memory. You will need to adjust accordingly (especially if you notice Elasticsearch crash!) + +```bash +# If docker is running on your host machine, adjust the kernel setting directly +$ sudo sysctl -w vm.max_map_count=262144 + +# If using docker-machine/Docker Toolbox/Boot2Docker, remotely adjust the same +$ docker-machine ssh default "sudo sysctl -w vm.max_map_count=262144" +``` diff --git a/docker/elasticsearch6/config/elasticsearch.yml b/docker/elasticsearch6/config/elasticsearch.yml new file mode 100644 index 00000000000..9c642a372c1 --- /dev/null +++ b/docker/elasticsearch6/config/elasticsearch.yml @@ -0,0 +1,17 @@ +# +# Copyright 2015-2019 The OpenZipkin 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. +# + +network.host: 0.0.0.0 +discovery.zen.minimum_master_nodes: 1 +xpack.ml.enabled: false diff --git a/docker/elasticsearch7/Dockerfile b/docker/elasticsearch7/Dockerfile new file mode 100644 index 00000000000..25002113379 --- /dev/null +++ b/docker/elasticsearch7/Dockerfile @@ -0,0 +1,49 @@ +# +# Copyright 2015-2019 The OpenZipkin 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. +# + +FROM alpine + +ENV ELASTICSEARCH_VERSION 7.4.0 + +RUN apk add --update curl + +WORKDIR /elasticsearch + +RUN curl -sSL https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ELASTICSEARCH_VERSION-linux-x86_64.tar.gz| tar xz && \ + mv elasticsearch-$ELASTICSEARCH_VERSION/* /elasticsearch/ && \ + # disable ML as not supported on alpine per https://discuss.elastic.co/t/elasticsearch-failing-to-start-due-to-x-pack/85125/6 + rm -rf /elasticsearch/modules/x-pack-ml/platform/linux-x86_64 + +FROM openzipkin/jre-full:11.0.4-11.33 +LABEL MAINTAINER Zipkin "https://zipkin.io/" + +# https://github.com/elastic/elasticsearch/pull/31003 was closed won't fix +ENV ES_TMPDIR /tmp + +RUN ["/busybox/sh", "-c", "adduser -g '' -h /elasticsearch -D elasticsearch"] + +COPY --from=0 --chown=elasticsearch /elasticsearch /elasticsearch + +WORKDIR /elasticsearch + +# elasticsearch complains if run as root +USER elasticsearch + +COPY config ./config + +EXPOSE 9200 9300 + +ENV JAVA_OPTS " " + +ENTRYPOINT ["/busybox/sh", "/elasticsearch/bin/elasticsearch"] diff --git a/docker/elasticsearch7/README.md b/docker/elasticsearch7/README.md new file mode 100644 index 00000000000..4c1b0e0383f --- /dev/null +++ b/docker/elasticsearch7/README.md @@ -0,0 +1,21 @@ +## zipkin-elasticsearch7 Docker image + +The `zipkin-elasticsearch7` testing image runs Elasticsearch 7.x for [Elasticsearch storage](../../zipkin-storage/elasticsearch) +integration. + +To build `openzipkin/zipkin-elasticsearch7`, from the top level of the repository, run: +```bash +$ docker build -t openzipkin/zipkin-elasticsearch7:test -f docker/elasticsearch7/Dockerfile . +``` + +#### Host setup +Elasticsearch is [strict](https://github.com/docker-library/docs/tree/master/elasticsearch#host-setup) +about virtual memory. You will need to adjust accordingly (especially if you notice Elasticsearch crash!) + +```bash +# If docker is running on your host machine, adjust the kernel setting directly +$ sudo sysctl -w vm.max_map_count=262144 + +# If using docker-machine/Docker Toolbox/Boot2Docker, remotely adjust the same +$ docker-machine ssh default "sudo sysctl -w vm.max_map_count=262144" +``` diff --git a/docker/elasticsearch7/config/elasticsearch.yml b/docker/elasticsearch7/config/elasticsearch.yml new file mode 100644 index 00000000000..05d85821d1d --- /dev/null +++ b/docker/elasticsearch7/config/elasticsearch.yml @@ -0,0 +1,20 @@ +# +# Copyright 2015-2019 The OpenZipkin 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. +# + +network.host: 0.0.0.0 +node.name: zipkin-elasticsearch +cluster.name: "docker-cluster" +cluster.initial_master_nodes: + - zipkin-elasticsearch +xpack.ml.enabled: false diff --git a/docker/elasticsearch7/config/log4j2.properties b/docker/elasticsearch7/config/log4j2.properties new file mode 100644 index 00000000000..e6f1a520213 --- /dev/null +++ b/docker/elasticsearch7/config/log4j2.properties @@ -0,0 +1,24 @@ +# +# Copyright 2015-2019 The OpenZipkin 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. +# + +status = error + +appender.console.type = Console +appender.console.name = console +appender.console.layout.type = PatternLayout +appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n + +rootLogger.level = info +rootLogger.appenderRef.console.ref = console + diff --git a/docker/hooks/post_build b/docker/hooks/post_build index 9f7c1714552..ab3809e3e53 100755 --- a/docker/hooks/post_build +++ b/docker/hooks/post_build @@ -26,7 +26,7 @@ for tag in ${TAGS[@]:1}; do done # We also build testing images to correspond with the server version to keep schemas up to date -for path in storage/cassandra kafka; do +for path in storage/cassandra storage/elasticsearch6 storage/elasticsearch7 kafka; do image=$(basename ${path}) echo Building ${image} docker build --build-arg version="$SOURCE_BRANCH" -f "docker/${path}/Dockerfile" -t "openzipkin/${image}:${TAGS[0]}" . diff --git a/docker/hooks/post_push b/docker/hooks/post_push index f732b4ab01c..3726812bf36 100755 --- a/docker/hooks/post_push +++ b/docker/hooks/post_push @@ -10,7 +10,7 @@ if [[ "$DOCKER_REPO" == "index.docker.io/openzipkin/zipkin" ]]; then docker push "openzipkin/zipkin-ui:$tag" docker push "openzipkin/zipkin-kafka:$tag" - for storage in cassandra; do + for storage in cassandra elasticsearch6 elasticsearch7; do docker push "openzipkin/zipkin-${storage}:$tag" done done diff --git a/docker/kafka/README.md b/docker/kafka/README.md index 1fbe6435d49..3d742b317ff 100644 --- a/docker/kafka/README.md +++ b/docker/kafka/README.md @@ -1,6 +1,6 @@ ## zipkin-kafka Docker image -The `zipkin-kafka` testing image runs both Kafka+ZooKeeper for the [Kafka collector](https://github.com/openzipkin/zipkin/tree/master/zipkin-collector/kafka) +The `zipkin-kafka` testing image runs both Kafka+ZooKeeper for the [Kafka collector](../../zipkin-collector/kafka) and the upcoming [Kafka storage](https://github.com/openzipkin-contrib/zipkin-storage-kafka). To build `openzipkin/zipkin-kafka`, from the top level of the repository, run: