From 1e471f1ac78c39ae28b59c0de334df0907b9626a Mon Sep 17 00:00:00 2001 From: Mrproliu <741550557@qq.com> Date: Thu, 9 Nov 2023 21:20:41 +0800 Subject: [PATCH] Adapt docker images for v3 server --- .dockerignore | 19 +++------------ .github/workflows/readme_test.yml | 5 ++-- .../test-images/zipkin-cassandra/Dockerfile | 2 +- .../test-images/zipkin-cassandra/install.sh | 4 ++-- .../zipkin-cassandra/start-cassandra | 2 +- docker/test-images/zipkin-mysql/Dockerfile | 6 ++--- docker/test-images/zipkin-mysql/install.sh | 1 - .../src/main/resources/application.yml | 14 +++++------ .../src/main/resources/zipkin-schemas.cql | 24 +++++++++---------- 9 files changed, 31 insertions(+), 46 deletions(-) diff --git a/.dockerignore b/.dockerignore index e9b55904ccd..f5aa825b0c6 100644 --- a/.dockerignore +++ b/.dockerignore @@ -9,12 +9,11 @@ !build-bin/docker/docker-healthcheck !docker/start-zipkin -!/zipkin-server/target/zipkin-server-*exec.jar -!/zipkin-server/target/zipkin-server-*slim.jar +!/zipkin-server/server-starter/target/zipkin-server-*exec.jar +!/zipkin-server/server-starter/target/zipkin-server-*slim.jar !docker/test-images/zipkin-cassandra/install.sh !docker/test-images/zipkin-cassandra/start-cassandra -!zipkin-storage/cassandra/src/main/resources/*.cql !docker/test-images/zipkin-elasticsearch6/config/ !docker/test-images/zipkin-elasticsearch7/config/ @@ -25,7 +24,6 @@ !docker/test-images/zipkin-mysql/install.sh !docker/test-images/zipkin-mysql/start-mysql -!zipkin-storage/mysql-v1/src/main/resources/mysql.sql !docker/test-images/zipkin-ui/nginx.conf !docker/test-images/zipkin-ui/start-nginx @@ -33,17 +31,6 @@ # Allow on-demand "mvn package". referenced in pom.xml must be added even if not built !zipkin/src/main/** -!zipkin-collector/src/main/** -!zipkin-collector/core/src/main/** -!zipkin-collector/activemq/src/main/** -!zipkin-collector/kafka/src/main/** -!zipkin-collector/rabbitmq/src/main/** -!zipkin-collector/scribe/src/main/** -!zipkin-junit/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-server/** !zipkin-tests/src/main/** !**/pom.xml diff --git a/.github/workflows/readme_test.yml b/.github/workflows/readme_test.yml index fd81d155392..81948240e72 100644 --- a/.github/workflows/readme_test.yml +++ b/.github/workflows/readme_test.yml @@ -49,7 +49,7 @@ jobs: key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-maven- - name: Execute Server Build # command from zipkin-server/README.md - run: ./mvnw -T1C -q --batch-mode -DskipTests --also-make -pl zipkin-server clean package + run: ./mvnw -T1C -q --batch-mode -DskipTests --also-make -pl :zipkin-server clean package docker: runs-on: ubuntu-20.04 # newest available distribution, aka focal @@ -58,6 +58,7 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 1 + submodules: true # Remove apt repos that are known to break from time to time. # See https://github.com/actions/virtual-environments/issues/323 - name: Remove broken apt repos @@ -83,7 +84,7 @@ jobs: key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-maven- - name: zipkin-server/README.md # Tests the build which is re-used for a few images - run: ./mvnw -T1C -q --batch-mode -DskipTests -Dcheckstyle.skip=true --also-make -pl zipkin-server clean package + run: ./mvnw -T1C -q --batch-mode -DskipTests -Dcheckstyle.skip=true --also-make -pl :zipkin-server clean package - name: docker/README.md - openzipkin/zipkin run: | build-bin/docker/docker_build openzipkin/zipkin:test && diff --git a/docker/test-images/zipkin-cassandra/Dockerfile b/docker/test-images/zipkin-cassandra/Dockerfile index e3f86d8456c..deb4dc58cec 100644 --- a/docker/test-images/zipkin-cassandra/Dockerfile +++ b/docker/test-images/zipkin-cassandra/Dockerfile @@ -28,7 +28,7 @@ FROM scratch as scratch COPY build-bin/docker/docker-healthcheck /docker-bin/ COPY docker/test-images/zipkin-cassandra/start-cassandra /docker-bin/ COPY docker/test-images/zipkin-cassandra/install.sh /install/ -COPY zipkin-storage/cassandra/src/main/resources/*.cql /zipkin-schemas/ +COPY zipkin-server/storage-cassandra/src/main/resources/*.cql /zipkin-schemas/ FROM ghcr.io/openzipkin/java:${java_version} as install diff --git a/docker/test-images/zipkin-cassandra/install.sh b/docker/test-images/zipkin-cassandra/install.sh index 59b72569fd9..c3d711ff270 100755 --- a/docker/test-images/zipkin-cassandra/install.sh +++ b/docker/test-images/zipkin-cassandra/install.sh @@ -132,7 +132,7 @@ log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c)%n log4j.appender.stdout.Target=System.out EOF -cat zipkin-schemas/zipkin2-schema.cql zipkin-schemas/zipkin2-schema-indexes.cql > schema +cat zipkin-schemas/zipkin-schemas.cql > schema case ${CASSANDRA_VERSION} in 3.11* ) cqlversion=3.4.4 @@ -149,7 +149,7 @@ jdk11_modules="--add-exports java.base/jdk.internal.misc=ALL-UNNAMED \ --add-exports java.base/jdk.internal.ref=ALL-UNNAMED \ --add-exports java.base/sun.nio.ch=ALL-UNNAMED \ --add-exports java.sql/java.sql=ALL-UNNAMED \ - --add-opens java.base/java.lang.module=ALL-UNNAMED \ + --add-opens java.base/java.lang=ALL-UNNAMED \ --add-opens java.base/jdk.internal.loader=ALL-UNNAMED \ --add-opens java.base/jdk.internal.ref=ALL-UNNAMED \ --add-opens java.base/jdk.internal.reflect=ALL-UNNAMED \ diff --git a/docker/test-images/zipkin-cassandra/start-cassandra b/docker/test-images/zipkin-cassandra/start-cassandra index 65d3f80b8f9..9e284e4baed 100755 --- a/docker/test-images/zipkin-cassandra/start-cassandra +++ b/docker/test-images/zipkin-cassandra/start-cassandra @@ -44,7 +44,7 @@ jdk11_modules="--add-exports java.base/jdk.internal.misc=ALL-UNNAMED \ --add-exports java.base/jdk.internal.ref=ALL-UNNAMED \ --add-exports java.base/sun.nio.ch=ALL-UNNAMED \ --add-exports java.sql/java.sql=ALL-UNNAMED \ - --add-opens java.base/java.lang.module=ALL-UNNAMED \ + --add-opens java.base/java.lang=ALL-UNNAMED \ --add-opens java.base/jdk.internal.loader=ALL-UNNAMED \ --add-opens java.base/jdk.internal.ref=ALL-UNNAMED \ --add-opens java.base/jdk.internal.reflect=ALL-UNNAMED \ diff --git a/docker/test-images/zipkin-mysql/Dockerfile b/docker/test-images/zipkin-mysql/Dockerfile index 9bd4a8ebd29..5dd3adbdd91 100644 --- a/docker/test-images/zipkin-mysql/Dockerfile +++ b/docker/test-images/zipkin-mysql/Dockerfile @@ -25,7 +25,6 @@ FROM scratch as scratch COPY build-bin/docker/docker-healthcheck /docker-bin/ COPY docker/test-images/zipkin-mysql/start-mysql /docker-bin/ COPY docker/test-images/zipkin-mysql/install.sh /install/ -COPY zipkin-storage/mysql-v1/src/main/resources/mysql.sql /zipkin-schemas/ FROM ghcr.io/openzipkin/alpine:${alpine_version} as zipkin-mysql LABEL org.opencontainers.image.description="MySQL on Alpine Linux with Zipkin schema pre-installed" @@ -37,13 +36,12 @@ HEALTHCHECK --interval=1s --start-period=30s --timeout=5s CMD ["docker-healthche ENTRYPOINT ["start-mysql"] # Use latest from https://pkgs.alpinelinux.org/packages?name=mysql -ARG mysql_version=10.11.4 +ARG mysql_version=10.11.5 LABEL mysql-version=$mysql_version ENV MYSQL_VERSION=$mysql_version WORKDIR /tmp -COPY --from=scratch /zipkin-schemas/* ./install/zipkin-schemas/ -COPY --from=scratch /install/install.sh ./install +COPY --from=scratch /install/install.sh ./install/ RUN (cd install && ./install.sh) && rm -rf ./install # All content including binaries and logs write under WORKDIR diff --git a/docker/test-images/zipkin-mysql/install.sh b/docker/test-images/zipkin-mysql/install.sh index 3958e72fb0f..30796e492b6 100755 --- a/docker/test-images/zipkin-mysql/install.sh +++ b/docker/test-images/zipkin-mysql/install.sh @@ -56,7 +56,6 @@ DROP DATABASE IF EXISTS test ; CREATE DATABASE zipkin ; USE zipkin; -SOURCE zipkin-schemas/mysql.sql ; GRANT ALL PRIVILEGES ON zipkin.* TO zipkin@'%' IDENTIFIED BY 'zipkin' WITH GRANT OPTION ; FLUSH PRIVILEGES ; diff --git a/zipkin-server/server-starter/src/main/resources/application.yml b/zipkin-server/server-starter/src/main/resources/application.yml index 93d36eaab11..860aca2d187 100644 --- a/zipkin-server/server-starter/src/main/resources/application.yml +++ b/zipkin-server/server-starter/src/main/resources/application.yml @@ -49,7 +49,7 @@ core: storage: &storage selector: ${ZIPKIN_STORAGE:h2} elasticsearch: - namespace: ${ZIPKIN_NAMESPACE:""} + namespace: ${ZIPKIN_NAMESPACE:"zipkin"} clusterNodes: ${ZIPKIN_STORAGE_ES_CLUSTER_NODES:localhost:9200} protocol: ${ZIPKIN_STORAGE_ES_HTTP_PROTOCOL:"http"} connectTimeout: ${ZIPKIN_STORAGE_ES_CONNECT_TIMEOUT:3000} @@ -92,17 +92,17 @@ storage: &storage enableCustomRouting: ${ZIPKIN_STORAGE_ES_ENABLE_CUSTOM_ROUTING:false} h2: properties: - jdbcUrl: ${ZIPKIN_STORAGE_H2_URL:jdbc:h2:mem:skywalking-oap-db;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=FALSE} + jdbcUrl: ${ZIPKIN_STORAGE_H2_URL:jdbc:h2:mem:zipkin-db;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=FALSE} dataSource.user: ${ZIPKIN_STORAGE_H2_USER:sa} metadataQueryMaxSize: ${ZIPKIN_STORAGE_H2_QUERY_MAX_SIZE:5000} maxSizeOfBatchSql: ${ZIPKIN_STORAGE_MAX_SIZE_OF_BATCH_SQL:100} asyncBatchPersistentPoolSize: ${ZIPKIN_STORAGE_ASYNC_BATCH_PERSISTENT_POOL_SIZE:1} mysql: properties: - jdbcUrl: ${ZIPKIN_JDBC_URL:"jdbc:mysql://localhost:3306/swtest?rewriteBatchedStatements=true&allowMultiQueries=true"} + jdbcUrl: ${ZIPKIN_JDBC_URL:"jdbc:mysql://localhost:3306/zipkin?rewriteBatchedStatements=true&allowMultiQueries=true"} driverClassName: org.mariadb.jdbc.Driver - dataSource.user: ${ZIPKIN_DATA_SOURCE_USER:root} - dataSource.password: ${ZIPKIN_DATA_SOURCE_PASSWORD:root@1234} + dataSource.user: ${ZIPKIN_DATA_SOURCE_USER:zipkin} + dataSource.password: ${ZIPKIN_DATA_SOURCE_PASSWORD:zipkin} dataSource.cachePrepStmts: ${ZIPKIN_DATA_SOURCE_CACHE_PREP_STMTS:true} dataSource.prepStmtCacheSize: ${ZIPKIN_DATA_SOURCE_PREP_STMT_CACHE_SQL_SIZE:250} dataSource.prepStmtCacheSqlLimit: ${ZIPKIN_DATA_SOURCE_PREP_STMT_CACHE_SQL_LIMIT:2048} @@ -112,7 +112,7 @@ storage: &storage asyncBatchPersistentPoolSize: ${ZIPKIN_STORAGE_ASYNC_BATCH_PERSISTENT_POOL_SIZE:4} postgresql: properties: - jdbcUrl: ${ZIPKIN_JDBC_URL:"jdbc:postgresql://localhost:5432/skywalking"} + jdbcUrl: ${ZIPKIN_JDBC_URL:"jdbc:postgresql://localhost:5432/zipkin"} dataSource.user: ${ZIPKIN_DATA_SOURCE_USER:postgres} dataSource.password: ${ZIPKIN_DATA_SOURCE_PASSWORD:123456} dataSource.cachePrepStmts: ${ZIPKIN_DATA_SOURCE_CACHE_PREP_STMTS:true} @@ -286,7 +286,7 @@ cluster: # Please check your ZooKeeper is 3.5+, However, it is also compatible with ZooKeeper 3.4.x. Replace the ZooKeeper 3.5+ # library the oap-libs folder with your ZooKeeper 3.4.x library. zookeeper: - namespace: ${ZIPKIN_NAMESPACE:""} + namespace: ${ZIPKIN_NAMESPACE:"zipkin"} hostPort: ${ZIPKIN_CLUSTER_ZK_HOST_PORT:localhost:2181} # Retry Policy baseSleepTimeMs: ${ZIPKIN_CLUSTER_ZK_SLEEP_TIME:1000} # initial amount of time to wait between retries diff --git a/zipkin-server/storage-cassandra/src/main/resources/zipkin-schemas.cql b/zipkin-server/storage-cassandra/src/main/resources/zipkin-schemas.cql index b1c8d8cdf8e..4830b110b17 100644 --- a/zipkin-server/storage-cassandra/src/main/resources/zipkin-schemas.cql +++ b/zipkin-server/storage-cassandra/src/main/resources/zipkin-schemas.cql @@ -1,8 +1,8 @@ -CREATE KEYSPACE IF NOT EXISTS zipkin2 +CREATE KEYSPACE IF NOT EXISTS zipkin WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = false; -CREATE TABLE IF NOT EXISTS zipkin_span ( +CREATE TABLE IF NOT EXISTS zipkin.zipkin_span ( trace_id text, span_id text, parent_id text, @@ -35,16 +35,16 @@ CREATE TABLE IF NOT EXISTS zipkin_span ( AND speculative_retry = '95percentile' AND comment = 'Primary table for holding trace data'; -CREATE CUSTOM INDEX IF NOT EXISTS ON zipkin_span (local_endpoint_service_name) USING 'org.apache.cassandra.index.sasi.SASIIndex' +CREATE CUSTOM INDEX IF NOT EXISTS ON zipkin.zipkin_span (local_endpoint_service_name) USING 'org.apache.cassandra.index.sasi.SASIIndex' WITH OPTIONS = {'mode': 'PREFIX'}; -CREATE CUSTOM INDEX IF NOT EXISTS ON zipkin_span (annotation_query) USING 'org.apache.cassandra.index.sasi.SASIIndex' +CREATE CUSTOM INDEX IF NOT EXISTS ON zipkin.zipkin_span (annotation_query) USING 'org.apache.cassandra.index.sasi.SASIIndex' WITH OPTIONS = { 'mode': 'PREFIX', 'analyzed': 'true', 'analyzer_class':'org.apache.cassandra.index.sasi.analyzer.DelimiterAnalyzer', 'delimiter': '░'}; -CREATE TABLE IF NOT EXISTS zipkin_service_relation_traffic ( +CREATE TABLE IF NOT EXISTS zipkin.zipkin_service_relation_traffic ( id text, table_name text, service_name text, @@ -61,7 +61,7 @@ CREATE TABLE IF NOT EXISTS zipkin_service_relation_traffic ( AND speculative_retry = '95percentile' AND comment = 'Secondary table for looking up remote service names by a service name.'; -CREATE TABLE IF NOT EXISTS zipkin_service_span_traffic ( +CREATE TABLE IF NOT EXISTS zipkin.zipkin_service_span_traffic ( id text, table_name text, service_name text, @@ -78,7 +78,7 @@ CREATE TABLE IF NOT EXISTS zipkin_service_span_traffic ( AND speculative_retry = '95percentile' AND comment = 'Secondary table for looking up span names by a service name.'; -CREATE TABLE IF NOT EXISTS zipkin_service_traffic ( +CREATE TABLE IF NOT EXISTS zipkin.zipkin_service_traffic ( id text, table_name text, service_name text, @@ -93,7 +93,7 @@ CREATE TABLE IF NOT EXISTS zipkin_service_traffic ( AND speculative_retry = '95percentile' AND comment = 'Secondary table for looking up all services'; -CREATE TABLE IF NOT EXISTS tag_autocomplete ( +CREATE TABLE IF NOT EXISTS zipkin.tag_autocomplete ( id text, table_name text, tag_key text, @@ -112,7 +112,7 @@ CREATE TABLE IF NOT EXISTS tag_autocomplete ( AND comment = 'Secondary table for looking up span tag values for auto-complete purposes.'; -CREATE TABLE IF NOT EXISTS zipkin_trace_by_service_span ( +CREATE TABLE IF NOT EXISTS zipkin.zipkin_trace_by_service_span ( service text, //-- service name span text, //-- span name, or blank for queries without span name bucket int, //-- time bucket, calculated as ts/interval (in microseconds), for some pre-configured interval like 1 day. @@ -130,10 +130,10 @@ CREATE TABLE IF NOT EXISTS zipkin_trace_by_service_span ( AND speculative_retry = '95percentile' AND comment = 'Secondary table for looking up a trace by a service, or service and span. span column may be blank (when only looking up by service). bucket column adds time bucketing to the partition key, values are microseconds rounded to a pre-configured interval (typically one day). ts column is start timestamp of the span as time-uuid, truncated to millisecond precision. duration column is span duration, rounded up to tens of milliseconds (or hundredths of seconds)'; -CREATE CUSTOM INDEX IF NOT EXISTS ON zipkin_trace_by_service_span (duration) USING 'org.apache.cassandra.index.sasi.SASIIndex' +CREATE CUSTOM INDEX IF NOT EXISTS ON zipkin.zipkin_trace_by_service_span (duration) USING 'org.apache.cassandra.index.sasi.SASIIndex' WITH OPTIONS = {'mode': 'PREFIX'}; -CREATE TABLE IF NOT EXISTS zipkin_trace_by_service_remote_service ( +CREATE TABLE IF NOT EXISTS zipkin.zipkin_trace_by_service_remote_service ( service text, //-- service name remote_service text, //-- remote servie name bucket int, //-- time bucket, calculated as ts/interval (in microseconds), for some pre-configured interval like 1 day. @@ -150,7 +150,7 @@ CREATE TABLE IF NOT EXISTS zipkin_trace_by_service_remote_service ( AND speculative_retry = '95percentile' AND comment = 'Secondary table for looking up a trace by a remote service. bucket column adds time bucketing to the partition key, values are microseconds rounded to a pre-configured interval (typically one day). ts column is start timestamp of the span as time-uuid, truncated to millisecond precision.'; -CREATE TABLE IF NOT EXISTS zipkin_dependency ( +CREATE TABLE IF NOT EXISTS zipkin.zipkin_dependency ( analyze_day date, parent text, child text,