-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test-image zipkin-elasticsearch8
- Loading branch information
Showing
7 changed files
with
182 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# | ||
# Copyright 2015-2023 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. | ||
# | ||
|
||
# java_version is used for install and runtime layers of zipkin-elasticsearch8 | ||
# | ||
# Use latest version here: https://github.com/orgs/openzipkin/packages/container/package/java | ||
# This is defined in many places because Docker has no "env" script functionality unless you use | ||
# docker-compose: When updating, update everywhere. | ||
ARG java_version=17.0.7_p7 | ||
|
||
# We copy files from the context into a scratch container first to avoid a problem where docker and | ||
# docker-compose don't share layer hashes https://github.com/docker/compose/issues/883 normally. | ||
# COPY --from= works around the issue. | ||
FROM scratch as scratch | ||
|
||
COPY build-bin/docker/docker-healthcheck /docker-bin/ | ||
COPY docker/test-images/zipkin-elasticsearch8/start-elasticsearch /docker-bin/ | ||
COPY docker/test-images/zipkin-elasticsearch8/config/ /config/ | ||
|
||
FROM ghcr.io/openzipkin/java:${java_version} as install | ||
|
||
WORKDIR /install | ||
|
||
# Use latest 7.x version from https://www.elastic.co/downloads/past-releases#elasticsearch | ||
# This is defined in many places because Docker has no "env" script functionality unless you use | ||
# docker-compose: When updating, update everywhere. | ||
ARG elasticsearch8_version=8.9.1 | ||
|
||
# Download only the OSS distribution (lacks X-Pack) | ||
RUN \ | ||
# Connection resets are frequent in GitHub Actions workflows | ||
wget --random-wait --tries=5 -qO- \ | ||
# We don't download bin scripts as we customize for reasons including BusyBox problems | ||
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-oss-${elasticsearch8_version}-no-jdk-linux-x86_64.tar.gz| tar xz \ | ||
--wildcards --strip=1 --exclude=*/bin && mkdir classes | ||
|
||
COPY --from=scratch /config/ ./config/ | ||
|
||
FROM ghcr.io/openzipkin/java:${java_version}-jre as zipkin-elasticsearch8 | ||
LABEL org.opencontainers.image.description="Elasticsearch OSS distribution on OpenJDK and Alpine Linux" | ||
ARG elasticsearch8_version=8.9.1 | ||
LABEL elasticsearch-version=$elasticsearch8_version | ||
|
||
# Add HEALTHCHECK and ENTRYPOINT scripts into the default search path | ||
COPY --from=scratch /docker-bin/* /usr/local/bin/ | ||
# We use start period of 30s to avoid marking the container unhealthy on slow or contended CI hosts | ||
HEALTHCHECK --interval=1s --start-period=30s --timeout=5s CMD ["docker-healthcheck"] | ||
ENTRYPOINT ["start-elasticsearch"] | ||
|
||
# All content including binaries and logs write under WORKDIR | ||
ARG USER=elasticsearch | ||
WORKDIR /${USER} | ||
|
||
# Ensure the process doesn't run as root | ||
RUN adduser -g '' -h ${PWD} -D ${USER} | ||
USER ${USER} | ||
|
||
# Copy binaries and config we installed earlier | ||
COPY --from=install --chown=${USER} /install . | ||
|
||
# Use to set heap, trust store or other system properties. | ||
ENV JAVA_OPTS="-Xms256m -Xmx256m -XX:+ExitOnOutOfMemoryError" | ||
EXPOSE 9200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
## zipkin-elasticsearch8 Docker image | ||
|
||
The `zipkin-elasticsearch8` testing image runs Elasticsearch 8.x for [Elasticsearch storage](../../../zipkin-storage/elasticsearch) | ||
integration. | ||
|
||
To build `openzipkin/zipkin-elasticsearch8:test`, from the top-level of the repository, run: | ||
```bash | ||
$ DOCKER_FILE=docker/test-images/zipkin-elasticsearch8/Dockerfile build-bin/docker/docker_build openzipkin/zipkin-elasticsearch8:test | ||
``` | ||
|
||
You can use the env variable `JAVA_OPTS` to change settings such as heap size for Elasticsearch. | ||
|
||
#### 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" | ||
``` |
19 changes: 19 additions & 0 deletions
19
docker/test-images/zipkin-elasticsearch8/config/elasticsearch.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# | ||
# Copyright 2015-2020 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 |
24 changes: 24 additions & 0 deletions
24
docker/test-images/zipkin-elasticsearch8/config/log4j2.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# | ||
# Copyright 2015-2020 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.}] [%node_name]%marker %m%n | ||
|
||
rootLogger.level = info | ||
rootLogger.appenderRef.console.ref = console | ||
|
40 changes: 40 additions & 0 deletions
40
docker/test-images/zipkin-elasticsearch8/start-elasticsearch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/sh | ||
# | ||
# Copyright 2015-2020 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. | ||
# | ||
|
||
# ENTRYPOINT script that starts Elasticsearch | ||
# | ||
# This intentionally locates config using the current working directory, in order to consolidate | ||
# Dockerfile instructions to WORKDIR | ||
set -eu | ||
|
||
# This file inlines what's done by the Elasticsearch script machinery, which doesn't work here due | ||
# to our images using busybox (not bash). See #3044 | ||
# | ||
# Notable settings: | ||
# * lower heap size | ||
# * tmpdir manual as https://github.com/elastic/elasticsearch/pull/31003 was closed won't fix | ||
# * disable log4j JMX not just because we don't use it... | ||
# * ES enables security manager https://github.com/elastic/elasticsearch/issues/21932#issuecomment-264435034 | ||
|
||
# Configure the Docker HEALTHCHECK | ||
export HEALTHCHECK_PORT=9200 | ||
export HEALTHCHECK_PATH=/_cluster/health | ||
|
||
# -cp 'classes:lib/*' allows layers to patch the image without packaging or overwriting jars | ||
exec java -cp 'classes:lib/*' ${JAVA_OPTS} \ | ||
-Djava.io.tmpdir=/tmp \ | ||
-Dlog4j2.disable.jmx=true \ | ||
-Des.path.home=$PWD -Des.path.conf=$PWD/config \ | ||
org.elasticsearch.bootstrap.Elasticsearch "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters