You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2022/12/29 07:51:43 UTC

[shardingsphere] branch master updated: Add : add docker resource for zipkin docker packaging (#23135) (#23157)

This is an automated email from the ASF dual-hosted git repository.

panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 30e11b55cff Add : add docker resource for zipkin docker packaging (#23135) (#23157)
30e11b55cff is described below

commit 30e11b55cff1ecb414671c0cee2a2fd3ff55002c
Author: 孙念君 Nianjun Sun <su...@apache.org>
AuthorDate: Thu Dec 29 15:51:36 2022 +0800

    Add : add docker resource for zipkin docker packaging (#23135) (#23157)
---
 ...ngsphere-proxy-agent-opentelemetry-assembly.xml |  2 +-
 .../shardingsphere-proxy-agent-zipkin-assembly.xml |  6 +-
 .../src/test/resources/docker/docker-compose.yml   | 58 ++++++++++++++++++
 .../test/resources/docker/proxy/conf/agent.yaml    | 54 +++++++++++++++++
 .../resources/docker/proxy/conf/config-db.yaml     | 70 ++++++++++++++++++++++
 .../test/resources/docker/proxy/conf/logback.xml   | 33 ++++++++++
 .../test/resources/docker/proxy/conf/server.yaml   | 30 ++++++++++
 7 files changed, 249 insertions(+), 4 deletions(-)

diff --git a/test/e2e/agent/plugins/opentelemetry/src/test/assembly/shardingsphere-proxy-agent-opentelemetry-assembly.xml b/test/e2e/agent/plugins/opentelemetry/src/test/assembly/shardingsphere-proxy-agent-opentelemetry-assembly.xml
index 904d7f792f3..7a207064aa5 100644
--- a/test/e2e/agent/plugins/opentelemetry/src/test/assembly/shardingsphere-proxy-agent-opentelemetry-assembly.xml
+++ b/test/e2e/agent/plugins/opentelemetry/src/test/assembly/shardingsphere-proxy-agent-opentelemetry-assembly.xml
@@ -22,7 +22,7 @@
         <format>tar.gz</format>
     </formats>
     <includeBaseDirectory>true</includeBaseDirectory>
-
+    
     <fileSets>
         <fileSet>
             <directory>${project.basedir}/../../../../../agent/plugins/tracing/target/plugins</directory>
diff --git a/test/e2e/agent/plugins/zipkin/src/test/assembly/shardingsphere-proxy-agent-zipkin-assembly.xml b/test/e2e/agent/plugins/zipkin/src/test/assembly/shardingsphere-proxy-agent-zipkin-assembly.xml
index d8845bcc943..cc21a6e6a2c 100644
--- a/test/e2e/agent/plugins/zipkin/src/test/assembly/shardingsphere-proxy-agent-zipkin-assembly.xml
+++ b/test/e2e/agent/plugins/zipkin/src/test/assembly/shardingsphere-proxy-agent-zipkin-assembly.xml
@@ -25,14 +25,14 @@
     
     <fileSets>
         <fileSet>
-            <directory>${project.basedir}/../../../../agent/plugins/tracing/target/plugins</directory>
+            <directory>${project.basedir}/../../../../../agent/plugins/tracing/target/plugins</directory>
             <outputDirectory>./plugins</outputDirectory>
             <includes>
-                <include>shardingsphere-agent-tracing-zipkin-*.jar</include>
+                <include>shardingsphere-agent-tracing-zipkin-${project.version}.jar</include>
             </includes>
         </fileSet>
         <fileSet>
-            <directory>${project.basedir}/../../../../agent/bootstrap/target</directory>
+            <directory>${project.basedir}/../../../../../agent/bootstrap/target</directory>
             <outputDirectory>./</outputDirectory>
             <includes>
                 <include>shardingsphere-agent.jar</include>
diff --git a/test/e2e/agent/plugins/zipkin/src/test/resources/docker/docker-compose.yml b/test/e2e/agent/plugins/zipkin/src/test/resources/docker/docker-compose.yml
new file mode 100644
index 00000000000..e2265492dc0
--- /dev/null
+++ b/test/e2e/agent/plugins/zipkin/src/test/resources/docker/docker-compose.yml
@@ -0,0 +1,58 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+version: "2.1"
+
+services:
+  mysql:
+    image: "mysql/mysql-server:5.7"
+    container_name: agent-tracing-zipkin-mysql
+    command: ['--sql_mode=', '--default-authentication-plugin=mysql_native_password']
+    volumes:
+      - ../env/mysql:/docker-entrypoint-initdb.d/
+    ports:
+      - "43061:3306"
+    environment:
+      - LANG=C.UTF-8
+
+  zipkin:
+    image: "openzipkin/zipkin:latest"
+    container_name: agent-tracing-zipkin
+    restart: always
+    ports:
+      - "19411:9411"
+
+  shardingsphere-proxy-agent-tracing:
+    image: apache/shardingsphere-proxy-agent-zipkin-test
+    container_name: shardingsphere-proxy-agent-zipkin-test
+    ports:
+      - "43071:3307"
+      - "43081:3308"
+      - "19411:9411"
+    links:
+      - "mysql:mysql.agent.tracing.zipkin.host"
+      - "zipkin:zipkin.agent.tracing.zipkin.host"
+    volumes:
+      - ./proxy/conf:/opt/shardingsphere-proxy-agent-tracing-zipkin/conf
+    depends_on:
+      - mysql
+      - zipkin
+    environment:
+      - WAIT_HOSTS=mysql:3306,zipkin:9411
+      - WAIT_HOSTS_TIMEOUT=300
+      - WAIT_SLEEP_INTERVAL=5
+      - WAIT_HOST_CONNECT_TIMEOUT=30
diff --git a/test/e2e/agent/plugins/zipkin/src/test/resources/docker/proxy/conf/agent.yaml b/test/e2e/agent/plugins/zipkin/src/test/resources/docker/proxy/conf/agent.yaml
new file mode 100644
index 00000000000..25e4c156264
--- /dev/null
+++ b/test/e2e/agent/plugins/zipkin/src/test/resources/docker/proxy/conf/agent.yaml
@@ -0,0 +1,54 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+plugins:
+  logging:
+    BaseLogging:
+      props:
+        level: "INFO"
+  metrics:
+#    Prometheus:
+#      host: "localhost"
+#      port: 18090
+#      props:
+#        jvm-information-collector-enabled: "true"
+  tracing:
+#    Jaeger:
+#      host: "localhost"
+#      port: 5775
+#      props:
+#        service-name: "shardingsphere"
+#        jaeger-sampler-type: "const"
+#        jaeger-sampler-param: "1"
+#        jaeger-reporter-log-spans: "true"
+#        jaeger-reporter-flush-interval: "1"
+    Zipkin:
+      host: "localhost"
+      port: 9411
+      props:
+        service-name: "shardingsphere"
+        url-version: "/api/v2/spans"
+        sampler-type: "const"
+        sampler-param: "1"
+#    OpenTracing:
+#      props:
+#        opentracing-tracer-class-name: "org.apache.skywalking.apm.toolkit.opentracing.SkywalkingTracer"
+#    OpenTelemetry:
+#      props:
+#        otel-resource-attributes: "service.name=shardingsphere"
+#        otel-traces-exporter: "zipkin"
+#        otel-exporter-zipkin-endpoint: "http://zipkin.agent.tracing.opentelemetry.host:9411/api/v2/spans"
diff --git a/test/e2e/agent/plugins/zipkin/src/test/resources/docker/proxy/conf/config-db.yaml b/test/e2e/agent/plugins/zipkin/src/test/resources/docker/proxy/conf/config-db.yaml
new file mode 100644
index 00000000000..71cf9e6f6d0
--- /dev/null
+++ b/test/e2e/agent/plugins/zipkin/src/test/resources/docker/proxy/conf/config-db.yaml
@@ -0,0 +1,70 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+databaseName: agent-tracing-zipkin-db
+
+dataSources:
+  ds_0:
+    url: jdbc:mysql://mysql.agent.tracing.zipkin.host:3306/agent_zipkin_db_0?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: root
+    password:
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 10
+    minPoolSize: 2
+  ds_1:
+    url: jdbc:mysql://mysql.agent.tracing.zipkin.host:3306/agent_zipkin_db_1?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: root
+    password:
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 10
+    minPoolSize: 2
+
+rules:
+  - !SHARDING
+    tables:
+      t_order:
+        actualDataNodes: ds_${0..1}.t_order_${0..1}
+        tableStrategy:
+          standard:
+            shardingColumn: order_id
+            shardingAlgorithmName: t_order_inline
+        keyGenerateStrategy:
+          column: order_id
+          keyGeneratorName: snowflake
+    defaultDatabaseStrategy:
+      standard:
+        shardingColumn: user_id
+        shardingAlgorithmName: database_inline
+    defaultTableStrategy:
+      none:
+    shardingAlgorithms:
+      database_inline:
+        type: INLINE
+        props:
+          algorithm-expression: ds_${user_id % 2}
+      t_order_inline:
+        type: INLINE
+        props:
+          algorithm-expression: t_order_${order_id % 2}
+
+    keyGenerators:
+      snowflake:
+        type: SNOWFLAKE
diff --git a/test/e2e/agent/plugins/zipkin/src/test/resources/docker/proxy/conf/logback.xml b/test/e2e/agent/plugins/zipkin/src/test/resources/docker/proxy/conf/logback.xml
new file mode 100644
index 00000000000..1494746120c
--- /dev/null
+++ b/test/e2e/agent/plugins/zipkin/src/test/resources/docker/proxy/conf/logback.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You 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.
+  -->
+
+<configuration>
+    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n</pattern>
+        </encoder>
+    </appender>
+    <logger name="org.apache.shardingsphere" level="info" additivity="false">
+        <appender-ref ref="console" />
+    </logger>
+    
+    <root>
+        <level value="info" />
+        <appender-ref ref="console" />
+    </root>
+</configuration> 
diff --git a/test/e2e/agent/plugins/zipkin/src/test/resources/docker/proxy/conf/server.yaml b/test/e2e/agent/plugins/zipkin/src/test/resources/docker/proxy/conf/server.yaml
new file mode 100644
index 00000000000..5108e6a4a05
--- /dev/null
+++ b/test/e2e/agent/plugins/zipkin/src/test/resources/docker/proxy/conf/server.yaml
@@ -0,0 +1,30 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+#
+
+authority:
+  users:
+    - user: root
+      password: root
+  privilege:
+    type: ALL_PERMITTED
+
+props:
+  max-connections-size-per-query: 1
+  kernel-executor-size: 16  # Infinite by default.
+  proxy-frontend-flush-threshold: 128  # The default value is 128.
+  proxy-hint-enabled: false
+  sql-show: true