[重大更新] 由于nacos底层结构大变更 无法在内部维护nacos与seata源码服务 使用者需自行下载搭建
This commit is contained in:
@@ -10,8 +10,6 @@
|
||||
|
||||
<modules>
|
||||
<module>ruoyi-monitor</module>
|
||||
<module>ruoyi-seata-server</module>
|
||||
<module>ruoyi-nacos</module>
|
||||
<module>ruoyi-snailjob-server</module>
|
||||
</modules>
|
||||
|
||||
|
||||
@@ -21,12 +21,12 @@ spring:
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
# 注册组
|
||||
group: @nacos.discovery.group@
|
||||
namespace: ${spring.profiles.active}
|
||||
group: DEFAULT_GROUP
|
||||
namespace: public
|
||||
config:
|
||||
# 配置组
|
||||
group: @nacos.config.group@
|
||||
namespace: ${spring.profiles.active}
|
||||
group: DEFAULT_GROUP
|
||||
namespace: public
|
||||
config:
|
||||
import:
|
||||
- optional:nacos:application-common.yml
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
||||
FROM bellsoft/liberica-openjdk-rocky:17.0.16-cds
|
||||
#FROM bellsoft/liberica-openjdk-rocky:21.0.8-cds
|
||||
#FROM findepi/graalvm:java17-native
|
||||
|
||||
LABEL maintainer="Lion Li"
|
||||
|
||||
RUN mkdir -p /ruoyi/nacos
|
||||
|
||||
WORKDIR /ruoyi/nacos
|
||||
|
||||
EXPOSE 8848
|
||||
|
||||
ENV TZ=Asia/Shanghai LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS="-Xms512m -Xmx1024m"
|
||||
|
||||
ADD ./target/ruoyi-nacos.jar ./app.jar
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom ${JAVA_OPTS} -jar app.jar
|
||||
|
||||
@@ -1,365 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
~
|
||||
~ Licensed 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.
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-visual</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<artifactId>ruoyi-nacos</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<nacos.version>2.5.1</nacos.version>
|
||||
<SnakeYaml.version>2.0</SnakeYaml.version>
|
||||
<!-- 需要与 Nacos 内置 Boot 版本保持一致 -->
|
||||
<spring-boot.version>2.7.18</spring-boot.version>
|
||||
<spring-boot-admin.version>2.7.11</spring-boot-admin.version>
|
||||
<nacos.lib.path>${project.basedir}/src/main/resources/lib</nacos.lib.path>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- SpringBoot 依赖配置 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-all</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-console</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${nacos.lib.path}/nacos-console-${nacos.version}.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-auth</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${nacos.lib.path}/nacos-auth-${nacos.version}.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-cmdb</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${nacos.lib.path}/nacos-cmdb-${nacos.version}.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-config</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${nacos.lib.path}/nacos-config-${nacos.version}.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-persistence</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${nacos.lib.path}/nacos-persistence-${nacos.version}.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-consistency</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${nacos.lib.path}/nacos-consistency-${nacos.version}.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-control-plugin</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${nacos.lib.path}/nacos-control-plugin-${nacos.version}.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-config-plugin</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${nacos.lib.path}/nacos-config-plugin-${nacos.version}.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-core</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${nacos.lib.path}/nacos-core-${nacos.version}.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-istio</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${nacos.lib.path}/nacos-istio-${nacos.version}.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-naming</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${nacos.lib.path}/nacos-naming-${nacos.version}.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>default-auth-plugin</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${nacos.lib.path}/default-auth-plugin-${nacos.version}.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>default-control-plugin</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${nacos.lib.path}/default-control-plugin-${nacos.version}.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-prometheus</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${nacos.lib.path}/nacos-prometheus-${nacos.version}.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-sys</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${nacos.lib.path}/nacos-sys-${nacos.version}.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-default-plugin-all</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${nacos.lib.path}/nacos-default-plugin-all-${nacos.version}.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-custom-environment-plugin</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-datasource-plugin</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-encryption-plugin</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-trace-plugin</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-common</artifactId>
|
||||
<version>${nacos.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.nacos</groupId>
|
||||
<artifactId>nacos-client</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- SpringBoot Web容器 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>log4j-to-slf4j</artifactId>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- 覆盖 tomcat version 避免CVE-2024-24549-->
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-websocket</artifactId>
|
||||
<version>9.0.105</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-core</artifactId>
|
||||
<version>9.0.105</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-el</artifactId>
|
||||
<version>9.0.105</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ldap</groupId>
|
||||
<artifactId>spring-ldap-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.caucho</groupId>
|
||||
<artifactId>hessian</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alipay.sofa</groupId>
|
||||
<artifactId>jraft-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alipay.sofa</groupId>
|
||||
<artifactId>rpc-grpc-impl</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-impl</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-jackson</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-prometheus</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-influx</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-elastic</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.envoyproxy.controlplane</groupId>
|
||||
<artifactId>api</artifactId>
|
||||
<version>0.1.27</version>
|
||||
</dependency>
|
||||
|
||||
<!-- log -->
|
||||
<!-- apache commons logging通过slf4j来代理 -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
</dependency>
|
||||
<!-- java.util.logging 通过slf4j来代理 -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jul-to-slf4j</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
<version>${SnakeYaml.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-client</artifactId>
|
||||
<version>${spring-boot-admin.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<!-- 作用:项目打成jar的同时将本地jar包也引入进去 -->
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
package com.alibaba.nacos;
|
||||
|
||||
import com.alibaba.nacos.sys.filter.NacosTypeExcludeFilter;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurationExcludeFilter;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.TypeExcludeFilter;
|
||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.ComponentScan.Filter;
|
||||
import org.springframework.context.annotation.FilterType;
|
||||
|
||||
/**
|
||||
* Nacos starter.
|
||||
* <p>
|
||||
* Use @SpringBootApplication and @ComponentScan at the same time, using CUSTOM type filter to control module enabled.
|
||||
* </p>
|
||||
*
|
||||
* @author nacos
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@ComponentScan(basePackages = "com.alibaba.nacos", excludeFilters = {
|
||||
@Filter(type = FilterType.CUSTOM, classes = {NacosTypeExcludeFilter.class}),
|
||||
@Filter(type = FilterType.CUSTOM, classes = {TypeExcludeFilter.class}),
|
||||
@Filter(type = FilterType.CUSTOM, classes = {AutoConfigurationExcludeFilter.class})})
|
||||
@ServletComponentScan
|
||||
public class Nacos {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// true 单机模式 false 为集群模式 集群模式需搭配 cluster.conf 使用 使用方法请查看文档
|
||||
System.setProperty("nacos.standalone", "true");
|
||||
System.setProperty("server.tomcat.accesslog.enabled", "false");
|
||||
// 本地集群搭建使用 分别在所有 nacos 目录下创建 conf/cluster.conf 文件用于编写集群ip端口
|
||||
// 注意 如果本地启动多个 nacos 此目录不能相同 例如 nacos1 nacos2 nacos3 对应三个nacos服务
|
||||
// System.setProperty("nacos.home", "D:/nacos");
|
||||
SpringApplication.run(Nacos.class, args);
|
||||
}
|
||||
}
|
||||
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
package com.alibaba.nacos.config;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
|
||||
public class ActuatorAuthFilter implements Filter {
|
||||
|
||||
private final String username;
|
||||
private final String password;
|
||||
|
||||
public ActuatorAuthFilter(String username, String password) {
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
|
||||
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
||||
|
||||
// 获取 Authorization 头
|
||||
String authHeader = request.getHeader("Authorization");
|
||||
|
||||
if (authHeader == null || !authHeader.startsWith("Basic ")) {
|
||||
// 如果没有提供 Authorization 或者格式不对,则返回 401
|
||||
response.setHeader("WWW-Authenticate", "Basic realm=\"realm\"");
|
||||
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized");
|
||||
return;
|
||||
}
|
||||
|
||||
// 解码 Base64 编码的用户名和密码
|
||||
String base64Credentials = authHeader.substring("Basic ".length());
|
||||
byte[] credDecoded = Base64.getDecoder().decode(base64Credentials);
|
||||
String credentials = new String(credDecoded, StandardCharsets.UTF_8);
|
||||
String[] split = credentials.split(":");
|
||||
if (split.length != 2) {
|
||||
response.setHeader("WWW-Authenticate", "Basic realm=\"realm\"");
|
||||
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized");
|
||||
return;
|
||||
}
|
||||
// 验证用户名和密码
|
||||
if (!username.equals(split[0]) || !password.equals(split[1])) {
|
||||
response.setHeader("WWW-Authenticate", "Basic realm=\"realm\"");
|
||||
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Unauthorized");
|
||||
return;
|
||||
}
|
||||
// 如果认证成功,继续处理请求
|
||||
filterChain.doFilter(request, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.alibaba.nacos.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 权限安全配置
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Configuration
|
||||
public class SecurityConfig {
|
||||
|
||||
@Value("${spring.boot.admin.client.username}")
|
||||
private String username;
|
||||
@Value("${spring.boot.admin.client.password}")
|
||||
private String password;
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean<ActuatorAuthFilter> actuatorFilterRegistrationBean() {
|
||||
FilterRegistrationBean<ActuatorAuthFilter> registrationBean = new FilterRegistrationBean<>();
|
||||
registrationBean.setFilter(new ActuatorAuthFilter(username, password));
|
||||
registrationBean.addUrlPatterns("/actuator", "/actuator/*");
|
||||
return registrationBean;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,218 +0,0 @@
|
||||
#
|
||||
# Copyright 1999-2018 Alibaba Group Holding Ltd.
|
||||
#
|
||||
# Licensed 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 Boot Related Configurations ***************#
|
||||
|
||||
### Default web context path:
|
||||
server.servlet.contextPath=/nacos
|
||||
### Include message field
|
||||
server.error.include-message=ALWAYS
|
||||
### Default web server port:
|
||||
server.port=8848
|
||||
|
||||
#*************** Network Related Configurations ***************#
|
||||
### If prefer hostname over ip for Nacos server addresses in cluster.conf:
|
||||
# nacos.inetutils.prefer-hostname-over-ip=false
|
||||
|
||||
### Specify local server's IP:
|
||||
# nacos.inetutils.ip-address=
|
||||
|
||||
spring.application.name=ruoyi-nacos
|
||||
#*************** Config Module Related Configurations ***************#
|
||||
### Deprecated configuration property, it is recommended to use `spring.sql.init.platform` replaced.
|
||||
# spring.datasource.platform=mysql
|
||||
nacos.plugin.datasource.log.enabled=true
|
||||
spring.sql.init.platform=mysql
|
||||
### Count of DB:
|
||||
db.num=1
|
||||
|
||||
### Connect URL of DB:
|
||||
db.url.0=jdbc:mysql://127.0.0.1:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
|
||||
db.user.0=root
|
||||
db.password.0=root
|
||||
|
||||
### the maximum retry times for push
|
||||
nacos.config.push.maxRetryTime=50
|
||||
|
||||
#*************** Naming Module Related Configurations ***************#
|
||||
|
||||
### If enable data warmup. If set to false, the server would accept request without local data preparation:
|
||||
# nacos.naming.data.warmup=true
|
||||
|
||||
### If enable the instance auto expiration, kind like of health check of instance:
|
||||
# nacos.naming.expireInstance=true
|
||||
|
||||
nacos.naming.empty-service.auto-clean=true
|
||||
nacos.naming.empty-service.clean.initial-delay-ms=50000
|
||||
nacos.naming.empty-service.clean.period-time-ms=30000
|
||||
|
||||
|
||||
#*************** CMDB Module Related Configurations ***************#
|
||||
### The interval to dump external CMDB in seconds:
|
||||
# nacos.cmdb.dumpTaskInterval=3600
|
||||
|
||||
### The interval of polling data change event in seconds:
|
||||
# nacos.cmdb.eventTaskInterval=10
|
||||
|
||||
### The interval of loading labels in seconds:
|
||||
# nacos.cmdb.labelTaskInterval=300
|
||||
|
||||
### If turn on data loading task:
|
||||
# nacos.cmdb.loadDataAtStart=false
|
||||
|
||||
|
||||
#*************** Metrics Related Configurations ***************#
|
||||
# 指向 ruoyi-monitor 监控
|
||||
spring.boot.admin.client.url=http://127.0.0.1:9100
|
||||
spring.boot.admin.client.username=ruoyi
|
||||
spring.boot.admin.client.password=123456
|
||||
spring.boot.admin.client.instance.service-host-type=IP
|
||||
spring.boot.admin.client.instance.metadata.username=${spring.boot.admin.client.username}
|
||||
spring.boot.admin.client.instance.metadata.userpassword=${spring.boot.admin.client.password}
|
||||
|
||||
### Metrics for prometheus
|
||||
management.endpoints.web.exposure.include=*
|
||||
|
||||
### Metrics for elastic search
|
||||
management.metrics.export.elastic.enabled=false
|
||||
#management.metrics.export.elastic.host=http://localhost:9200
|
||||
|
||||
### Metrics for influx
|
||||
management.metrics.export.influx.enabled=false
|
||||
#management.metrics.export.influx.db=springboot
|
||||
#management.metrics.export.influx.uri=http://localhost:8086
|
||||
#management.metrics.export.influx.auto-create-db=true
|
||||
#management.metrics.export.influx.consistency=one
|
||||
#management.metrics.export.influx.compressed=true
|
||||
|
||||
#*************** Access Control Related Configurations ***************#
|
||||
### If enable spring security, this option is deprecated in 1.2.0:
|
||||
#spring.security.enabled=false
|
||||
|
||||
### The ignore urls of auth, is deprecated in 1.2.0:
|
||||
nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**
|
||||
|
||||
### The auth system to use, currently only 'nacos' and 'ldap' is supported:
|
||||
nacos.core.auth.system.type=nacos
|
||||
|
||||
### If turn on auth system:
|
||||
nacos.core.auth.enabled=true
|
||||
|
||||
### Turn on/off caching of auth information. By turning on this switch, the update of auth information would have a 15 seconds delay.
|
||||
nacos.core.auth.caching.enabled=true
|
||||
|
||||
### Since 1.4.1, Turn on/off white auth for user-agent: nacos-server, only for upgrade from old version.
|
||||
nacos.core.auth.enable.userAgentAuthWhite=false
|
||||
|
||||
### Since 1.4.1, worked when nacos.core.auth.enabled=true and nacos.core.auth.enable.userAgentAuthWhite=false.
|
||||
### The two properties is the white list for auth and used by identity the request from other server.
|
||||
### 此处为用户名密码 需要自行修改
|
||||
nacos.core.auth.server.identity.key=ruoyi-vue-plus-key
|
||||
nacos.core.auth.server.identity.value=ruoyi-vue-plus-value
|
||||
|
||||
### worked when nacos.core.auth.system.type=nacos
|
||||
### The token expiration in seconds:
|
||||
nacos.core.auth.plugin.nacos.token.cache.enable=false
|
||||
nacos.core.auth.plugin.nacos.token.expire.seconds=18000
|
||||
### The default token (Base64 string):
|
||||
#nacos.core.auth.plugin.nacos.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789
|
||||
### 此处为token密钥 需要自行修改
|
||||
nacos.core.auth.plugin.nacos.token.secret.key=rE7bYayhpvduYwCxuhckybEPDXyna6xwm5m7MZjtjrdXjVxAbXAMccXHyaJvB346
|
||||
|
||||
### worked when nacos.core.auth.system.type=ldap,{0} is Placeholder,replace login username
|
||||
#nacos.core.auth.ldap.url=ldap://localhost:389
|
||||
#nacos.core.auth.ldap.basedc=dc=example,dc=org
|
||||
#nacos.core.auth.ldap.userDn=cn=admin,${nacos.core.auth.ldap.basedc}
|
||||
#nacos.core.auth.ldap.password=admin
|
||||
#nacos.core.auth.ldap.userdn=cn={0},dc=example,dc=org
|
||||
#nacos.core.auth.ldap.filter.prefix=uid
|
||||
#nacos.core.auth.ldap.case.sensitive=true
|
||||
#nacos.core.auth.ldap.ignore.partial.result.exception=false
|
||||
|
||||
#*************** Control Plugin Related Configurations ***************#
|
||||
# plugin type
|
||||
#nacos.plugin.control.manager.type=nacos
|
||||
|
||||
# local control rule storage dir, default ${nacos.home}/data/connection and ${nacos.home}/data/tps
|
||||
#nacos.plugin.control.rule.local.basedir=${nacos.home}
|
||||
|
||||
# external control rule storage type, if exist
|
||||
#nacos.plugin.control.rule.external.storage=
|
||||
|
||||
#*************** Config Change Plugin Related Configurations ***************#
|
||||
# webhook
|
||||
#nacos.core.config.plugin.webhook.enabled=false
|
||||
# It is recommended to use EB https://help.aliyun.com/document_detail/413974.html
|
||||
#nacos.core.config.plugin.webhook.url=http://localhost:8080/webhook/send?token=***
|
||||
# The content push max capacity ,byte
|
||||
#nacos.core.config.plugin.webhook.contentMaxCapacity=102400
|
||||
|
||||
# whitelist
|
||||
#nacos.core.config.plugin.whitelist.enabled=false
|
||||
# The import file suffixs
|
||||
#nacos.core.config.plugin.whitelist.suffixs=xml,text,properties,yaml,html
|
||||
# fileformatcheck,which validate the import file of type and content
|
||||
#nacos.core.config.plugin.fileformatcheck.enabled=false
|
||||
#*************** Istio Related Configurations ***************#
|
||||
### If turn on the MCP server:
|
||||
nacos.istio.mcp.server.enabled=false
|
||||
|
||||
|
||||
|
||||
###*************** Add from 1.3.0 ***************###
|
||||
|
||||
|
||||
#*************** Core Related Configurations ***************#
|
||||
|
||||
### set the WorkerID manually
|
||||
# nacos.core.snowflake.worker-id=
|
||||
|
||||
### Member-MetaData
|
||||
# nacos.core.member.meta.site=
|
||||
# nacos.core.member.meta.adweight=
|
||||
# nacos.core.member.meta.weight=
|
||||
|
||||
### MemberLookup
|
||||
### Addressing pattern category, If set, the priority is highest
|
||||
# nacos.core.member.lookup.type=[file,address-server]
|
||||
## Set the cluster list with a configuration file or command-line argument
|
||||
# nacos.member.list=192.168.16.101:8847?raft_port=8807,192.168.16.101?raft_port=8808,192.168.16.101:8849?raft_port=8809
|
||||
## for AddressServerMemberLookup
|
||||
# Maximum number of retries to query the address server upon initialization
|
||||
# nacos.core.address-server.retry=5
|
||||
## Server domain name address of [address-server] mode
|
||||
# address.server.domain=jmenv.tbsite.net
|
||||
## Server port of [address-server] mode
|
||||
# address.server.port=8080
|
||||
## Request address of [address-server] mode
|
||||
# address.server.url=/nacos/serverlist
|
||||
|
||||
#*************** JRaft Related Configurations ***************#
|
||||
|
||||
### Sets the Raft cluster election timeout, default value is 5 second
|
||||
# nacos.core.protocol.raft.data.election_timeout_ms=5000
|
||||
### Sets the amount of time the Raft snapshot will execute periodically, default is 30 minute
|
||||
# nacos.core.protocol.raft.data.snapshot_interval_secs=30
|
||||
### raft internal worker threads
|
||||
# nacos.core.protocol.raft.data.core_thread_num=8
|
||||
### Number of threads required for raft business request processing
|
||||
# nacos.core.protocol.raft.data.cli_service_thread_num=4
|
||||
### raft linear read strategy. Safe linear reads are used by default, that is, the Leader tenure is confirmed by heartbeat
|
||||
# nacos.core.protocol.raft.data.read_index_type=ReadOnlySafe
|
||||
### rpc request timeout, default 5 seconds
|
||||
# nacos.core.protocol.raft.data.rpc_request_timeout_ms=5000
|
||||
### enable to support prometheus service discovery
|
||||
#nacos.prometheus.metrics.enabled=true
|
||||
@@ -1,15 +0,0 @@
|
||||
|
||||
,--.
|
||||
,--.'|
|
||||
,--,: : | Nacos ${application.version}
|
||||
,`--.'`| ' : ,---. Running in ${nacos.mode} mode, ${nacos.function.mode} function modules
|
||||
| : : | | ' ,'\ .--.--. Port: ${server.port}
|
||||
: | \ | : ,--.--. ,---. / / | / / ' Pid: ${pid}
|
||||
| : ' '; | / \ / \. ; ,. :| : /`./ Console: http://${nacos.local.ip}:${server.port}${server.servlet.contextPath}/index.html
|
||||
' ' ;. ;.--. .-. | / / '' | |: :| : ;_
|
||||
| | | \ | \__\/: . .. ' / ' | .; : \ \ `. https://nacos.io
|
||||
' : | ; .' ," .--.; |' ; :__| : | `----. \
|
||||
| | '`--' / / ,. |' | '.'|\ \ / / /`--' /
|
||||
' : | ; : .' \ : : `----' '--'. /
|
||||
; |.' | , .-./\ \ / `--'---'
|
||||
'---' `--`---' `----'
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,27 +0,0 @@
|
||||
# 贝尔实验室 Spring 官方推荐镜像 JDK下载地址 https://bell-sw.com/pages/downloads/
|
||||
FROM bellsoft/liberica-openjdk-rocky:17.0.16-cds
|
||||
#FROM bellsoft/liberica-openjdk-rocky:21.0.8-cds
|
||||
#FROM findepi/graalvm:java17-native
|
||||
|
||||
LABEL maintainer="Lion Li"
|
||||
|
||||
RUN mkdir -p /ruoyi/seata-server/logs \
|
||||
/ruoyi/skywalking/agent
|
||||
|
||||
WORKDIR /ruoyi/seata-server
|
||||
|
||||
ENV TZ=PRC LANG=C.UTF-8 LC_ALL=C.UTF-8 JAVA_OPTS="" SEATA_IP="" SEATA_PORT=""
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
EXPOSE 7091
|
||||
EXPOSE 8091
|
||||
|
||||
ADD ./target/ruoyi-seata-server.jar ./app.jar
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
ENTRYPOINT java -Djava.security.egd=file:/dev/./urandom \
|
||||
#-Dskywalking.agent.service_name=ruoyi-seata-server \
|
||||
#-Dskywalking.plugin.seata.server=true \
|
||||
#-javaagent:/ruoyi/skywalking/agent/skywalking-agent.jar \
|
||||
${JAVA_OPTS} -jar app.jar
|
||||
@@ -1,297 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Copyright 1999-2019 Seata.io Group.
|
||||
~
|
||||
~ Licensed 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.
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-visual</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>ruoyi-seata-server</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<seata.version>2.5.0</seata.version>
|
||||
<spring-boot-for-server.version>2.7.18</spring-boot-for-server.version>
|
||||
<spring-framework-for-server.version>5.3.39</spring-framework-for-server.version>
|
||||
<snakeyaml-for-server.version>2.0</snakeyaml-for-server.version>
|
||||
<logstash-logback-encoder.version>7.2</logstash-logback-encoder.version>
|
||||
<jedis.version>3.8.0</jedis.version>
|
||||
<jackson-mapper.version>1.9.13</jackson-mapper.version>
|
||||
<kafka-clients.version>3.6.1</kafka-clients.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- spring-framework-->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-framework-bom</artifactId>
|
||||
<version>${spring-framework-for-server.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- spring-boot -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring-boot-for-server.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.kafka</groupId>
|
||||
<artifactId>kafka-clients</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-websocket</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.tomcat.embed</groupId>
|
||||
<artifactId>tomcat-embed-el</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-framework-bom</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
<version>${snakeyaml-for-server.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-dependencies</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<!-- springboot -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.yaml</groupId>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-server</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/src/main/resources/lib/seata-server-${seata.version}.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-spring-autoconfigure-server</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-core</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-config-all</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>log4j</artifactId>
|
||||
<groupId>log4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-discovery-all</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-serializer-all</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-compressor-all</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.seata</groupId>
|
||||
<artifactId>seata-metrics-all</artifactId>
|
||||
<version>${seata.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.seata</groupId>-->
|
||||
<!-- <artifactId>seata-namingserver</artifactId>-->
|
||||
<!-- <version>${seata.version}</version>-->
|
||||
<!-- </dependency>-->
|
||||
|
||||
<!-- for database -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-dbcp2</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.27</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.dameng</groupId>
|
||||
<artifactId>DmJdbcDriver18</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.beust</groupId>
|
||||
<artifactId>jcommander</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- only for event bus -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- jedis -->
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>${jedis.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- logback -->
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-core</artifactId>
|
||||
</dependency>
|
||||
<!-- logback appenders -->
|
||||
<dependency>
|
||||
<groupId>net.logstash.logback</groupId>
|
||||
<artifactId>logstash-logback-encoder</artifactId>
|
||||
<version>${logstash-logback-encoder.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.danielwegener</groupId>
|
||||
<artifactId>logback-kafka-appender</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.kafka</groupId>
|
||||
<artifactId>kafka-clients</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.kafka</groupId>
|
||||
<artifactId>kafka-clients</artifactId>
|
||||
<version>${kafka-clients.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alipay.sofa</groupId>
|
||||
<artifactId>jraft-core</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.alipay.sofa</groupId>
|
||||
<artifactId>bolt</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alipay.sofa</groupId>
|
||||
<artifactId>bolt</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.janino</groupId>
|
||||
<artifactId>janino</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bucket4j</groupId>
|
||||
<artifactId>bucket4j_jdk8-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<!-- 作用:项目打成jar的同时将本地jar包也引入进去 -->
|
||||
<includeSystemScope>true</includeSystemScope>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
-301
@@ -1,301 +0,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.
|
||||
*/
|
||||
package org.apache.seata.core.store.db;
|
||||
|
||||
import org.apache.seata.common.exception.ShouldNeverHappenException;
|
||||
import org.apache.seata.common.exception.StoreException;
|
||||
import org.apache.seata.common.executor.Initialize;
|
||||
import org.apache.seata.common.util.ConfigTools;
|
||||
import org.apache.seata.common.util.StringUtils;
|
||||
import org.apache.seata.config.Configuration;
|
||||
import org.apache.seata.config.ConfigurationFactory;
|
||||
import org.apache.seata.common.ConfigurationKeys;
|
||||
import org.apache.seata.core.constants.DBType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.apache.seata.common.DefaultValues.DEFAULT_DB_MAX_CONN;
|
||||
import static org.apache.seata.common.DefaultValues.DEFAULT_DB_MIN_CONN;
|
||||
|
||||
/**
|
||||
* The abstract datasource provider
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractDataSourceProvider implements DataSourceProvider, Initialize {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractDataSourceProvider.class);
|
||||
|
||||
private DataSource dataSource;
|
||||
|
||||
/**
|
||||
* The constant CONFIG.
|
||||
*/
|
||||
protected static final Configuration CONFIG = ConfigurationFactory.getInstance();
|
||||
|
||||
private static final String MYSQL_DRIVER_CLASS_NAME = "com.mysql.jdbc.Driver";
|
||||
|
||||
private static final String MYSQL8_DRIVER_CLASS_NAME = "com.mysql.cj.jdbc.Driver";
|
||||
|
||||
private static final String MYSQL_DRIVER_FILE_PREFIX = "mysql-connector-j";
|
||||
|
||||
private static final Map<String, ClassLoader> DRIVER_LOADERS;
|
||||
|
||||
private static final long DEFAULT_DB_MAX_WAIT = 5000;
|
||||
|
||||
static {
|
||||
DRIVER_LOADERS = createMysqlDriverClassLoaders();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
this.dataSource = generate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSource provide() {
|
||||
return this.dataSource;
|
||||
}
|
||||
|
||||
public DataSource generate() {
|
||||
validate();
|
||||
return doGenerate();
|
||||
}
|
||||
|
||||
public void validate() {
|
||||
// valid driver class name
|
||||
String driverClassName = getDriverClassName();
|
||||
// ClassLoader loader = getDriverClassLoader();
|
||||
// if (null == loader) {
|
||||
// throw new StoreException("class loader set error, you should not use the Bootstrap classloader");
|
||||
// }
|
||||
try {
|
||||
// loader.loadClass(driverClassName);
|
||||
Class.forName(driverClassName);
|
||||
} catch (ClassNotFoundException exx) {
|
||||
String folderPath = System.getProperty("loader.path");
|
||||
if (folderPath == null) {
|
||||
folderPath = System.getProperty("java.class.path");
|
||||
}
|
||||
String driverClassPath = Stream.of(folderPath.split(File.pathSeparator))
|
||||
.map(File::new)
|
||||
.filter(File::exists)
|
||||
.map(file -> file.isFile() ? file.getParentFile() : file)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(File::isDirectory)
|
||||
// Only the MySQL driver needs to be placed in the jdbc folder.
|
||||
.map(file -> (MYSQL8_DRIVER_CLASS_NAME.equals(driverClassName)
|
||||
|| MYSQL_DRIVER_CLASS_NAME.equals(driverClassName))
|
||||
? new File(file, "jdbc")
|
||||
: file)
|
||||
.filter(File::exists)
|
||||
.filter(File::isDirectory)
|
||||
.distinct()
|
||||
.findAny()
|
||||
.map(File::getAbsolutePath)
|
||||
.orElseThrow(() -> new ShouldNeverHappenException("cannot find jdbc folder"));
|
||||
throw new StoreException(String.format(
|
||||
"The driver {%s} cannot be found in the path %s. Please ensure that the appropriate database driver dependencies are included in the classpath.",
|
||||
driverClassName, driverClassPath));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* generate the datasource
|
||||
* @return datasource
|
||||
*/
|
||||
public abstract DataSource doGenerate();
|
||||
|
||||
/**
|
||||
* Get db type db type.
|
||||
*
|
||||
* @return the db type
|
||||
*/
|
||||
protected DBType getDBType() {
|
||||
return DBType.valueof(CONFIG.getConfig(ConfigurationKeys.STORE_DB_TYPE));
|
||||
}
|
||||
|
||||
/**
|
||||
* get db driver class name
|
||||
*
|
||||
* @return the db driver class name
|
||||
*/
|
||||
protected String getDriverClassName() {
|
||||
String driverClassName = CONFIG.getConfig(ConfigurationKeys.STORE_DB_DRIVER_CLASS_NAME);
|
||||
if (StringUtils.isBlank(driverClassName)) {
|
||||
throw new StoreException(
|
||||
String.format("the {%s} can't be empty", ConfigurationKeys.STORE_DB_DRIVER_CLASS_NAME));
|
||||
}
|
||||
return driverClassName;
|
||||
}
|
||||
|
||||
/**
|
||||
* get db max wait
|
||||
*
|
||||
* @return the db max wait
|
||||
*/
|
||||
protected Long getMaxWait() {
|
||||
return CONFIG.getLong(ConfigurationKeys.STORE_DB_MAX_WAIT, DEFAULT_DB_MAX_WAIT);
|
||||
}
|
||||
|
||||
protected ClassLoader getDriverClassLoader() {
|
||||
return DRIVER_LOADERS.getOrDefault(getDriverClassName(), this.getClass().getClassLoader());
|
||||
}
|
||||
|
||||
private static Map<String, ClassLoader> createMysqlDriverClassLoaders() {
|
||||
Map<String, ClassLoader> loaders = new HashMap<>();
|
||||
String cp = System.getProperty("loader.path");
|
||||
if (cp == null) {
|
||||
cp = System.getProperty("java.class.path");
|
||||
}
|
||||
if (cp == null || cp.isEmpty()) {
|
||||
return loaders;
|
||||
}
|
||||
Stream.of(cp.split(File.pathSeparator))
|
||||
.map(File::new)
|
||||
.filter(File::exists)
|
||||
.map(file -> file.isFile() ? file.getParentFile() : file)
|
||||
.filter(Objects::nonNull)
|
||||
.filter(File::isDirectory)
|
||||
.map(file -> new File(file, "jdbc"))
|
||||
.filter(File::exists)
|
||||
.filter(File::isDirectory)
|
||||
.distinct()
|
||||
.flatMap(file -> {
|
||||
File[] files = file.listFiles((f, name) -> name.startsWith(MYSQL_DRIVER_FILE_PREFIX));
|
||||
if (files != null) {
|
||||
return Stream.of(files);
|
||||
} else {
|
||||
return Stream.of();
|
||||
}
|
||||
})
|
||||
.forEach(file -> {
|
||||
if (loaders.containsKey(MYSQL8_DRIVER_CLASS_NAME) && loaders.containsKey(MYSQL_DRIVER_CLASS_NAME)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
URL url = file.toURI().toURL();
|
||||
ClassLoader loader = new URLClassLoader(new URL[] {url}, ClassLoader.getSystemClassLoader());
|
||||
try {
|
||||
loader.loadClass(MYSQL8_DRIVER_CLASS_NAME);
|
||||
loaders.putIfAbsent(MYSQL8_DRIVER_CLASS_NAME, loader);
|
||||
} catch (ClassNotFoundException e) {
|
||||
loaders.putIfAbsent(MYSQL_DRIVER_CLASS_NAME, loader);
|
||||
}
|
||||
} catch (MalformedURLException ignore) {
|
||||
}
|
||||
});
|
||||
return loaders;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get url string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
protected String getUrl() {
|
||||
String url = CONFIG.getConfig(ConfigurationKeys.STORE_DB_URL);
|
||||
if (StringUtils.isBlank(url)) {
|
||||
throw new StoreException(String.format("the {%s} can't be empty", ConfigurationKeys.STORE_DB_URL));
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
protected String getUser() {
|
||||
String user = CONFIG.getConfig(ConfigurationKeys.STORE_DB_USER);
|
||||
if (StringUtils.isBlank(user)) {
|
||||
throw new StoreException(String.format("the {%s} can't be empty", ConfigurationKeys.STORE_DB_USER));
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get password string.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
protected String getPassword() {
|
||||
String password = CONFIG.getConfig(ConfigurationKeys.STORE_DB_PASSWORD);
|
||||
String publicKey = getPublicKey();
|
||||
if (StringUtils.isNotBlank(publicKey)) {
|
||||
try {
|
||||
password = ConfigTools.publicDecrypt(password, publicKey);
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(
|
||||
"decryption failed,please confirm whether the ciphertext and secret key are correct! error msg: {}",
|
||||
e.getMessage());
|
||||
}
|
||||
}
|
||||
return password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get min conn int.
|
||||
*
|
||||
* @return the int
|
||||
*/
|
||||
protected int getMinConn() {
|
||||
int minConn = CONFIG.getInt(ConfigurationKeys.STORE_DB_MIN_CONN, DEFAULT_DB_MIN_CONN);
|
||||
return minConn < 0 ? DEFAULT_DB_MIN_CONN : minConn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get max conn int.
|
||||
*
|
||||
* @return the int
|
||||
*/
|
||||
protected int getMaxConn() {
|
||||
int maxConn = CONFIG.getInt(ConfigurationKeys.STORE_DB_MAX_CONN, DEFAULT_DB_MAX_CONN);
|
||||
return maxConn < 0 ? DEFAULT_DB_MAX_CONN : maxConn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get validation query string.
|
||||
*
|
||||
* @param dbType the db type
|
||||
* @return the string
|
||||
*/
|
||||
protected String getValidationQuery(DBType dbType) {
|
||||
if (DBType.ORACLE.equals(dbType)) {
|
||||
return "select sysdate from dual";
|
||||
} else {
|
||||
return "select 1";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get public key.
|
||||
*
|
||||
* @return the string
|
||||
*/
|
||||
protected String getPublicKey() {
|
||||
return CONFIG.getConfig(ConfigurationKeys.STORE_PUBLIC_KEY);
|
||||
}
|
||||
}
|
||||
-32
@@ -1,32 +0,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.
|
||||
*/
|
||||
package org.apache.seata.server;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*/
|
||||
@SpringBootApplication(scanBasePackages = {"org.apache.seata"})
|
||||
public class SeataServerApplication {
|
||||
public static void main(String[] args) throws IOException {
|
||||
// run the spring-boot application
|
||||
SpringApplication.run(ServerApplication.class, args);
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
server:
|
||||
port: 8091
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: ruoyi-seata-server
|
||||
main:
|
||||
web-application-type: none
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: @profiles.active@
|
||||
|
||||
logging:
|
||||
config: classpath:logback-spring.xml
|
||||
file:
|
||||
path: ./logs/seata
|
||||
# extend:
|
||||
# logstash-appender:
|
||||
# destination: 127.0.0.1:4560
|
||||
# kafka-appender:
|
||||
# bootstrap-servers: 127.0.0.1:9092
|
||||
# topic: logback_to_logstash
|
||||
|
||||
seata:
|
||||
config:
|
||||
# support: nacos 、 consul 、 apollo 、 zk 、 etcd3
|
||||
type: nacos
|
||||
nacos:
|
||||
server-addr: @nacos.server@
|
||||
group: @nacos.discovery.group@
|
||||
namespace: ${spring.profiles.active}
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
##if use MSE Nacos with auth, mutex with username/password attribute
|
||||
#access-key: ""
|
||||
#secret-key: ""
|
||||
data-id: seata-server.properties
|
||||
registry:
|
||||
# support: nacos 、 eureka 、 redis 、 zk 、 consul 、 etcd3 、 sofa
|
||||
type: nacos
|
||||
nacos:
|
||||
application: ${spring.application.name}
|
||||
server-addr: @nacos.server@
|
||||
group: @nacos.discovery.group@
|
||||
namespace: ${spring.profiles.active}
|
||||
cluster: default
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
##if use MSE Nacos with auth, mutex with username/password attribute
|
||||
#access-key: ""
|
||||
#secret-key: ""
|
||||
@@ -1,8 +0,0 @@
|
||||
Spring Boot Version: ${spring-boot.version}
|
||||
Spring Application Name: ${spring.application.name}
|
||||
_
|
||||
| |
|
||||
___ ___ __ _| |_ __ _ ______ ___ ___ _ ____ _____ _ __
|
||||
/ __|/ _ \/ _` | __/ _` |______/ __|/ _ \ '__\ \ / / _ \ '__|
|
||||
\__ \ __/ (_| | || (_| | \__ \ __/ | \ V / __/ |
|
||||
|___/\___|\__,_|\__\__,_| |___/\___|_| \_/ \___|_|
|
||||
Binary file not shown.
@@ -1,97 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<included>
|
||||
|
||||
<property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="file_console" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/console.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/console.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大 1天 -->
|
||||
<maxHistory>1</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
<charset>utf-8</charset>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- info异步输出 -->
|
||||
<appender name="async_info" class="ch.qos.logback.classic.AsyncAppender">
|
||||
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
|
||||
<discardingThreshold>0</discardingThreshold>
|
||||
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
|
||||
<queueSize>512</queueSize>
|
||||
<!-- 添加附加的appender,最多只能添加一个 -->
|
||||
<appender-ref ref="file_info"/>
|
||||
</appender>
|
||||
|
||||
<!-- error异步输出 -->
|
||||
<appender name="async_error" class="ch.qos.logback.classic.AsyncAppender">
|
||||
<!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
|
||||
<discardingThreshold>0</discardingThreshold>
|
||||
<!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
|
||||
<queueSize>512</queueSize>
|
||||
<!-- 添加附加的appender,最多只能添加一个 -->
|
||||
<appender-ref ref="file_error"/>
|
||||
</appender>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="async_info"/>
|
||||
<appender-ref ref="async_error"/>
|
||||
<appender-ref ref="file_console"/>
|
||||
</root>
|
||||
</included>
|
||||
@@ -1,49 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Copyright 1999-2019 Seata.io Group.
|
||||
~
|
||||
~ Licensed 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 scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<!-- Context listeners -->
|
||||
<contextListener class="org.apache.seata.server.logging.listener.SystemPropertyLoggerContextListener"/>
|
||||
<!-- common properties -->
|
||||
<springProperty name="PORT" source="server.port" defaultValue="7091"/>
|
||||
<springProperty name="APPLICATION_NAME" source="spring.application.name" defaultValue="seata-server"/>
|
||||
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="logs/${project.artifactId}"/>
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="console.log.pattern"
|
||||
value="%cyan(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}%n) - %msg%n"/>
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${console.log.pattern}</pattern>
|
||||
<charset>utf-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<include resource="logback-common.xml" />
|
||||
|
||||
<include resource="logback-logstash.xml" />
|
||||
|
||||
<!-- 开启 skywalking 日志收集 -->
|
||||
<include resource="logback-skylog.xml" />
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -48,12 +48,12 @@ spring:
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
# 注册组
|
||||
group: @nacos.discovery.group@
|
||||
namespace: ${spring.profiles.active}
|
||||
group: DEFAULT_GROUP
|
||||
namespace: public
|
||||
config:
|
||||
# 配置组
|
||||
group: @nacos.config.group@
|
||||
namespace: ${spring.profiles.active}
|
||||
group: DEFAULT_GROUP
|
||||
namespace: public
|
||||
config:
|
||||
import:
|
||||
- optional:nacos:datasource.yml
|
||||
|
||||
Reference in New Issue
Block a user