commit d7801420b490dc44f14e492777f920992453e794 Author: 张腾 <3467447354@qq.com> Date: Fri Jul 26 02:04:19 2024 +0800 csh diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..ea653d4 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..c48ef6b --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..9e1cc11 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,18 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..c6b9e03 --- /dev/null +++ b/pom.xml @@ -0,0 +1,75 @@ + + + com.muyu + cloud-visual + 3.6.3 + + 4.0.0 + + cloud-visual-monitor + + + cloud-visual-monitor监控中心 + + + + + + + de.codecentric + spring-boot-admin-starter-server + ${spring-boot-admin.version} + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-sentinel + + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.springframework.boot + spring-boot-starter-security + + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + diff --git a/src/main/java/com/muyu/modules/monitor/CloudMonitorApplication.java b/src/main/java/com/muyu/modules/monitor/CloudMonitorApplication.java new file mode 100644 index 0000000..e230689 --- /dev/null +++ b/src/main/java/com/muyu/modules/monitor/CloudMonitorApplication.java @@ -0,0 +1,18 @@ +package com.muyu.modules.monitor; + +import de.codecentric.boot.admin.server.config.EnableAdminServer; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * 监控中心 + * + * @author muyu + */ +@EnableAdminServer +@SpringBootApplication +public class CloudMonitorApplication { + public static void main (String[] args) { + SpringApplication.run(CloudMonitorApplication.class, args); + } +} diff --git a/src/main/java/com/muyu/modules/monitor/config/WebSecurityConfigurer.java b/src/main/java/com/muyu/modules/monitor/config/WebSecurityConfigurer.java new file mode 100644 index 0000000..d1bc9f4 --- /dev/null +++ b/src/main/java/com/muyu/modules/monitor/config/WebSecurityConfigurer.java @@ -0,0 +1,37 @@ +package com.muyu.modules.monitor.config; + +import de.codecentric.boot.admin.server.config.AdminServerProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.web.SecurityFilterChain; +import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; + +/** + * 监控权限配置 + * + * @author muyu + */ +@EnableWebSecurity +public class WebSecurityConfigurer { + private final String adminContextPath; + + public WebSecurityConfigurer (AdminServerProperties adminServerProperties) { + this.adminContextPath = adminServerProperties.getContextPath(); + } + + @Bean + public SecurityFilterChain filterChain (HttpSecurity httpSecurity) throws Exception { + SavedRequestAwareAuthenticationSuccessHandler successHandler = new SavedRequestAwareAuthenticationSuccessHandler(); + successHandler.setTargetUrlParameter("redirectTo"); + successHandler.setDefaultTargetUrl(adminContextPath + "/"); + + return httpSecurity + .authorizeHttpRequests((authorize) -> authorize .anyRequest().authenticated()) + .securityMatcher(adminContextPath + "/assets/**" + , adminContextPath + "/login" + , adminContextPath + "/actuator/**" + , adminContextPath + "/instances/**" + ).build(); + } +} diff --git a/src/main/resources/banner.txt b/src/main/resources/banner.txt new file mode 100644 index 0000000..0dd5eee --- /dev/null +++ b/src/main/resources/banner.txt @@ -0,0 +1,2 @@ +Spring Boot Version: ${spring-boot.version} +Spring Application Name: ${spring.application.name} diff --git a/src/main/resources/bootstrap.yml b/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..1a2d14f --- /dev/null +++ b/src/main/resources/bootstrap.yml @@ -0,0 +1,47 @@ +# Tomcat +server: + port: 9100 + +# nacos线上地址 +nacos: + addr: 106.15.36.123:8848 + user-name: nacos + password: nacos + namespace: 3cc549bc-5e87-4246-a701-7a1edd9b5433 + +# Spring +spring: + application: + # 应用名称 + name: cloud-monitor + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: ${nacos.addr} + # nacos用户名 + username: ${nacos.user-name} + # nacos密码 + password: ${nacos.password} + # 命名空间 + namespace: ${nacos.namespace} + config: + # 服务注册地址 + server-addr: ${nacos.addr} + # nacos用户名 + username: ${nacos.user-name} + # nacos密码 + password: ${nacos.password} + # 命名空间 + namespace: ${nacos.namespace} + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + # 系统共享配置 + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + # 系统环境Config共享配置 + - application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} diff --git a/src/main/resources/logback/dev.xml b/src/main/resources/logback/dev.xml new file mode 100644 index 0000000..44e127d --- /dev/null +++ b/src/main/resources/logback/dev.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/info.log + + + + ${log.path}/info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/error.log + + + + ${log.path}/error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/logback/prod.xml b/src/main/resources/logback/prod.xml new file mode 100644 index 0000000..44e127d --- /dev/null +++ b/src/main/resources/logback/prod.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/info.log + + + + ${log.path}/info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/error.log + + + + ${log.path}/error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/logback/test.xml b/src/main/resources/logback/test.xml new file mode 100644 index 0000000..44e127d --- /dev/null +++ b/src/main/resources/logback/test.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/info.log + + + + ${log.path}/info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/error.log + + + + ${log.path}/error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + + + + + + + + + + + + + diff --git a/target/classes/banner.txt b/target/classes/banner.txt new file mode 100644 index 0000000..0dd5eee --- /dev/null +++ b/target/classes/banner.txt @@ -0,0 +1,2 @@ +Spring Boot Version: ${spring-boot.version} +Spring Application Name: ${spring.application.name} diff --git a/target/classes/bootstrap.yml b/target/classes/bootstrap.yml new file mode 100644 index 0000000..1a2d14f --- /dev/null +++ b/target/classes/bootstrap.yml @@ -0,0 +1,47 @@ +# Tomcat +server: + port: 9100 + +# nacos线上地址 +nacos: + addr: 106.15.36.123:8848 + user-name: nacos + password: nacos + namespace: 3cc549bc-5e87-4246-a701-7a1edd9b5433 + +# Spring +spring: + application: + # 应用名称 + name: cloud-monitor + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: ${nacos.addr} + # nacos用户名 + username: ${nacos.user-name} + # nacos密码 + password: ${nacos.password} + # 命名空间 + namespace: ${nacos.namespace} + config: + # 服务注册地址 + server-addr: ${nacos.addr} + # nacos用户名 + username: ${nacos.user-name} + # nacos密码 + password: ${nacos.password} + # 命名空间 + namespace: ${nacos.namespace} + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + # 系统共享配置 + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + # 系统环境Config共享配置 + - application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} diff --git a/target/classes/com/muyu/modules/monitor/CloudMonitorApplication.class b/target/classes/com/muyu/modules/monitor/CloudMonitorApplication.class new file mode 100644 index 0000000..dfd3c95 Binary files /dev/null and b/target/classes/com/muyu/modules/monitor/CloudMonitorApplication.class differ diff --git a/target/classes/com/muyu/modules/monitor/config/WebSecurityConfigurer.class b/target/classes/com/muyu/modules/monitor/config/WebSecurityConfigurer.class new file mode 100644 index 0000000..93ea09c Binary files /dev/null and b/target/classes/com/muyu/modules/monitor/config/WebSecurityConfigurer.class differ diff --git a/target/classes/logback/dev.xml b/target/classes/logback/dev.xml new file mode 100644 index 0000000..44e127d --- /dev/null +++ b/target/classes/logback/dev.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/info.log + + + + ${log.path}/info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/error.log + + + + ${log.path}/error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + + + + + + + + + + + + + diff --git a/target/classes/logback/prod.xml b/target/classes/logback/prod.xml new file mode 100644 index 0000000..44e127d --- /dev/null +++ b/target/classes/logback/prod.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/info.log + + + + ${log.path}/info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/error.log + + + + ${log.path}/error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + + + + + + + + + + + + + diff --git a/target/classes/logback/test.xml b/target/classes/logback/test.xml new file mode 100644 index 0000000..44e127d --- /dev/null +++ b/target/classes/logback/test.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/info.log + + + + ${log.path}/info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/error.log + + + + ${log.path}/error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + + + + + + + + + + + + + diff --git a/target/cloud-visual-monitor.jar b/target/cloud-visual-monitor.jar new file mode 100644 index 0000000..80743e6 Binary files /dev/null and b/target/cloud-visual-monitor.jar differ diff --git a/target/cloud-visual-monitor.jar.original b/target/cloud-visual-monitor.jar.original new file mode 100644 index 0000000..92022f9 Binary files /dev/null and b/target/cloud-visual-monitor.jar.original differ diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties new file mode 100644 index 0000000..0961dd7 --- /dev/null +++ b/target/maven-archiver/pom.properties @@ -0,0 +1,3 @@ +artifactId=cloud-visual-monitor +groupId=com.muyu +version=3.6.3 diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..b45e5b1 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,2 @@ +com\muyu\modules\monitor\config\WebSecurityConfigurer.class +com\muyu\modules\monitor\CloudMonitorApplication.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..79e2abe --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,2 @@ +D:\专高6\专高6\cloud-server\cloud-visual\cloud-visual-monitor\src\main\java\com\muyu\modules\monitor\CloudMonitorApplication.java +D:\专高6\专高6\cloud-server\cloud-visual\cloud-visual-monitor\src\main\java\com\muyu\modules\monitor\config\WebSecurityConfigurer.java