mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-01-02 02:25:27 +08:00
微服务重大升级说明(暂时只升级后台3.4.0)
-升级Spring Cloud Alibaba 2021.0.1.0,使用 spring.config.import 方式引入nacos配置 -拆分jeecg-boot-starter出来,使用独立项目维护
This commit is contained in:
@ -27,12 +27,14 @@ services:
|
||||
container_name: jeecg-boot-redis
|
||||
hostname: jeecg-boot-redis
|
||||
|
||||
# jeecg-boot-rabbitmq:
|
||||
# # image: rabbitmq:3-management
|
||||
# image: rabbitmq:3
|
||||
# ports:
|
||||
# - 5672:5672
|
||||
# # - 15672:15672
|
||||
# restart: always
|
||||
# container_name: jeecg-boot-rabbitmq
|
||||
# hostname: jeecg-boot-rabbitmq
|
||||
jeecg-boot-rabbitmq:
|
||||
image: rabbitmq:3.7.7-management
|
||||
ports:
|
||||
- 5672:5672
|
||||
- 15672:15672
|
||||
restart: always
|
||||
container_name: jeecg-boot-rabbitmq
|
||||
hostname: jeecg-boot-rabbitmq
|
||||
environment:
|
||||
RABBITMQ_DEFAULT_USER: guest
|
||||
RABBITMQ_DEFAULT_PASS: guest
|
||||
|
||||
@ -13,8 +13,8 @@ services:
|
||||
depends_on:
|
||||
- jeecg-boot-nacos
|
||||
build:
|
||||
context: ./jeecg-cloud-system-start
|
||||
container_name: jeecg-boot-system
|
||||
context: ./jeecg-system-cloud-start
|
||||
container_name: jeecg-system-start
|
||||
hostname: jeecg-boot-system
|
||||
restart: on-failure
|
||||
environment:
|
||||
@ -24,8 +24,8 @@ services:
|
||||
depends_on:
|
||||
- jeecg-boot-nacos
|
||||
build:
|
||||
context: ../jeecg-boot-module-demo
|
||||
container_name: jeecg-boot-demo
|
||||
context: ./jeecg-demo-cloud-start
|
||||
container_name: jeecg-demo-start
|
||||
hostname: jeecg-boot-demo
|
||||
restart: on-failure
|
||||
environment:
|
||||
|
||||
@ -10,6 +10,6 @@ WORKDIR /jeecg-cloud-gateway
|
||||
|
||||
EXPOSE 9999
|
||||
|
||||
ADD ./target/jeecg-cloud-gateway-3.3.0.jar ./
|
||||
ADD ./target/jeecg-cloud-gateway-3.4.0.jar ./
|
||||
|
||||
CMD sleep 50;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-gateway-3.3.0.jar
|
||||
CMD sleep 50;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-gateway-3.4.0.jar
|
||||
@ -1,7 +1,3 @@
|
||||
# 服务化改造手册
|
||||
http://localhost:9999
|
||||
|
||||
~~~
|
||||
注意 :启动服务跨域问题处理
|
||||
1、需要将common 模块的 WebMvcConfiguration corsFilter 注掉 后面做成注解切换
|
||||
2、org.jeecg.config.shiro.filters.JwtFilter类的 65行,跨域代码注释掉
|
||||
~~~
|
||||
提示:在未启动服务实例情况下,看的接口文档为空
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-module</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jeecg-cloud-gateway</artifactId>
|
||||
|
||||
@ -31,8 +31,8 @@ public class JeecgGatewayApplication implements CommandLineRunner {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ConfigurableApplicationContext applicationContext = SpringApplication.run(JeecgGatewayApplication.class, args);
|
||||
String userName = applicationContext.getEnvironment().getProperty("jeecg.test");
|
||||
System.err.println("user name :" +userName);
|
||||
//String userName = applicationContext.getEnvironment().getProperty("jeecg.test");
|
||||
//System.err.println("user name :" +userName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -28,7 +28,7 @@ public class GatewayRoutersConfig {
|
||||
this.serverAddr = serverAddr;
|
||||
}
|
||||
|
||||
@Value("${spring.cloud.nacos.discovery.namespace}")
|
||||
@Value("${spring.cloud.nacos.discovery.namespace:#{null}}")
|
||||
public void setNamespace(String namespace) {
|
||||
this.namespace = namespace;
|
||||
}
|
||||
@ -48,12 +48,12 @@ public class GatewayRoutersConfig {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
@Value("${spring.cloud.nacos.config.username}")
|
||||
@Value("${spring.cloud.nacos.config.username:#{null}}")
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
@Value("${spring.cloud.nacos.config.password}")
|
||||
@Value("${spring.cloud.nacos.config.password:#{null}}")
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
@ -339,9 +339,15 @@ public class DynamicRouteLoader implements ApplicationEventPublisherAware {
|
||||
try {
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("serverAddr", gatewayRoutersConfig.getServerAddr());
|
||||
properties.setProperty("namespace", gatewayRoutersConfig.getNamespace());
|
||||
properties.setProperty("username", gatewayRoutersConfig.getUsername());
|
||||
properties.setProperty("password", gatewayRoutersConfig.getPassword());
|
||||
if(StringUtils.isNotBlank(gatewayRoutersConfig.getNamespace())){
|
||||
properties.setProperty("namespace", gatewayRoutersConfig.getNamespace());
|
||||
}
|
||||
if(StringUtils.isNotBlank( gatewayRoutersConfig.getUsername())){
|
||||
properties.setProperty("username", gatewayRoutersConfig.getUsername());
|
||||
}
|
||||
if(StringUtils.isNotBlank(gatewayRoutersConfig.getPassword())){
|
||||
properties.setProperty("password", gatewayRoutersConfig.getPassword());
|
||||
}
|
||||
return configService = NacosFactory.createConfigService(properties);
|
||||
} catch (Exception e) {
|
||||
log.error("创建ConfigService异常", e);
|
||||
|
||||
@ -1,13 +1,32 @@
|
||||
server:
|
||||
port: 9999
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: jeecg-gateway
|
||||
main:
|
||||
#循环依赖默认情况下已经被禁止了
|
||||
allow-circular-references: true
|
||||
allow-bean-definition-overriding: true
|
||||
config:
|
||||
import:
|
||||
- optional:nacos:${spring.application.name}-@profile.name@.yaml
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
server-addr: @config.server-addr@
|
||||
discovery:
|
||||
server-addr: ${spring.cloud.nacos.config.server-addr}
|
||||
gateway:
|
||||
discovery:
|
||||
locator:
|
||||
enabled: true
|
||||
globalcors:
|
||||
cors-configurations:
|
||||
'[/**]':
|
||||
allowCredentials: true
|
||||
#springboot2.4后需用allowedOriginPatterns
|
||||
allowedOriginPatterns: "*"
|
||||
allowedMethods: "*"
|
||||
allowedHeaders: "*"
|
||||
#Sentinel配置
|
||||
sentinel:
|
||||
transport:
|
||||
@ -79,36 +98,4 @@ spring:
|
||||
dataId: ${spring.application.name}-api-rules
|
||||
groupId: SENTINEL_GROUP
|
||||
rule-type: gw-api-group
|
||||
data-type: json
|
||||
gateway:
|
||||
discovery:
|
||||
locator:
|
||||
enabled: true
|
||||
globalcors:
|
||||
cors-configurations:
|
||||
'[/**]':
|
||||
allowCredentials: true
|
||||
#springboot2.4后需用allowedOriginPatterns
|
||||
allowedOriginPatterns: "*"
|
||||
allowedMethods: "*"
|
||||
allowedHeaders: "*"
|
||||
# httpclient:
|
||||
# connect-timeout: 1000
|
||||
# response-timeout: 5s
|
||||
# # Nacos的yml方式路由配置(默认注释掉,采用数据库加载)
|
||||
# - id: jeecg-demo
|
||||
# uri: lb://jeecg-demo
|
||||
# predicates:
|
||||
# - Path=/mock/**,/test/**,/bigscreen/template1/**,/bigscreen/template2/**
|
||||
# - id: jeecg-system
|
||||
# uri: lb://jeecg-system
|
||||
# predicates:
|
||||
# - Path=/sys/**,/eoa/**,/v1/**,/joa/**,/online/**,/bigscreen/**,/jmreport/**,/desform/**,/act/**,/plug-in/**,/generic/**
|
||||
# - id: jeecg-system-websocket
|
||||
# uri: lb:ws://jeecg-system
|
||||
# predicates:
|
||||
# - Path=/websocket/**,/eoaSocket/**,/newsWebsocket/**
|
||||
# - id: jeecg-demo-websocket
|
||||
# uri: lb:ws://jeecg-demo
|
||||
# predicates:
|
||||
# - Path=/vxeSocket/**
|
||||
data-type: json
|
||||
@ -0,0 +1,2 @@
|
||||
http://localhost:9111
|
||||
账号密码:admin/admin
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-module</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jeecg-cloud-monitor</artifactId>
|
||||
|
||||
@ -10,6 +10,6 @@ WORKDIR /jeecg-cloud-nacos
|
||||
|
||||
EXPOSE 8848
|
||||
|
||||
ADD ./target/jeecg-cloud-nacos-3.3.0.jar ./
|
||||
ADD ./target/jeecg-cloud-nacos-3.4.0.jar ./
|
||||
|
||||
CMD sleep 5;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-nacos-3.3.0.jar
|
||||
CMD sleep 5;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-nacos-3.4.0.jar
|
||||
11
jeecg-boot/jeecg-cloud-module/jeecg-cloud-nacos/README.md
Normal file
11
jeecg-boot/jeecg-cloud-module/jeecg-cloud-nacos/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
访问地址: http://localhost:8848/nacos
|
||||
账号密码:nacos/nacos
|
||||
|
||||
|
||||
# 使用方法
|
||||
|
||||
- 1、目前只做了关闭鉴权模式
|
||||
- 2、此项目与官方同步,只是为了简化微服务部署
|
||||
- 3、如何不用此模块,使用自己的naocs,请创建下面目录中的配置文件
|
||||
目录:jeecg-cloud-nacos/docs/config
|
||||
配置文件: YAML
|
||||
@ -0,0 +1,146 @@
|
||||
spring:
|
||||
datasource:
|
||||
druid:
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
loginUsername: admin
|
||||
loginPassword: 123456
|
||||
allow:
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
dynamic:
|
||||
druid:
|
||||
initial-size: 5
|
||||
min-idle: 5
|
||||
maxActive: 20
|
||||
maxWait: 60000
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
poolPreparedStatements: true
|
||||
maxPoolPreparedStatementPerConnectionSize: 20
|
||||
filters: stat,wall,slf4j
|
||||
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://jeecg-boot-mysql:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: root
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
redis:
|
||||
database: 0
|
||||
host: jeecg-boot-redis
|
||||
password:
|
||||
port: 6379
|
||||
rabbitmq:
|
||||
host: jeecg-boot-rabbitmq
|
||||
username: guest
|
||||
password: guest
|
||||
port: 5672
|
||||
publisher-confirms: true
|
||||
publisher-returns: true
|
||||
virtual-host: /
|
||||
listener:
|
||||
simple:
|
||||
acknowledge-mode: manual
|
||||
concurrency: 1
|
||||
max-concurrency: 1
|
||||
retry:
|
||||
enabled: true
|
||||
minidao:
|
||||
base-package: org.jeecg.modules.jmreport.*,org.jeecg.modules.drag.*
|
||||
jeecg:
|
||||
signatureSecret: dd05f1c54d63749eda95f9fa6d49v442a
|
||||
signUrls: /sys/dict/getDictItems/*,/sys/dict/loadDict/*,/sys/dict/loadDictOrderByValue/*,/sys/dict/loadDictItem/*,/sys/dict/loadTreeData,/sys/api/queryTableDictItemsByCode,/sys/api/queryFilterTableDictInfo,/sys/api/queryTableDictByKeys,/sys/api/translateDictFromTable,/sys/api/translateDictFromTableByKeys
|
||||
uploadType: local
|
||||
domainUrl:
|
||||
pc: http://localhost:3100
|
||||
app: http://localhost:8051
|
||||
path:
|
||||
upload: /opt/upFiles
|
||||
webapp: /opt/webapp
|
||||
shiro:
|
||||
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**
|
||||
oss:
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
accessKey: ??
|
||||
secretKey: ??
|
||||
bucketName: jeecgdev
|
||||
staticDomain: ??
|
||||
elasticsearch:
|
||||
cluster-name: jeecg-ES
|
||||
cluster-nodes: jeecg-boot-es:9200
|
||||
check-enabled: false
|
||||
file-view-domain: 127.0.0.1:8012
|
||||
minio:
|
||||
minio_url: http://minio.jeecg.com
|
||||
minio_name: ??
|
||||
minio_pass: ??
|
||||
bucketName: otatest
|
||||
jmreport:
|
||||
mode: dev
|
||||
is_verify_token: false
|
||||
verify_methods: remove,delete,save,add,update
|
||||
wps:
|
||||
domain: https://wwo.wps.cn/office/
|
||||
appid: ??
|
||||
appsecret: ??
|
||||
xxljob:
|
||||
enabled: false
|
||||
adminAddresses: http://jeecg-boot-xxljob:9080/xxl-job-admin
|
||||
appname: ${spring.application.name}
|
||||
accessToken: ''
|
||||
logPath: logs/jeecg/job/jobhandler/
|
||||
logRetentionDays: 30
|
||||
redisson:
|
||||
address: jeecg-boot-redis:6379
|
||||
password:
|
||||
type: STANDALONE
|
||||
enabled: true
|
||||
logging:
|
||||
level:
|
||||
org.jeecg.modules.system.mapper : info
|
||||
cas:
|
||||
prefixUrl: http://localhost:8888/cas
|
||||
knife4j:
|
||||
production: false
|
||||
basic:
|
||||
enable: false
|
||||
username: jeecg
|
||||
password: jeecg1314
|
||||
justauth:
|
||||
enabled: true
|
||||
type:
|
||||
GITHUB:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/thirdLogin/github/callback
|
||||
WECHAT_ENTERPRISE:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/thirdLogin/wechat_enterprise/callback
|
||||
agent-id: ??
|
||||
DINGTALK:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/thirdLogin/dingtalk/callback
|
||||
cache:
|
||||
type: default
|
||||
prefix: 'demo::'
|
||||
timeout: 1h
|
||||
third-app:
|
||||
enabled: false
|
||||
type:
|
||||
WECHAT_ENTERPRISE:
|
||||
enabled: false
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
agent-id: ??
|
||||
DINGTALK:
|
||||
enabled: false
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
agent-id: ??
|
||||
@ -0,0 +1,13 @@
|
||||
jeecg:
|
||||
route:
|
||||
config:
|
||||
#type:database nacos yml
|
||||
data-type: database
|
||||
group: DEFAULT_GROUP
|
||||
data-id: jeecg-gateway-router
|
||||
spring:
|
||||
redis:
|
||||
database: 0
|
||||
host: jeecg-boot-redis
|
||||
port: 6379
|
||||
password:
|
||||
@ -0,0 +1,52 @@
|
||||
[{
|
||||
"id": "jeecg-system",
|
||||
"order": 0,
|
||||
"predicates": [{
|
||||
"name": "Path",
|
||||
"args": {
|
||||
"_genkey_0": "/sys/**",
|
||||
"_genkey_1": "/jmreport/**",
|
||||
"_genkey_3": "/online/**",
|
||||
"_genkey_4": "/generic/**"
|
||||
}
|
||||
}],
|
||||
"filters": [],
|
||||
"uri": "lb://jeecg-system"
|
||||
}, {
|
||||
"id": "jeecg-demo",
|
||||
"order": 1,
|
||||
"predicates": [{
|
||||
"name": "Path",
|
||||
"args": {
|
||||
"_genkey_0": "/mock/**",
|
||||
"_genkey_1": "/test/**",
|
||||
"_genkey_2": "/bigscreen/template1/**",
|
||||
"_genkey_3": "/bigscreen/template2/**"
|
||||
}
|
||||
}],
|
||||
"filters": [],
|
||||
"uri": "lb://jeecg-demo"
|
||||
}, {
|
||||
"id": "jeecg-system-websocket",
|
||||
"order": 2,
|
||||
"predicates": [{
|
||||
"name": "Path",
|
||||
"args": {
|
||||
"_genkey_0": "/websocket/**",
|
||||
"_genkey_1": "/newsWebsocket/**"
|
||||
}
|
||||
}],
|
||||
"filters": [],
|
||||
"uri": "lb:ws://jeecg-system"
|
||||
}, {
|
||||
"id": "jeecg-demo-websocket",
|
||||
"order": 3,
|
||||
"predicates": [{
|
||||
"name": "Path",
|
||||
"args": {
|
||||
"_genkey_0": "/vxeSocket/**"
|
||||
}
|
||||
}],
|
||||
"filters": [],
|
||||
"uri": "lb:ws://jeecg-demo"
|
||||
}]
|
||||
@ -0,0 +1,100 @@
|
||||
server:
|
||||
tomcat:
|
||||
max-swallow-size: -1
|
||||
error:
|
||||
include-exception: true
|
||||
include-stacktrace: ALWAYS
|
||||
include-message: ALWAYS
|
||||
compression:
|
||||
enabled: true
|
||||
min-response-size: 1024
|
||||
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
|
||||
management:
|
||||
health:
|
||||
mail:
|
||||
enabled: false
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: "*"
|
||||
health:
|
||||
sensitive: true
|
||||
endpoint:
|
||||
health:
|
||||
show-details: ALWAYS
|
||||
spring:
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 10MB
|
||||
max-request-size: 10MB
|
||||
mail:
|
||||
host: smtp.163.com
|
||||
username: jeecgos@163.com
|
||||
password: ??
|
||||
properties:
|
||||
mail:
|
||||
smtp:
|
||||
auth: true
|
||||
starttls:
|
||||
enable: true
|
||||
required: true
|
||||
quartz:
|
||||
job-store-type: jdbc
|
||||
initialize-schema: embedded
|
||||
auto-startup: false
|
||||
startup-delay: 1s
|
||||
overwrite-existing-jobs: true
|
||||
properties:
|
||||
org:
|
||||
quartz:
|
||||
scheduler:
|
||||
instanceName: MyScheduler
|
||||
instanceId: AUTO
|
||||
jobStore:
|
||||
class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
|
||||
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
|
||||
tablePrefix: QRTZ_
|
||||
isClustered: true
|
||||
misfireThreshold: 12000
|
||||
clusterCheckinInterval: 15000
|
||||
threadPool:
|
||||
class: org.quartz.simpl.SimpleThreadPool
|
||||
threadCount: 10
|
||||
threadPriority: 5
|
||||
threadsInheritContextClassLoaderOfInitializingThread: true
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
aop:
|
||||
proxy-target-class: true
|
||||
activiti:
|
||||
check-process-definitions: false
|
||||
async-executor-activate: false
|
||||
job-executor-activate: false
|
||||
jpa:
|
||||
open-in-view: false
|
||||
freemarker:
|
||||
suffix: .ftl
|
||||
content-type: text/html
|
||||
charset: UTF-8
|
||||
cache: false
|
||||
prefer-file-system-access: false
|
||||
template-loader-path:
|
||||
- classpath:/templates
|
||||
mvc:
|
||||
static-path-pattern: /**
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
resource:
|
||||
static-locations: classpath:/static/,classpath:/public/
|
||||
autoconfigure:
|
||||
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:org/jeecg/modules/**/xml/*Mapper.xml
|
||||
global-config:
|
||||
banner: false
|
||||
db-config:
|
||||
id-type: ASSIGN_ID
|
||||
table-underline: true
|
||||
configuration:
|
||||
call-setters-on-nulls: true
|
||||
@ -5,7 +5,7 @@
|
||||
<artifactId>jeecg-cloud-nacos</artifactId>
|
||||
<name>jeecg-cloud-nacos</name>
|
||||
<description>nacos启动模块</description>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.0</version>
|
||||
|
||||
<!-- Nacos2不支持springboot2.6.6 -->
|
||||
<parent>
|
||||
|
||||
@ -19,14 +19,9 @@ import javax.servlet.http.HttpServletResponse;
|
||||
@EnableScheduling
|
||||
public class JeecgNacosApplication {
|
||||
|
||||
/**
|
||||
* 是否单机模式启动
|
||||
*/
|
||||
/** 是否单机模式启动 */
|
||||
private static String standalone = "true";
|
||||
|
||||
/**
|
||||
* 是否开启鉴权
|
||||
*/
|
||||
/** 是否开启鉴权 */
|
||||
private static String enabled = "false";
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@ -10,6 +10,6 @@ WORKDIR /jeecg-cloud-sentinel
|
||||
|
||||
EXPOSE 8848
|
||||
|
||||
ADD ./target/jeecg-cloud-sentinel-3.3.0.jar ./
|
||||
ADD ./target/jeecg-cloud-sentinel-3.4.0.jar ./
|
||||
|
||||
CMD sleep 5;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-sentinel-3.3.0.jar
|
||||
CMD sleep 5;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-sentinel-3.4.0.jar
|
||||
|
||||
@ -4,6 +4,6 @@
|
||||
|
||||
# 使用方法
|
||||
|
||||
- 1、第一次登录sentinel内容是空的,必须访问了微服务实例才有配置
|
||||
- 1、第一次登录sentinel内容是空的,必须访问了微服务实例的请求才会出现配置
|
||||
- 2、sentinel做了深度改造,支持持久化到nacos中
|
||||
- 3、目前只针对gateway做的控制,其他服务不需要
|
||||
|
||||
@ -5,31 +5,12 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-module</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<artifactId>jeecg-cloud-sentinel</artifactId>
|
||||
<name>jeecg-cloud-sentinel</name>
|
||||
<description>sentinel启动模块</description>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>aliyun</id>
|
||||
<name>aliyun Repository</name>
|
||||
<url>https://maven.aliyun.com/repository/public</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jeecg</id>
|
||||
<name>jeecg Repository</name>
|
||||
<url>https://maven.jeecg.org/nexus/content/repositories/jeecg</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.cloud</groupId>
|
||||
|
||||
@ -24,6 +24,7 @@ import com.alibaba.csp.sentinel.dashboard.datasource.entity.rule.*;
|
||||
import com.alibaba.csp.sentinel.dashboard.rule.nacos.entity.AuthorityRuleCorrectEntity;
|
||||
import com.alibaba.csp.sentinel.dashboard.rule.nacos.entity.ParamFlowRuleCorrectEntity;
|
||||
import com.alibaba.nacos.api.PropertyKeyConst;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@ -150,8 +151,12 @@ public class SentinelConfig {
|
||||
public ConfigService nacosConfigService() throws Exception {
|
||||
Properties properties=new Properties();
|
||||
properties.put(PropertyKeyConst.SERVER_ADDR,nacosConfigProperties.getServerAddr());
|
||||
properties.put(PropertyKeyConst.USERNAME,nacosConfigProperties.getUsername());
|
||||
properties.put(PropertyKeyConst.PASSWORD,nacosConfigProperties.getPassword());
|
||||
if(StringUtils.isNotBlank(nacosConfigProperties.getUsername())){
|
||||
properties.put(PropertyKeyConst.USERNAME,nacosConfigProperties.getUsername());
|
||||
}
|
||||
if(StringUtils.isNotBlank(nacosConfigProperties.getPassword())){
|
||||
properties.put(PropertyKeyConst.PASSWORD,nacosConfigProperties.getPassword());
|
||||
}
|
||||
return ConfigFactory.createConfigService(properties);
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,8 +32,6 @@ logging:
|
||||
nacos:
|
||||
server:
|
||||
ip: @config.server-addr@
|
||||
password: @config.password@
|
||||
username: @config.username@
|
||||
sentinel:
|
||||
dashboard:
|
||||
version: 1.8.2
|
||||
@ -1,57 +0,0 @@
|
||||
server:
|
||||
#微服务端口
|
||||
port: 7001
|
||||
spring:
|
||||
application:
|
||||
name: jeecg-system
|
||||
# cloud:
|
||||
# #Sentinel持久化配置
|
||||
# sentinel:
|
||||
# transport:
|
||||
# dashboard: jeecg-boot-sentinel:9000
|
||||
# datasource:
|
||||
# #流控规则
|
||||
# flow: # 指定数据源名称
|
||||
# # 指定nacos数据源
|
||||
# nacos:
|
||||
# server-addr: @config.server-addr@
|
||||
# # 指定配置文件
|
||||
# dataId: ${spring.application.name}-flow-rules
|
||||
# # 指定分组
|
||||
# groupId: SENTINEL_GROUP
|
||||
# # 指定配置文件规则类型
|
||||
# rule-type: flow
|
||||
# # 指定配置文件数据格式
|
||||
# data-type: json
|
||||
# #降级规则
|
||||
# degrade:
|
||||
# nacos:
|
||||
# server-addr: @config.server-addr@
|
||||
# dataId: ${spring.application.name}-degrade-rules
|
||||
# groupId: SENTINEL_GROUP
|
||||
# rule-type: degrade
|
||||
# data-type: json
|
||||
# #系统规则
|
||||
# system:
|
||||
# nacos:
|
||||
# server-addr: @config.server-addr@
|
||||
# dataId: ${spring.application.name}-system-rules
|
||||
# groupId: SENTINEL_GROUP
|
||||
# rule-type: system
|
||||
# data-type: json
|
||||
# #授权规则
|
||||
# authority:
|
||||
# nacos:
|
||||
# server-addr: @config.server-addr@
|
||||
# dataId: ${spring.application.name}-authority-rules
|
||||
# groupId: SENTINEL_GROUP
|
||||
# rule-type: authority
|
||||
# data-type: json
|
||||
# #热点参数
|
||||
# param-flow:
|
||||
# nacos:
|
||||
# server-addr: @config.server-addr@
|
||||
# dataId: ${spring.application.name}-param-rules
|
||||
# groupId: SENTINEL_GROUP
|
||||
# rule-type: param-flow
|
||||
# data-type: json
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-test</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<description>公共测试模块</description>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-test</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<description>消息队列测试模块</description>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-test-seata</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<description>分布式事务测试模块</description>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-test-seata</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<description>分布式事务测试模块</description>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-test-seata</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<description>分布式事务测试模块</description>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-test</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jeecg-cloud-test-seata</artifactId>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-test</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-module</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -10,7 +10,7 @@ WORKDIR /jeecg-cloud-xxljob
|
||||
|
||||
EXPOSE 9080
|
||||
|
||||
ADD ./target/jeecg-cloud-xxljob-3.3.0.jar ./
|
||||
ADD ./target/jeecg-cloud-xxljob-3.4.0.jar ./
|
||||
|
||||
CMD java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-xxljob-3.3.0.jar
|
||||
CMD java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-xxljob-3.4.0.jar
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
- 初始化数据库(mysql)
|
||||
- 初始化脚本(mysql)
|
||||
|
||||
jeecg-cloud-xxljob\doc\db\tables_xxl_job.sql
|
||||
db\tables_xxl_job.sql
|
||||
|
||||
- 修改数据库连接
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-module</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@ -6,8 +6,8 @@ server:
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:mysql://jeecg-boot-mysql:3306/xxl_job?Unicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: root
|
||||
username: ${MYSQL-USER:root}
|
||||
password: ${MYSQL-PWD:root}
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
hikari:
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
FROM anapsix/alpine-java:8_server-jre_unlimited
|
||||
|
||||
MAINTAINER jeecgos@163.com
|
||||
|
||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
|
||||
RUN mkdir -p /jeecg-demo-cloud
|
||||
|
||||
WORKDIR /jeecg-demo-cloud
|
||||
|
||||
EXPOSE 7002
|
||||
|
||||
ADD ./target/jeecg-demo-cloud-start-3.4.0.jar ./
|
||||
|
||||
CMD sleep 10;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-demo-cloud-start-3.4.0.jar
|
||||
41
jeecg-boot/jeecg-cloud-module/jeecg-demo-cloud-start/pom.xml
Normal file
41
jeecg-boot/jeecg-cloud-module/jeecg-demo-cloud-start/pom.xml
Normal file
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>
|
||||
<artifactId>jeecg-cloud-module</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>jeecg-demo-cloud-start</artifactId>
|
||||
<description>Demo微服务启动</description>
|
||||
|
||||
<dependencies>
|
||||
<!--引入微服务启动依赖 starter-->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-starter-cloud</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-starter-job</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-module-demo</artifactId>
|
||||
<version>${jeecgboot.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@ -0,0 +1,35 @@
|
||||
package org.jeecg;
|
||||
|
||||
import org.jeecg.common.base.BaseMap;
|
||||
import org.jeecg.common.constant.GlobalConstants;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableFeignClients
|
||||
public class JeecgDemoCloudApplication implements CommandLineRunner {
|
||||
@Autowired
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(JeecgDemoCloudApplication.class, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动的时候,触发下gateway网关刷新
|
||||
*
|
||||
* 解决: 先启动gateway后启动服务,Swagger接口文档访问不通的问题
|
||||
* @param args
|
||||
*/
|
||||
@Override
|
||||
public void run(String... args) {
|
||||
BaseMap params = new BaseMap();
|
||||
params.put(GlobalConstants.HANDLER_NAME, GlobalConstants.LODER_ROUDER_HANDLER);
|
||||
//刷新网关
|
||||
redisTemplate.convertAndSend(GlobalConstants.REDIS_TOPIC_NAME, params);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
server:
|
||||
port: 7002
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: jeecg-demo
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
server-addr: @config.server-addr@
|
||||
discovery:
|
||||
server-addr: ${spring.cloud.nacos.config.server-addr}
|
||||
config:
|
||||
import:
|
||||
- optional:nacos:jeecg.yaml
|
||||
- optional:nacos:jeecg-@profile.name@.yaml
|
||||
@ -4,12 +4,12 @@ MAINTAINER jeecgos@163.com
|
||||
|
||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
|
||||
RUN mkdir -p /jeecg-cloud-system
|
||||
RUN mkdir -p /jeecg-system-cloud
|
||||
|
||||
WORKDIR /jeecg-cloud-system
|
||||
WORKDIR /jeecg-system-cloud
|
||||
|
||||
EXPOSE 7001
|
||||
|
||||
ADD ./target/jeecg-cloud-system-start-3.3.0.jar ./
|
||||
ADD ./target/jeecg-system-cloud-start-3.4.0.jar ./
|
||||
|
||||
CMD sleep 10;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-cloud-system-start-3.3.0.jar
|
||||
CMD sleep 10;java -Dfile.encoding=utf-8 -Djava.security.egd=file:/dev/./urandom -jar jeecg-system-cloud-start-3.4.0.jar
|
||||
@ -5,11 +5,11 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-module</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>jeecg-cloud-system-start</artifactId>
|
||||
<description>System项目微服务启动</description>
|
||||
<artifactId>jeecg-system-cloud-start</artifactId>
|
||||
<description>System微服务启动</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 引入jeecg-boot-starter-cloud依赖 -->
|
||||
@ -37,12 +37,12 @@
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- feign 熔断限流、分布式锁、xxljob示例 -->
|
||||
<!-- feign 熔断限流、分布式锁、xxljob示例
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-cloud-test-more</artifactId>
|
||||
<version>${jeecgboot.version}</version>
|
||||
</dependency>
|
||||
</dependency>-->
|
||||
<!-- rabbitmq例子
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
@ -55,12 +55,12 @@
|
||||
<artifactId>jeecg-cloud-test-seata</artifactId>
|
||||
<version>${jeecgboot.version}</version>
|
||||
</dependency>-->
|
||||
<!-- 分库分表例子-->
|
||||
<!-- 分库分表例子
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-cloud-test-shardingsphere</artifactId>
|
||||
<version>${jeecgboot.version}</version>
|
||||
</dependency>
|
||||
</dependency>-->
|
||||
|
||||
</dependencies>
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
server:
|
||||
#微服务端口
|
||||
port: 7001
|
||||
spring:
|
||||
application:
|
||||
name: jeecg-system
|
||||
cloud:
|
||||
nacos:
|
||||
config:
|
||||
server-addr: @config.server-addr@
|
||||
discovery:
|
||||
server-addr: ${spring.cloud.nacos.config.server-addr}
|
||||
config:
|
||||
import:
|
||||
- optional:nacos:jeecg.yaml
|
||||
- optional:nacos:jeecg-@profile.name@.yaml
|
||||
@ -5,20 +5,24 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-boot-parent</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>jeecg-cloud-module</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>jeecg-system-cloud-start</module>
|
||||
<module>jeecg-demo-cloud-start</module>
|
||||
<module>jeecg-cloud-gateway</module>
|
||||
|
||||
<!-- 微服务所需要的中间件 -->
|
||||
<module>jeecg-cloud-nacos</module>
|
||||
<module>jeecg-cloud-sentinel</module>
|
||||
<module>jeecg-cloud-monitor</module>
|
||||
<module>jeecg-cloud-system-start</module>
|
||||
<module>jeecg-cloud-xxljob</module>
|
||||
<module>jeecg-cloud-test</module>
|
||||
<!-- 微服务测试示例
|
||||
<module>jeecg-cloud-test</module>-->
|
||||
</modules>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user