From 4b39c6d766d6969d09da8d7b48e5a603fb7865a6 Mon Sep 17 00:00:00 2001 From: Pil0tXia Date: Thu, 4 Jan 2024 23:56:34 +0800 Subject: [PATCH] Set up DB --- build.gradle | 14 +++- .../EventMeshDashboardApplication.java | 2 + src/main/resources/application-dev.yml | 75 +++++++++++++++++++ src/main/resources/application.yml | 42 +++-------- src/main/resources/logback.xml | 2 +- 5 files changed, 97 insertions(+), 38 deletions(-) create mode 100644 src/main/resources/application-dev.yml diff --git a/build.gradle b/build.gradle index 5b676ab6..2db74388 100644 --- a/build.gradle +++ b/build.gradle @@ -43,7 +43,6 @@ repositories { ext { // utility commonsLang3Version = '3.13.0' - guavaVersion = '32.1.2-jre' // not used for now fastjsonVersion = '2.0.40' // swagger springdocVersion = '1.7.0' @@ -64,13 +63,20 @@ dependencies { // utility implementation "org.apache.commons:commons-lang3:${commonsLang3Version}" - implementation("com.alibaba.fastjson2:fastjson2:${fastjsonVersion}") + implementation "com.alibaba.fastjson2:fastjson2:${fastjsonVersion}" // swagger implementation "org.springdoc:springdoc-openapi-ui:${springdocVersion}" implementation "org.springdoc:springdoc-openapi-javadoc:${springdocVersion}" annotationProcessor 'com.github.therapi:therapi-runtime-javadoc-scribe:0.15.0' // unit test - testImplementation("org.mockito:mockito-core:${mockitoVersion}") + testImplementation "org.mockito:mockito-core:${mockitoVersion}" // meta - implementation("com.alibaba.nacos:nacos-client:${nacosVersion}") + implementation "com.alibaba.nacos:nacos-client:${nacosVersion}" + // Event Store + implementation 'org.apache.rocketmq:rocketmq-client:4.9.7' + + // Database + implementation 'com.alibaba:druid-spring-boot-starter:1.2.21' + implementation 'com.baomidou:mybatis-plus-boot-starter:3.5.5' + runtimeOnly 'com.mysql:mysql-connector-j' } diff --git a/src/main/java/org/apache/eventmesh/dashboard/EventMeshDashboardApplication.java b/src/main/java/org/apache/eventmesh/dashboard/EventMeshDashboardApplication.java index 60d61254..dea37fd4 100644 --- a/src/main/java/org/apache/eventmesh/dashboard/EventMeshDashboardApplication.java +++ b/src/main/java/org/apache/eventmesh/dashboard/EventMeshDashboardApplication.java @@ -19,7 +19,9 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.servlet.ServletComponentScan; +@ServletComponentScan // Druid Monitor @SpringBootApplication public class EventMeshDashboardApplication { diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml new file mode 100644 index 00000000..87d20de2 --- /dev/null +++ b/src/main/resources/application-dev.yml @@ -0,0 +1,75 @@ +# +# 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. +# +spring: + datasource: + type: com.alibaba.druid.pool.DruidDataSource + druid: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://localhost:3306/eventmesh-dashboard?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + username: root + password: + + initial-size: 1 + max-active: 50 + min-idle: 5 + max-wait: 6000 + validation-query: select 'x' + validation-query-timeout: 15 + test-on-borrow: false + test-while-idle: true + min-evictable-idle-time-millis: 300000 + + stat-view-servlet: + enabled: true + url-pattern: /druid/* + filter: + wall: + config: + multi-statement-allow: true # corresponding to allowMultiQueries=true + +eventmesh: + meta: + # registry type: nacos, etcd + type: nacos + nacos: + addr: 127.0.0.1:8848 + namespace: # namespace id, empty by default + authEnabled: false + protocol: http # http or https + username: + password: + # Alibaba Cloud MSE Nacos auth, not nacos.token.secret.key + accessKey: + secretKey: + etcd: + addr: # TODO + # timeout for admin client + timeoutMs: 5000 + store: + # Event Store type, should be consistent with the EventMesh Runtime configuration. + type: rocketmq + standalone: + # TODO + rocketmq: + namesrvAddr: 127.0.0.1:9876;127.0.0.1:9876 + clusterName: DefaultCluster + accessKey: '********' + secretKey: '********' + kafka: + namesrvAddr: localhost:9092;localhost:9092 + partitions: 1 + replicationFactors: 1 \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 518a124a..434cf55a 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -14,10 +14,11 @@ # See the License for the specific language governing permissions and # limitations under the License. # - spring: application: name: eventmesh-dashboard + profiles: + active: dev server: port: 8080 @@ -30,35 +31,10 @@ server: logging: config: classpath:logback.xml -eventmesh: - meta: - # registry type: nacos, etcd - type: nacos - nacos: - addr: 127.0.0.1:8848 - namespace: # namespace id, empty by default - authEnabled: false - protocol: http # http or https - username: - password: - # Alibaba Cloud MSE Nacos auth, not nacos.token.secret.key - accessKey: - secretKey: - etcd: - addr: # TODO - # timeout for admin client - timeoutMs: 5000 - store: - # Event Store type, should be consistent with the EventMesh Runtime configuration. - type: rocketmq - standalone: - # TODO - rocketmq: - namesrvAddr: 127.0.0.1:9876;127.0.0.1:9876 - clusterName: DefaultCluster - accessKey: '********' - secretKey: '********' - kafka: - namesrvAddr: localhost:9092;localhost:9092 - partitions: 1 - replicationFactors: 1 \ No newline at end of file +mybatis-plus: + mapper-locations: classpath*:mappers/**/*.xml # Default value + typeAliasesPackage: org.apache.eventmesh.dashboard.entity + configuration: + call-setters-on-nulls: true # Display fields with null values in query results + map-underscore-to-camel-case: true # Convert database underscore naming convention to camel case (default is true) +# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # Output SQL execution logs to console (for debugging) \ No newline at end of file diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml index dbed6dce..447ace7c 100644 --- a/src/main/resources/logback.xml +++ b/src/main/resources/logback.xml @@ -42,7 +42,7 @@ - +