Skip to content

Commit

Permalink
Adapt docker images for v3 server
Browse files Browse the repository at this point in the history
  • Loading branch information
mrproliu committed Nov 10, 2023
1 parent 29a392f commit 1e471f1
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 46 deletions.
19 changes: 3 additions & 16 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -25,25 +24,13 @@

!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
!zipkin-lens/target/zipkin-lens-*.jar

# Allow on-demand "mvn package". <modules> 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
5 changes: 3 additions & 2 deletions .github/workflows/readme_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 &&
Expand Down
2 changes: 1 addition & 1 deletion docker/test-images/zipkin-cassandra/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions docker/test-images/zipkin-cassandra/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion docker/test-images/zipkin-cassandra/start-cassandra
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
6 changes: 2 additions & 4 deletions docker/test-images/zipkin-mysql/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion docker/test-images/zipkin-mysql/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;
Expand Down
14 changes: 7 additions & 7 deletions zipkin-server/server-starter/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand All @@ -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}
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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,
Expand Down

0 comments on commit 1e471f1

Please sign in to comment.