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

xiatian pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/eventmesh-dashboard.git


The following commit(s) were added to refs/heads/main by this push:
     new 0c6ba95  [ISSUE #134] Deploy Meta, Event Store and Runtime test 
environments in CI (#135)
0c6ba95 is described below

commit 0c6ba953ea4ddef8f2ac66d42905e2851f7eb81b
Author: Pil0tXia <[email protected]>
AuthorDate: Sat Apr 20 13:41:25 2024 +0800

    [ISSUE #134] Deploy Meta, Event Store and Runtime test environments in CI 
(#135)
    
    * Deploy Meta and Event Store (+7 squashed commit)
    
    Squashed commit:
    
    [5acff2f] All set up
    
    [d7709f3] Fix 
https://github.com/Pil0tXia/eventmesh-dashboard/actions/runs/8750467914/job/24014067077
    
    [7511311] Fix 
https://github.com/Pil0tXia/eventmesh-dashboard/actions/runs/8750423240/job/24013937143
    
    [f45a4d1] attempt 3
    
    [5816c89] attempt 2
    
    [72d2739] Fix 
https://github.com/Pil0tXia/eventmesh-dashboard/actions/runs/8750043293/job/24012794317
    
    [0ef9ba8] fix attempt 1 (+1 squashed commits)
    
    Squashed commits:
    
    [51fcaa5] attempt 1
    
    * Deploy Meta binary instead
    
    * Deploy EventMesh
    
    * Optimize nacos tests
    
    * Fix Runtime dist path
    
    * remove jacoco
    
    * add redis & copy config
    
    * Fix relative path
---
 .github/workflows/ci.yml                           |  57 ++++++++-
 .github/workflows/config/eventmesh.properties      | 140 +++++++++++++++++++++
 .../check/impl/meta/NacosConfigCheckTest.java      |   4 +-
 .../function/SDK/config/CreateNacosConfig.java     |  12 +-
 .../SDK/operation/NacosConfigSDKOperation.java     |   5 +
 .../SDK/operation/NacosNamingSDKOperation.java     |   5 +
 .../SDK/operation/NacosNamingSDKOperationTest.java |  20 +--
 7 files changed, 227 insertions(+), 16 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 025bc90..27d6ab9 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -33,7 +33,7 @@ jobs:
       matrix:
         os: [ ubuntu-latest ]
         java: [ 8, 11 ]
-        language: ['java']
+        language: [ 'java' ]
     runs-on: ${{ matrix.os }}
 
     services:
@@ -48,11 +48,37 @@ jobs:
           - 3306:3306
         # Set health checks to wait until MySQL has started
         options: --health-cmd="mysqladmin ping" --health-interval=10s 
--health-timeout=5s --health-retries=3
+      redis:
+        image: redis
+        ports:
+          - 6379:6379
+        options: --health-cmd="redis-cli ping" --health-interval=10s 
--health-timeout=5s --health-retries=3
 
     steps:
       - name: Checkout repository
         uses: actions/checkout@v4
 
+      - name: Download middlewares
+        run: |
+          wget 
https://github.com/alibaba/nacos/releases/download/2.3.2/nacos-server-2.3.2.zip
+          unzip nacos-server-2.3.2.zip
+          wget 
https://dist.apache.org/repos/dist/release/rocketmq/4.9.8/rocketmq-all-4.9.8-bin-release.zip
+          unzip rocketmq-all-4.9.8-bin-release.zip
+          git clone https://github.com/apache/eventmesh.git
+
+      - name: Setup Gradle
+        uses: gradle/gradle-build-action@v2
+
+      - name: Set up JDK 11
+        uses: actions/setup-java@v3
+        with:
+          distribution: 'corretto'
+          java-version: 11
+
+      - name: Build EventMesh GenerateGrammarSource
+        working-directory: eventmesh
+        run: ./gradlew clean generateGrammarSource --parallel --daemon
+
       - name: Set up JDK ${{ matrix.java }}
         uses: actions/setup-java@v4
         with:
@@ -60,5 +86,30 @@ jobs:
           java-version: ${{ matrix.java }}
           cache: maven
 
-      - name: Build with Maven
-        run: ./mvnw -B package --file pom.xml
+      - name: Build EventMesh Runtime
+        working-directory: eventmesh
+        run: ./gradlew clean dist -x spotlessJava -x generateGrammarSource 
--parallel --daemon && ./gradlew installPlugin
+
+      - name: Apply configuration file
+        run: cp .github/workflows/config/eventmesh.properties 
eventmesh/dist/conf/eventmesh.properties
+
+      - name: Set up Meta
+        working-directory: nacos
+        run: nohup bash bin/startup.sh -m standalone &
+
+      - name: Set up Event Store
+        working-directory: rocketmq-all-4.9.8-bin-release
+        run: |
+          nohup sh bin/mqnamesrv &
+          sleep 5
+          nohup sh bin/mqbroker -n localhost:9876 &
+
+      - name: Set up EventMesh Runtime
+        working-directory: eventmesh/dist
+        run: bash bin/start.sh
+
+      - name: Build Dashboard
+        run: ./mvnw -B package -DskipTests --file pom.xml
+
+      - name: Run Unit Tests
+        run: ./mvnw -B test --file pom.xml
diff --git a/.github/workflows/config/eventmesh.properties 
b/.github/workflows/config/eventmesh.properties
new file mode 100644
index 0000000..7f26487
--- /dev/null
+++ b/.github/workflows/config/eventmesh.properties
@@ -0,0 +1,140 @@
+#
+# 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.
+#
+########################## EventMesh Runtime Environment 
##########################
+eventMesh.server.idc=DEFAULT
+eventMesh.server.env=PRD
+eventMesh.server.provide.protocols=HTTP,TCP,GRPC
+eventMesh.server.cluster=COMMON
+eventMesh.server.name=EVENTMESH-runtime
+eventMesh.sysid=0000
+eventMesh.server.tcp.port=10000
+eventMesh.server.http.port=10105
+eventMesh.server.grpc.port=10205
+# HTTP Admin Server
+eventMesh.server.admin.http.port=10106
+
+########################## EventMesh TCP Configuration 
##########################
+eventMesh.server.tcp.enabled=true
+eventMesh.server.tcp.readerIdleSeconds=120
+eventMesh.server.tcp.writerIdleSeconds=120
+eventMesh.server.tcp.allIdleSeconds=120
+eventMesh.server.tcp.clientMaxNum=10000
+# client isolation time if the message send failure
+eventMesh.server.tcp.pushFailIsolateTimeInMills=30000
+# rebalance internal
+eventMesh.server.tcp.RebalanceIntervalInMills=30000
+# session expire time about client
+eventMesh.server.session.expiredInMills=60000
+# flow control, include the global level and session level
+eventMesh.server.tcp.msgReqnumPerSecond=15000
+eventMesh.server.http.msgReqnumPerSecond=15000
+eventMesh.server.session.upstreamBufferSize=20
+
+# for single event publish, maximum size allowed per event
+eventMesh.server.maxEventSize=1000
+# for batch event publish, maximum number of events allowed in one batch
+eventMesh.server.maxEventBatchSize=10
+
+# thread number about global scheduler
+eventMesh.server.global.scheduler=5
+eventMesh.server.tcp.taskHandleExecutorPoolSize=8
+# retry
+eventMesh.server.retry.async.pushRetryTimes=3
+eventMesh.server.retry.sync.pushRetryTimes=3
+eventMesh.server.retry.async.pushRetryDelayInMills=500
+eventMesh.server.retry.sync.pushRetryDelayInMills=500
+eventMesh.server.retry.pushRetryQueueSize=10000
+eventMesh.server.retry.plugin.type=default
+
+# sleep interval between closing client of different group in server graceful 
shutdown
+eventMesh.server.gracefulShutdown.sleepIntervalInMills=1000
+eventMesh.server.rebalanceRedirect.sleepIntervalInMills=200
+
+# ip address blacklist
+eventMesh.server.blacklist.ipv4=0.0.0.0/8,127.0.0.0/8,169.254.0.0/16,255.255.255.255/32
+eventMesh.server.blacklist.ipv6=::/128,::1/128,ff00::/8
+
+########################## EventMesh Plugin Configuration 
##########################
+# storage plugin
+eventMesh.storage.plugin.type=rocketmq
+
+# security plugin
+eventMesh.server.security.enabled=false
+eventMesh.security.plugin.type=security
+eventMesh.security.validation.type.token=false
+eventMesh.security.publickey=
+
+# metaStorage plugin
+eventMesh.metaStorage.plugin.enabled=true
+eventMesh.metaStorage.plugin.type=nacos
+eventMesh.metaStorage.plugin.server-addr=127.0.0.1:8848
+eventMesh.metaStorage.plugin.username=nacos
+eventMesh.metaStorage.plugin.password=nacos
+
+# metaStorage plugin: nacos
+#eventMesh.metaStorage.nacos.endpoint=
+#eventMesh.metaStorage.nacos.accessKey=
+#eventMesh.metaStorage.nacos.secretKey=
+#eventMesh.metaStorage.nacos.clusterName=
+#eventMesh.metaStorage.nacos.namespace=
+# The default value is half of CPU's num
+#eventMesh.metaStorage.nacos.namingPollingThreadCount=5
+
+# metaStorage plugin: zookeeper
+#eventMesh.metaStorage.zookeeper.scheme=
+#eventMesh.metaStorage.zookeeper.auth=
+#eventMesh.metaStorage.zookeeper.connectionTimeoutMs=
+#eventMesh.metaStorage.zookeeper.sessionTimeoutMs=
+
+# Fully qualified name of org.apache.curator.RetryPolicy implementation
+#eventMesh.metaStorage.zookeeper.retryPolicy.class=
+
+# Constructor arguments for different org.apache.curator.RetryPolicy 
implementations
+#eventMesh.metaStorage.zookeeper.retryPolicy.baseSleepTimeMs=
+#eventMesh.metaStorage.zookeeper.retryPolicy.maxRetries=
+#eventMesh.metaStorage.zookeeper.retryPolicy.maxSleepTimeMs=
+#eventMesh.metaStorage.zookeeper.retryPolicy.retryIntervalMs=
+#eventMesh.metaStorage.zookeeper.retryPolicy.nTimes=
+#eventMesh.metaStorage.zookeeper.retryPolicy.sleepMsBetweenRetries=
+
+# The TLS configuration of metaStorage plugin: consul
+# keyStoreInstanceType's value can refer to 
com.ecwid.consul.transport.TLSConfig.KeyStoreInstanceType
+#eventMesh.metaStorage.consul.tls.keyStoreInstanceType=
+#eventMesh.metaStorage.consul.tls.certificatePath=
+#eventMesh.metaStorage.consul.tls.certificatePassword=
+#eventMesh.metaStorage.consul.tls.keyStorePath=
+#eventMesh.metaStorage.consul.tls.keyStorePassword=
+
+# metrics plugin, if you have multiple plugin, you can use ',' to split
+eventMesh.metrics.plugin=prometheus
+
+# trace plugin
+eventMesh.server.trace.enabled=false
+eventMesh.trace.plugin=zipkin
+
+# webhook
+# Start webhook admin service
+eventMesh.webHook.admin.start=true
+# Webhook event configuration storage mode. Currently, only file and nacos are 
supported
+eventMesh.webHook.operationMode=file
+# The file storage path of the file storage mode. If #{eventMeshHome} is 
written, it is in the EventMesh root directory
+eventMesh.webHook.fileMode.filePath= #{eventMeshHome}/webhook
+# Nacos storage mode, and the configuration naming rule is EventMesh webHook. 
nacosMode. {nacos native configuration key} please see the specific 
configuration [nacos github 
api](https://github.com/alibaba/nacos/blob/develop/api/src/main/java/com/alibaba/nacos/api/SystemPropertyKeyConst.java)
+## Address of Nacos
+eventMesh.webHook.nacosMode.serverAddr=127.0.0.1:8848
+# Webhook CloudEvent sending mode. This property is the same as the 
eventMesh.storage.plugin.type configuration.
+eventMesh.webHook.producer.storage=standalone
diff --git 
a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/meta/NacosConfigCheckTest.java
 
b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/meta/NacosConfigCheckTest.java
index 8df1efc..7915bd0 100644
--- 
a/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/meta/NacosConfigCheckTest.java
+++ 
b/eventmesh-dashboard-console/src/test/java/org/apache/eventmesh/dashboard/console/function/health/check/impl/meta/NacosConfigCheckTest.java
@@ -28,8 +28,6 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Timeout;
 
-import com.alibaba.nacos.api.exception.NacosException;
-
 import lombok.extern.slf4j.Slf4j;
 
 @Slf4j
@@ -70,7 +68,7 @@ class NacosConfigCheckTest {
                 @Override
                 public void onFail(Exception e) {
                     latch.countDown();
-                    log.error("{}, failed for reason {}", 
this.getClass().getSimpleName(), e);
+                    log.error("{}, failed", this.getClass().getSimpleName(), 
e);
                 }
             });
             latch.await(2, TimeUnit.SECONDS);
diff --git 
a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateNacosConfig.java
 
b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateNacosConfig.java
index 71a1c61..7d7effa 100644
--- 
a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateNacosConfig.java
+++ 
b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/config/CreateNacosConfig.java
@@ -28,7 +28,17 @@ import lombok.NoArgsConstructor;
 @NoArgsConstructor
 public class CreateNacosConfig implements CreateSDKConfig {
 
-    private String serverAddress;
+    private String serverAddress = "127.0.0.1:8848";
+
+    private String namespace = "";
+
+    private String username = "nacos";
+
+    private String password = "nacos";
+
+    private String accessKey = "";
+
+    private String secretKey = "";
 
     @Override
     public String getUniqueKey() {
diff --git 
a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosConfigSDKOperation.java
 
b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosConfigSDKOperation.java
index 982a6ee..b7a6769 100644
--- 
a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosConfigSDKOperation.java
+++ 
b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosConfigSDKOperation.java
@@ -41,6 +41,11 @@ public class NacosConfigSDKOperation extends 
AbstractSDKOperation<ConfigService>
         try {
             Properties properties = new Properties();
             properties.put(PropertyKeyConst.SERVER_ADDR, 
config.getServerAddress());
+            properties.put(PropertyKeyConst.NAMESPACE, config.getNamespace());
+            properties.put(PropertyKeyConst.USERNAME, config.getUsername());
+            properties.put(PropertyKeyConst.PASSWORD, config.getPassword());
+            properties.put(PropertyKeyConst.ACCESS_KEY, config.getAccessKey());
+            properties.put(PropertyKeyConst.SECRET_KEY, config.getSecretKey());
             configService = NacosFactory.createConfigService(properties);
         } catch (NacosException e) {
             log.error("NacosCheck init failed caused by {}", e.getErrMsg());
diff --git 
a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosNamingSDKOperation.java
 
b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosNamingSDKOperation.java
index 28431f9..ca2d722 100644
--- 
a/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosNamingSDKOperation.java
+++ 
b/eventmesh-dashboard-core/src/main/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosNamingSDKOperation.java
@@ -42,6 +42,11 @@ public class NacosNamingSDKOperation extends 
AbstractSDKOperation<NamingService>
         try {
             Properties properties = new Properties();
             properties.put(PropertyKeyConst.SERVER_ADDR, 
config.getServerAddress());
+            properties.put(PropertyKeyConst.NAMESPACE, config.getNamespace());
+            properties.put(PropertyKeyConst.USERNAME, config.getUsername());
+            properties.put(PropertyKeyConst.PASSWORD, config.getPassword());
+            properties.put(PropertyKeyConst.ACCESS_KEY, config.getAccessKey());
+            properties.put(PropertyKeyConst.SECRET_KEY, config.getSecretKey());
             namingService = NacosFactory.createNamingService(properties);
         } catch (NacosException e) {
             log.error("NacosCheck init failed caused by {}", e.getErrMsg());
diff --git 
a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosNamingSDKOperationTest.java
 
b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosNamingSDKOperationTest.java
index 300de4e..54ae2a9 100644
--- 
a/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosNamingSDKOperationTest.java
+++ 
b/eventmesh-dashboard-core/src/test/java/org/apache/eventmesh/dashboard/core/function/SDK/operation/NacosNamingSDKOperationTest.java
@@ -38,15 +38,17 @@ class NacosNamingSDKOperationTest {
     @Test
     public void testCreateNamingService() throws NacosException, 
InterruptedException {
         try {
-        CreateNacosConfig createClientConfig = new CreateNacosConfig();
-        createClientConfig.setServerAddress("127.0.0.1:8848");
-        NamingService namingService = (NamingService) 
SDKManager.getInstance().createClient(SDKTypeEnum.META_NACOS_NAMING, 
createClientConfig)
-            .getValue();
-        namingService.registerInstance("eventmesh-dashboard-sdk-nacos-test", 
"11.11.11.11", 8888, "eventmesh-dashboard-sdk-nacos-test-cluster-name");
-
-        namingService.deregisterInstance("eventmesh-dashboard-sdk-nacos-test", 
"11.11.11.11", 8888,
-            "eventmesh-dashboard-sdk-nacos-test-cluster-name");}
-        catch (Exception e){
+            CreateNacosConfig createClientConfig = new CreateNacosConfig();
+            createClientConfig.setServerAddress("127.0.0.1:8848");
+            createClientConfig.setUsername("nacos");
+            createClientConfig.setPassword("nacos");
+            NamingService namingService = (NamingService) 
SDKManager.getInstance().createClient(SDKTypeEnum.META_NACOS_NAMING, 
createClientConfig)
+                .getValue();
+            
namingService.registerInstance("eventmesh-dashboard-sdk-nacos-test", 
"192.168.11.11", 8888,
+                "eventmesh-dashboard-sdk-nacos-test-cluster-name");
+            
namingService.deregisterInstance("eventmesh-dashboard-sdk-nacos-test", 
"192.168.11.11", 8888,
+                "eventmesh-dashboard-sdk-nacos-test-cluster-name");
+        } catch (Exception e) {
             log.error("create nacos naming service failed", e);
         }
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to