From 7515eafa92e14731419096f4e4f0f4251bf54fc0 Mon Sep 17 00:00:00 2001 From: Crypt Keeper <64215+codefromthecrypt@users.noreply.github.com> Date: Thu, 29 Feb 2024 19:25:57 +0800 Subject: [PATCH] docker: fixes ui example which extracted lens to the wrong path (#3743) Signed-off-by: Adrian Cole --- .dockerignore | 14 ++++- .../server/ServerIntegratedBenchmark.java | 6 +- build-bin/maybe_install_npm | 11 ++-- docker/examples/docker-compose-ui.yml | 2 +- docker/test-images/zipkin-ui/Dockerfile | 10 ++-- .../collector/activemq/ActiveMQExtension.java | 2 +- .../collector/kafka/KafkaExtension.java | 2 +- .../collector/rabbitmq/RabbitMQExtension.java | 2 +- zipkin-lens/README.md | 16 +++++- zipkin-lens/pom.xml | 57 ++++++++----------- .../internal/eureka/BaseITZipkinEureka.java | 2 +- .../storage/cassandra/CassandraContainer.java | 2 +- .../integration/ElasticsearchExtension.java | 2 +- .../storage/mysql/v1/MySQLExtension.java | 2 +- 14 files changed, 74 insertions(+), 56 deletions(-) diff --git a/.dockerignore b/.dockerignore index 78099dced70..0b2037df512 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,6 +2,7 @@ ** # Scripts that run within Docker +!build-bin/maybe_install_npm !build-bin/maven/maven_build !build-bin/maven/maven_build_or_unjar !build-bin/maven/maven_opts @@ -48,11 +49,22 @@ !zipkin-collector/kafka/src/main/** !zipkin-collector/rabbitmq/src/main/** !zipkin-collector/scribe/src/main/** -!zipkin-junit/src/main/** +!zipkin-junit5/src/main/** !zipkin-storage/src/main/** !zipkin-storage/cassandra/src/main/** !zipkin-storage/mysql-v1/src/main/** !zipkin-storage/elasticsearch/src/main/** !zipkin-server/src/main/** !zipkin-tests/src/main/** +!zipkin-lens/javadoc/** +!zipkin-lens/public/** +!zipkin-lens/src/** +!zipkin-lens/.linguirc +!zipkin-lens/.npmrc +!zipkin-lens/index.html +!zipkin-lens/package-lock.json +!zipkin-lens/package.json +!zipkin-lens/pom.xml +!zipkin-lens/tsconfig.json +!zipkin-lens/vite.config.ts !**/pom.xml diff --git a/benchmarks/src/test/java/zipkin2/server/ServerIntegratedBenchmark.java b/benchmarks/src/test/java/zipkin2/server/ServerIntegratedBenchmark.java index 2c040d0df8d..1e00058b8ac 100644 --- a/benchmarks/src/test/java/zipkin2/server/ServerIntegratedBenchmark.java +++ b/benchmarks/src/test/java/zipkin2/server/ServerIntegratedBenchmark.java @@ -90,7 +90,7 @@ class ServerIntegratedBenchmark { @Test void elasticsearch() throws Exception { GenericContainer elasticsearch = - new GenericContainer<>(parse("ghcr.io/openzipkin/zipkin-elasticsearch7:3.0.6")) + new GenericContainer<>(parse("ghcr.io/openzipkin/zipkin-elasticsearch7:3.1.0")) .withNetwork(Network.SHARED) .withNetworkAliases("elasticsearch") .withLabel("name", "elasticsearch") @@ -104,7 +104,7 @@ class ServerIntegratedBenchmark { @Test void cassandra3() throws Exception { GenericContainer cassandra = - new GenericContainer<>(parse("ghcr.io/openzipkin/zipkin-cassandra:3.0.6")) + new GenericContainer<>(parse("ghcr.io/openzipkin/zipkin-cassandra:3.1.0")) .withNetwork(Network.SHARED) .withNetworkAliases("cassandra") .withLabel("name", "cassandra") @@ -118,7 +118,7 @@ class ServerIntegratedBenchmark { @Test void mysql() throws Exception { GenericContainer mysql = - new GenericContainer<>(parse("ghcr.io/openzipkin/zipkin-mysql:3.0.6")) + new GenericContainer<>(parse("ghcr.io/openzipkin/zipkin-mysql:3.1.0")) .withNetwork(Network.SHARED) .withNetworkAliases("mysql") .withLabel("name", "mysql") diff --git a/build-bin/maybe_install_npm b/build-bin/maybe_install_npm index 9ec7051f346..f2902ae06a0 100755 --- a/build-bin/maybe_install_npm +++ b/build-bin/maybe_install_npm @@ -13,7 +13,6 @@ # the License. # - # This script hydrates the Maven and NPM cache to make later processes operate with less chance of # network problems. arch=$(uname -m) @@ -29,11 +28,13 @@ esac # ARM64 is not supported with musl, yet https://github.com/nodejs/node/blob/master/BUILDING.md # Workaround this by installing node and npm directly. See issue #3166 if [ ${arch} = "arm64" ] && [ -f /etc/alpine-release ]; then - # Get the version of nodejs the build uses. Note: this takes time as it downloads Maven plugins. - node_version=$(mvn help:evaluate -Dexpression=node.version -q -DforceStdout -pl zipkin-lens) - # Defensively avoid arm64+alpine problems with posix_spawn - export MAVEN_OPTS="-Djdk.lang.Process.launchMechanism=vfork" + export MAVEN_OPTS="$($(dirname "$0")/maven/maven_opts)" + if [ -x ./mvnw ]; then alias mvn=${PWD}/mvnw; fi + if [ "${MAVEN_PROJECT_BASEDIR:-.}" != "." ]; then cd ${MAVEN_PROJECT_BASEDIR}; fi + + # Get the version of nodejs the build uses. Note: this takes time as it downloads Maven plugins. + node_version=$(mvn help:evaluate -Dexpression=node.version -DskipTests -q -DforceStdout -pl zipkin-lens) set -x # Repos for https://pkgs.alpinelinux.org/packages?name=nodejs are already in the base image. diff --git a/docker/examples/docker-compose-ui.yml b/docker/examples/docker-compose-ui.yml index e033191adc9..842801f2295 100644 --- a/docker/examples/docker-compose-ui.yml +++ b/docker/examples/docker-compose-ui.yml @@ -1,5 +1,5 @@ # -# Copyright 2015-2023 The OpenZipkin Authors +# Copyright 2015-2024 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 diff --git a/docker/test-images/zipkin-ui/Dockerfile b/docker/test-images/zipkin-ui/Dockerfile index 5672571b9a0..002c643d45a 100644 --- a/docker/test-images/zipkin-ui/Dockerfile +++ b/docker/test-images/zipkin-ui/Dockerfile @@ -32,9 +32,8 @@ FROM scratch as scratch COPY build-bin/ /build-bin/ COPY build-bin/docker/docker-healthcheck /docker-bin/ COPY docker/test-images/zipkin-ui/start-nginx /docker-bin/ -COPY pom.xml /code/ -COPY zipkin-lens/ /code/zipkin-lens/ COPY docker/test-images/zipkin-ui/nginx.conf /conf.d/zipkin.conf.template +COPY . /code/ # This version is only used during the install process. Try to be consistent as it reduces layers, # which reduces downloads. @@ -55,8 +54,9 @@ ENV RELEASE_FROM_MAVEN_BUILD=$release_from_maven_build # Version of the artifact to unjar. Ex. "2.4.5" or "2.4.5-SNAPSHOT" "master" to use the pom version. ARG version=master ENV VERSION=$version -ENV MAVEN_PROJECT_BASEDIR=/code/zipkin-lens -RUN /build-bin/maven/maven_build_or_unjar io.zipkin zipkin-lens ${VERSION} +ENV MAVEN_PROJECT_BASEDIR=/code +RUN if [ "${RELEASE_FROM_MAVEN_BUILD}" == "false" ]; then /build-bin/maybe_install_npm; fi; \ + /build-bin/maven/maven_build_or_unjar io.zipkin zipkin-lens ${VERSION} FROM ghcr.io/openzipkin/alpine:$alpine_version as zipkin-ui LABEL org.opencontainers.image.description="NGINX on Alpine Linux hosting the Zipkin UI with Zipkin API proxy_pass" @@ -73,7 +73,7 @@ HEALTHCHECK --interval=1s --start-period=30s --timeout=5s CMD ["docker-healthche ENTRYPOINT ["start-nginx"] # Add content and setup NGINX -COPY --from=install /install/zipkin-lens/ /var/www/html/zipkin/ +COPY --from=install /install/zipkin-lens/* /var/www/html/zipkin/ COPY --from=scratch /conf.d/ /etc/nginx/conf.d/ RUN apk add --update --no-cache nginx=~${nginx_version} && \ mkdir -p /var/tmp/nginx && chown -R nginx:nginx /var/tmp/nginx diff --git a/zipkin-collector/activemq/src/test/java/zipkin2/collector/activemq/ActiveMQExtension.java b/zipkin-collector/activemq/src/test/java/zipkin2/collector/activemq/ActiveMQExtension.java index 0a9349b1b89..bb89d9ab42f 100644 --- a/zipkin-collector/activemq/src/test/java/zipkin2/collector/activemq/ActiveMQExtension.java +++ b/zipkin-collector/activemq/src/test/java/zipkin2/collector/activemq/ActiveMQExtension.java @@ -63,7 +63,7 @@ String brokerURL() { // mostly waiting for https://github.com/testcontainers/testcontainers-java/issues/3537 static final class ActiveMQContainer extends GenericContainer { ActiveMQContainer() { - super(parse("ghcr.io/openzipkin/zipkin-activemq:3.0.6")); + super(parse("ghcr.io/openzipkin/zipkin-activemq:3.1.0")); withExposedPorts(ACTIVEMQ_PORT); waitStrategy = Wait.forListeningPorts(ACTIVEMQ_PORT); withStartupTimeout(Duration.ofSeconds(60)); diff --git a/zipkin-collector/kafka/src/test/java/zipkin2/collector/kafka/KafkaExtension.java b/zipkin-collector/kafka/src/test/java/zipkin2/collector/kafka/KafkaExtension.java index 1a8fe7bec58..9cc55db9b6e 100644 --- a/zipkin-collector/kafka/src/test/java/zipkin2/collector/kafka/KafkaExtension.java +++ b/zipkin-collector/kafka/src/test/java/zipkin2/collector/kafka/KafkaExtension.java @@ -92,7 +92,7 @@ KafkaCollector.Builder newCollectorBuilder(String topic, int streams) { // mostly waiting for https://github.com/testcontainers/testcontainers-java/issues/3537 static final class KafkaContainer extends GenericContainer { KafkaContainer() { - super(parse("ghcr.io/openzipkin/zipkin-kafka:3.0.6")); + super(parse("ghcr.io/openzipkin/zipkin-kafka:3.1.0")); waitStrategy = Wait.forHealthcheck(); // 19092 is for connections from the Docker host and needs to be used as a fixed port. // TODO: someone who knows Kafka well, make ^^ comment better! diff --git a/zipkin-collector/rabbitmq/src/test/java/zipkin2/collector/rabbitmq/RabbitMQExtension.java b/zipkin-collector/rabbitmq/src/test/java/zipkin2/collector/rabbitmq/RabbitMQExtension.java index a560935cd01..d53716a4afa 100644 --- a/zipkin-collector/rabbitmq/src/test/java/zipkin2/collector/rabbitmq/RabbitMQExtension.java +++ b/zipkin-collector/rabbitmq/src/test/java/zipkin2/collector/rabbitmq/RabbitMQExtension.java @@ -83,7 +83,7 @@ int port() { // mostly waiting for https://github.com/testcontainers/testcontainers-java/issues/3537 static final class RabbitMQContainer extends GenericContainer { RabbitMQContainer() { - super(parse("ghcr.io/openzipkin/zipkin-rabbitmq:3.0.6")); + super(parse("ghcr.io/openzipkin/zipkin-rabbitmq:3.1.0")); withExposedPorts(RABBIT_PORT); waitStrategy = Wait.forLogMessage(".*Server startup complete.*", 1); withStartupTimeout(Duration.ofSeconds(60)); diff --git a/zipkin-lens/README.md b/zipkin-lens/README.md index 67ffd9eb8b3..2b39743df1c 100644 --- a/zipkin-lens/README.md +++ b/zipkin-lens/README.md @@ -2,7 +2,7 @@ Zipkin-lens is the UI for [Zipkin](https://github.com/openzipkin/zipkin). It is a modern replacement of the [classic](https://github.com/openzipkin-attic/zipkin-classic) UI which has proved its merit since the beginning of the Zipkin project. -Here are a couple example screen shots: +Here are a couple example screenshots: Search Screen Trace Detail Screen @@ -36,6 +36,13 @@ It correctly bundles React in production mode and optimizes the build for the be ## Build tips +### Maven build + +This project is not published to NPM, rather Maven, as the primary consumer is [zipkin-server](../zipkin-server). +`../mvnw clean install` installs and builds via NPM. The resulting assets, such as index.html, are +placed into the "zipkin-lens" directory of zipkin-lens.jar. This is published on release as +[io.zipkin:zipkin-lens](https://central.sonatype.com/search?q=io.zipkin%3Azipkin-lens). + ### Use the production node version The production UI is built with Maven. To use the same version, issue this command: @@ -101,10 +108,15 @@ ProxyPassReverse "/proxy/foo/myzipkin" "http://localhost:9411/zipkin/" For the reverse proxy configuration to work, Zipkin needs to be started with the `zipkin.ui.basepath` parameter pointing to the proxy path: -``` +```bash java -jar zipkin.jar --zipkin.ui.basepath=/proxy/foo/myzipkin ``` +or via docker +```bash +docker run -e ZIPKIN_UI_BASEPATH=/proxy/foo/myzipkin -p 9411:9411 openzipkin/zipkin +``` + ## Authentication / Authorization Zipkin Lens can be secured by running it behind an authenticating proxy like [Apache HTTPD](https://httpd.apache.org/docs/current/howto/auth.html), [Nginx](https://nginx.org/en/docs/http/ngx_http_auth_basic_module.html) or similar. diff --git a/zipkin-lens/pom.xml b/zipkin-lens/pom.xml index fd44791310f..27ad17c77d1 100644 --- a/zipkin-lens/pom.xml +++ b/zipkin-lens/pom.xml @@ -25,7 +25,7 @@ zipkin-lens Zipkin Lens - Repackages Zipkin Lens into a jar so we can use it in Spring Boot + Repackages Zipkin Lens into a jar, so we can use it in zipkin-server ${project.basedir}/.. @@ -158,7 +158,7 @@ copy NPM build to zipkin-lens directory - + prepare-package copy-resources @@ -175,6 +175,28 @@ + + + maven-shade-plugin + + + package + + shade + + + + + *:* + + META-INF/ + + + + + + + @@ -262,21 +284,7 @@ npm - install --legacy-peer-deps - - - - - npm lint - - exec - - compile - - npm - - run - lint + install @@ -294,21 +302,6 @@ - - npm run test - - exec - - test - - npm - ${npm.skipTests} - - run - test - - - diff --git a/zipkin-server/src/test/java/zipkin2/server/internal/eureka/BaseITZipkinEureka.java b/zipkin-server/src/test/java/zipkin2/server/internal/eureka/BaseITZipkinEureka.java index a238de5079c..aaf5b13bfae 100644 --- a/zipkin-server/src/test/java/zipkin2/server/internal/eureka/BaseITZipkinEureka.java +++ b/zipkin-server/src/test/java/zipkin2/server/internal/eureka/BaseITZipkinEureka.java @@ -148,7 +148,7 @@ static final class EurekaContainer extends GenericContainer { static final int EUREKA_PORT = 8761; EurekaContainer(Map env) { - super(parse("ghcr.io/openzipkin/zipkin-eureka:3.0.6")); + super(parse("ghcr.io/openzipkin/zipkin-eureka:3.1.0")); withEnv(env); withExposedPorts(EUREKA_PORT); waitStrategy = Wait.forHealthcheck(); diff --git a/zipkin-storage/cassandra/src/test/java/zipkin2/storage/cassandra/CassandraContainer.java b/zipkin-storage/cassandra/src/test/java/zipkin2/storage/cassandra/CassandraContainer.java index 52d4d290b5c..7ec539f2ad9 100644 --- a/zipkin-storage/cassandra/src/test/java/zipkin2/storage/cassandra/CassandraContainer.java +++ b/zipkin-storage/cassandra/src/test/java/zipkin2/storage/cassandra/CassandraContainer.java @@ -42,7 +42,7 @@ class CassandraContainer extends GenericContainer { CqlSession globalSession; CassandraContainer() { - super(parse("ghcr.io/openzipkin/zipkin-cassandra:3.0.6")); + super(parse("ghcr.io/openzipkin/zipkin-cassandra:3.1.0")); addExposedPort(9042); waitStrategy = Wait.forHealthcheck(); withLogConsumer(new Slf4jLogConsumer(LOGGER)); diff --git a/zipkin-storage/elasticsearch/src/test/java/zipkin2/elasticsearch/integration/ElasticsearchExtension.java b/zipkin-storage/elasticsearch/src/test/java/zipkin2/elasticsearch/integration/ElasticsearchExtension.java index a49f0e62c6c..d7c497f2344 100644 --- a/zipkin-storage/elasticsearch/src/test/java/zipkin2/elasticsearch/integration/ElasticsearchExtension.java +++ b/zipkin-storage/elasticsearch/src/test/java/zipkin2/elasticsearch/integration/ElasticsearchExtension.java @@ -126,7 +126,7 @@ String baseUrl() { // mostly waiting for https://github.com/testcontainers/testcontainers-java/issues/3537 static final class ElasticsearchContainer extends GenericContainer { ElasticsearchContainer(int majorVersion) { - super(parse("ghcr.io/openzipkin/zipkin-elasticsearch" + majorVersion + ":3.0.6")); + super(parse("ghcr.io/openzipkin/zipkin-elasticsearch" + majorVersion + ":3.1.0")); addExposedPort(9200); waitStrategy = Wait.forHealthcheck(); withLogConsumer(new Slf4jLogConsumer(LOGGER)); diff --git a/zipkin-storage/mysql-v1/src/test/java/zipkin2/storage/mysql/v1/MySQLExtension.java b/zipkin-storage/mysql-v1/src/test/java/zipkin2/storage/mysql/v1/MySQLExtension.java index 9457706cf7f..94d7fe570cf 100644 --- a/zipkin-storage/mysql-v1/src/test/java/zipkin2/storage/mysql/v1/MySQLExtension.java +++ b/zipkin-storage/mysql-v1/src/test/java/zipkin2/storage/mysql/v1/MySQLExtension.java @@ -112,7 +112,7 @@ int port() { // mostly waiting for https://github.com/testcontainers/testcontainers-java/issues/3537 static final class MySQLContainer extends GenericContainer { MySQLContainer() { - super(parse("ghcr.io/openzipkin/zipkin-mysql:3.0.6")); + super(parse("ghcr.io/openzipkin/zipkin-mysql:3.1.0")); addExposedPort(3306); waitStrategy = Wait.forHealthcheck(); withLogConsumer(new Slf4jLogConsumer(LOGGER));