فهرست منبع

update 更新 ruoyi-sentinel-dashboard 模块对接nacos

疯狂的狮子li 4 سال پیش
والد
کامیت
b4c1eb3225

+ 21 - 0
config/dev/ruoyi-sentinel-dashboard.yml

@@ -0,0 +1,21 @@
+server:
+  servlet:
+    encoding:
+      force: true
+      charset: UTF-8
+      enabled: true
+    session:
+      cookie:
+        name: sentinel_dashboard_cookie
+
+logging:
+  level:
+    org.springframework.web: INFO
+
+auth:
+  enabled: true
+  filter:
+    exclude-urls: /,/auth/login,/auth/logout,/registry/machine,/version
+    exclude-url-suffixes: htm,html,js,css,map,ico,ttf,woff,png
+  username: sentinel
+  password: sentinel

+ 12 - 0
ruoyi-visual/ruoyi-sentinel-dashboard/pom.xml

@@ -20,6 +20,18 @@
 
     <dependencies>
 
+        <!-- SpringCloud Alibaba Nacos -->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+        </dependency>
+
+        <!-- SpringCloud Alibaba Nacos Config -->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
+        </dependency>
+
         <dependency>
             <groupId>com.alibaba.csp</groupId>
             <artifactId>sentinel-core</artifactId>

+ 0 - 24
ruoyi-visual/ruoyi-sentinel-dashboard/src/main/resources/application.properties

@@ -1,24 +0,0 @@
-server.port=8718
-spring.application.name=ruoyi-sentinel-dashboard
-
-#spring settings
-server.servlet.encoding.force=true
-server.servlet.encoding.charset=UTF-8
-server.servlet.encoding.enabled=true
-
-#cookie name setting
-server.servlet.session.cookie.name=sentinel_dashboard_cookie
-
-#logging settings
-logging.level.org.springframework.web=INFO
-
-#auth settings
-auth.filter.exclude-urls=/,/auth/login,/auth/logout,/registry/machine,/version
-auth.filter.exclude-url-suffixes=htm,html,js,css,map,ico,ttf,woff,png
-# If auth.enabled=false, Sentinel console disable login
-auth.username=sentinel
-auth.password=sentinel
-
-# Inject the dashboard version. It's required to enable
-# filtering in pom.xml for this resource file.
-sentinel.dashboard.version=@sentinel.version@

+ 42 - 0
ruoyi-visual/ruoyi-sentinel-dashboard/src/main/resources/bootstrap.yml

@@ -0,0 +1,42 @@
+# Tomcat
+server:
+  port: 8718
+
+# Spring
+spring:
+  main:
+    # 此配置禁止放入 nacos 优先级不够
+    allow-circular-references: true
+  application:
+    # 应用名称
+    name: ruoyi-sentinel-dashboard
+  profiles:
+    # 环境配置
+    active: @profiles.active@
+
+sentinel:
+  dashboard:
+    version: @sentinel.version@
+
+--- # nacos 配置
+spring:
+  cloud:
+    nacos:
+      # nacos 服务地址
+      server-addr: @nacos.server@
+      discovery:
+        # 注册组
+        group: @nacos.discovery.group@
+        namespace: ${spring.profiles.active}
+      config:
+        # 配置组
+        group: @nacos.config.group@
+        namespace: ${spring.profiles.active}
+        # 配置文件格式
+        file-extension: yml
+        # 共享配置
+        shared-configs:
+          - data-id: application.${spring.cloud.nacos.config.file-extension}
+            refresh: true
+          - data-id: datasource.${spring.cloud.nacos.config.file-extension}
+            refresh: true

+ 3 - 1
sql/ry-config.sql

@@ -44,6 +44,7 @@ insert into config_info(id, data_id, group_id, content, md5, gmt_create, gmt_mod
 (10, 'sentinel-ruoyi-gateway.json', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:21:02', '2022-01-09 15:21:02', NULL, '0:0:0:0:0:0:0:1', '', 'dev', '限流策略', NULL, NULL, 'json', NULL),
 (11, 'ruoyi-xxl-job-admin.yml', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:21:02', '2022-01-09 15:21:02', NULL, '0:0:0:0:0:0:0:1', '', 'dev', '定时任务控制台', NULL, NULL, 'yaml', NULL),
 (12, 'seata-server.properties', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:21:02', '2022-01-09 15:21:02', NULL, '0:0:0:0:0:0:0:1', '', 'dev', 'seata配置文件', NULL, NULL, 'properties', NULL),
+(13, 'ruoyi-sentinel-dashboard.yml', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:21:02', '2022-01-09 15:21:02', NULL, '0:0:0:0:0:0:0:1', '', 'dev', 'sentinel控制台配置文件', NULL, NULL, 'yaml', NULL),
 
 (101, 'application.yml', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:23:00', '2022-01-09 15:23:00', NULL, '0:0:0:0:0:0:0:1', '', 'prod', '通用配置基础配置', NULL, NULL, 'yaml', NULL),
 (102, 'datasource.yml', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:23:00', '2022-01-09 15:23:00', NULL, '0:0:0:0:0:0:0:1', '', 'prod', '数据源配置', NULL, NULL, 'yaml', NULL),
@@ -56,7 +57,8 @@ insert into config_info(id, data_id, group_id, content, md5, gmt_create, gmt_mod
 (109, 'ruoyi-resource.yml', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:23:00', '2022-01-09 15:23:00', NULL, '0:0:0:0:0:0:0:1', '', 'prod', '文件服务', NULL, NULL, 'yaml', NULL),
 (110, 'sentinel-ruoyi-gateway.json', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:23:00', '2022-01-09 15:23:00', NULL, '0:0:0:0:0:0:0:1', '', 'prod', '限流策略', NULL, NULL, 'json', NULL),
 (111, 'ruoyi-xxl-job-admin.yml', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:21:02', '2022-01-09 15:21:02', NULL, '0:0:0:0:0:0:0:1', '', 'prod', '定时任务控制台', NULL, NULL, 'yaml', NULL),
-(112, 'seata-server.properties', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:21:02', '2022-01-09 15:21:02', NULL, '0:0:0:0:0:0:0:1', '', 'prod', 'seata配置文件', NULL, NULL, 'properties', NULL);
+(112, 'seata-server.properties', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:21:02', '2022-01-09 15:21:02', NULL, '0:0:0:0:0:0:0:1', '', 'prod', 'seata配置文件', NULL, NULL, 'properties', NULL),
+(113, 'ruoyi-sentinel-dashboard.yml', 'DEFAULT_GROUP', '# 将项目路径:config/下对应文件中内容复制到此处', '2944a25cb97926efcaa43b3ad7a64cf0', '2022-01-09 15:21:02', '2022-01-09 15:21:02', NULL, '0:0:0:0:0:0:0:1', '', 'dev', 'sentinel控制台配置文件', NULL, NULL, 'yaml', NULL);
 
 /******************************************/
 /*   表名称 = config_info_aggr   */