From 1c23d3b32c3deec9e19e929f153f5bd8386ab854 Mon Sep 17 00:00:00 2001 From: tanghc Date: Mon, 1 Jul 2019 16:46:08 +0800 Subject: [PATCH 1/8] update --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2e7afd2b..16037ee1 100644 --- a/README.md +++ b/README.md @@ -45,9 +45,11 @@ SOP封装了开放平台大部分功能包括:签名验证、统一异常处 - 应用授权 - 监控日志 -## 后期规划 +## 分支说明 -- 调试工具 +- develop: 日常开发分支 +- registry-nacos:使用nacos作为注册中心 +- SpringCloudGateway:网关使用spring cloud gateway,仅做体验用,不推荐 ## admin界面预览 From 4bc76f497d83932bb6f8e5ff925d94d64a63ac56 Mon Sep 17 00:00:00 2001 From: tanghc Date: Mon, 1 Jul 2019 17:49:45 +0800 Subject: [PATCH 2/8] update --- .../src/main/resources/application-dev.yml | 2 +- .../gitee/sop/registryapi/bean/EurekaUri.java | 3 +++ sop-example/sop-book/sop-book-web/pom.xml | 7 ++++--- .../src/main/resources/application-dev.yml | 14 +++++++------- sop-example/sop-story/sop-story-web/pom.xml | 7 ++++--- .../src/main/resources/application-dev.yml | 14 +++++++------- sop-gateway/pom.xml | 7 ++++--- .../src/main/resources/application-dev.yml | 18 +++++++++--------- 8 files changed, 39 insertions(+), 33 deletions(-) diff --git a/sop-admin/sop-admin-server/src/main/resources/application-dev.yml b/sop-admin/sop-admin-server/src/main/resources/application-dev.yml index af585325..8bed2221 100644 --- a/sop-admin/sop-admin-server/src/main/resources/application-dev.yml +++ b/sop-admin/sop-admin-server/src/main/resources/application-dev.yml @@ -37,7 +37,7 @@ registry: eureka-server-addr: http://localhost:1111/eureka/ nacos-server-addr: 127.0.0.1:8848 # 使用哪个配置中心,使用eureka,填eureka;使用nacos填nacos - name: nacos + name: eureka # 根据实际情况改 diff --git a/sop-common/sop-registry-api/src/main/java/com/gitee/sop/registryapi/bean/EurekaUri.java b/sop-common/sop-registry-api/src/main/java/com/gitee/sop/registryapi/bean/EurekaUri.java index 1d7b39e8..8a229ca7 100644 --- a/sop-common/sop-registry-api/src/main/java/com/gitee/sop/registryapi/bean/EurekaUri.java +++ b/sop-common/sop-registry-api/src/main/java/com/gitee/sop/registryapi/bean/EurekaUri.java @@ -50,6 +50,9 @@ public enum EurekaUri { } public Request getRequest(String url, String... args) { + if (url.endsWith("/")) { + url = url.substring(0, url.length() - 1); + } String requestUrl = url + getUri(args); Request request = this.getBuilder() .url(requestUrl) diff --git a/sop-example/sop-book/sop-book-web/pom.xml b/sop-example/sop-book/sop-book-web/pom.xml index 60606be9..e468ab30 100644 --- a/sop-example/sop-book/sop-book-web/pom.xml +++ b/sop-example/sop-book/sop-book-web/pom.xml @@ -39,22 +39,23 @@ - org.springframework.cloud spring-cloud-starter-netflix-eureka-client - --> + + org.springframework.cloud spring-cloud-starter-alibaba-nacos-discovery 0.2.2.RELEASE + --> diff --git a/sop-example/sop-book/sop-book-web/src/main/resources/application-dev.yml b/sop-example/sop-book/sop-book-web/src/main/resources/application-dev.yml index 4f39516a..649fcf39 100644 --- a/sop-example/sop-book/sop-book-web/src/main/resources/application-dev.yml +++ b/sop-example/sop-book/sop-book-web/src/main/resources/application-dev.yml @@ -11,15 +11,15 @@ spring: connect-string: localhost:2181 # nacos注册中心,和eureka只能用一个 - nacos: - discovery: - server-addr: 127.0.0.1:8848 +# nacos: +# discovery: +# server-addr: 127.0.0.1:8848 # eureka注册中心,如果使用nacos注册中心,这里要注释掉 -#eureka: -# client: -# serviceUrl: -# defaultZone: http://localhost:1111/eureka/ +eureka: + client: + serviceUrl: + defaultZone: http://localhost:1111/eureka/ # dubbo consumer demo: diff --git a/sop-example/sop-story/sop-story-web/pom.xml b/sop-example/sop-story/sop-story-web/pom.xml index 003081e0..a38c4620 100644 --- a/sop-example/sop-story/sop-story-web/pom.xml +++ b/sop-example/sop-story/sop-story-web/pom.xml @@ -33,22 +33,23 @@ - org.springframework.cloud spring-cloud-starter-netflix-eureka-client - --> + + org.springframework.cloud spring-cloud-starter-alibaba-nacos-discovery 0.2.2.RELEASE + --> diff --git a/sop-example/sop-story/sop-story-web/src/main/resources/application-dev.yml b/sop-example/sop-story/sop-story-web/src/main/resources/application-dev.yml index 62354b7a..59f250ab 100644 --- a/sop-example/sop-story/sop-story-web/src/main/resources/application-dev.yml +++ b/sop-example/sop-story/sop-story-web/src/main/resources/application-dev.yml @@ -11,15 +11,15 @@ spring: connect-string: localhost:2181 # nacos注册中心,和eureka只能用一个 - nacos: - discovery: - server-addr: 127.0.0.1:8848 +# nacos: +# discovery: +# server-addr: 127.0.0.1:8848 # eureka注册中心,如果使用nacos注册中心,这里要注释掉 -#eureka: -# client: -# serviceUrl: -# defaultZone: http://localhost:1111/eureka/ +eureka: + client: + serviceUrl: + defaultZone: http://localhost:1111/eureka/ # dubbo provider dubbo: diff --git a/sop-gateway/pom.xml b/sop-gateway/pom.xml index 78edce77..aa4f3a25 100644 --- a/sop-gateway/pom.xml +++ b/sop-gateway/pom.xml @@ -66,22 +66,23 @@ - org.springframework.cloud spring-cloud-starter-netflix-eureka-client - --> + + org.springframework.cloud spring-cloud-starter-alibaba-nacos-discovery 0.2.2.RELEASE + --> diff --git a/sop-gateway/src/main/resources/application-dev.yml b/sop-gateway/src/main/resources/application-dev.yml index c025fd63..568556ce 100644 --- a/sop-gateway/src/main/resources/application-dev.yml +++ b/sop-gateway/src/main/resources/application-dev.yml @@ -19,6 +19,12 @@ ribbon: # 请谨慎设置,因为post请求大多都是写入请求,如果要支持重试,确保服务的幂等性 OkToRetryOnAllOperations: false +# eureka注册中心,如果使用nacos注册中心,这里要注释掉 +eureka: + client: + serviceUrl: + defaultZone: http://localhost:1111/eureka/ + spring: application: name: api-gateway @@ -35,15 +41,9 @@ spring: enabled: true # nacos注册中心,和eureka只能用一个 - nacos: - discovery: - server-addr: 127.0.0.1:8848 - -# eureka注册中心,如果使用nacos注册中心,这里要注释掉 -#eureka: -# client: -# serviceUrl: -# defaultZone: http://localhost:1111/eureka/ +# nacos: +# discovery: +# server-addr: 127.0.0.1:8848 # 数据源,根据实际情况修改 datasource: From fa9ffa88c264ffcac3cd196476febcdca9a216a9 Mon Sep 17 00:00:00 2001 From: tanghc Date: Mon, 1 Jul 2019 18:24:32 +0800 Subject: [PATCH 3/8] 1.12.0 --- doc/docs/_sidebar.md | 57 ++++----- doc/docs/files/10106_nacos注册中心.md | 55 +-------- .../files/10107_扩展其它注册中心.md | 112 ++++++++++++++++++ sop-admin/sop-admin-server/pom.xml | 2 +- .../src/main/resources/application-dev.yml | 3 +- sop-common/pom.xml | 2 +- sop-common/sop-gateway-common/pom.xml | 4 +- sop-common/sop-registry-api/pom.xml | 2 +- sop-common/sop-service-common/pom.xml | 4 +- sop-example/sop-auth/pom.xml | 2 +- sop-example/sop-book/sop-book-web/pom.xml | 2 +- sop-example/sop-easyopen/pom.xml | 2 +- sop-example/sop-springmvc/pom.xml | 2 +- sop-example/sop-story/sop-story-web/pom.xml | 2 +- sop-gateway/pom.xml | 2 +- sop-website/website-server/pom.xml | 2 +- .../src/main/resources/application-dev.yml | 5 +- 17 files changed, 166 insertions(+), 94 deletions(-) create mode 100644 doc/docs/files/10107_扩展其它注册中心.md diff --git a/doc/docs/_sidebar.md b/doc/docs/_sidebar.md index 63118b5d..5a51e16b 100644 --- a/doc/docs/_sidebar.md +++ b/doc/docs/_sidebar.md @@ -1,30 +1,31 @@ -* [首页](/?t=1561970396914) +* [首页](/?t=1561975674071) * 开发文档 - * [快速体验](files/10010_快速体验.md?t=1561970396914) - * [项目接入到SOP](files/10011_项目接入到SOP.md?t=1561970396931) - * [新增接口](files/10020_新增接口.md?t=1561970396931) - * [业务参数校验](files/10030_业务参数校验.md?t=1561970396931) - * [错误处理](files/10040_错误处理.md?t=1561970396931) - * [编写文档](files/10041_编写文档.md?t=1561970396931) - * [接口交互详解](files/10050_接口交互详解.md?t=1561970396931) - * [easyopen支持](files/10070_easyopen支持.md?t=1561970396932) - * [使用签名校验工具](files/10080_使用签名校验工具.md?t=1561970396932) - * [ISV管理](files/10085_ISV管理.md?t=1561970396932) - * [自定义路由](files/10086_自定义路由.md?t=1561970396932) - * [路由授权](files/10090_路由授权.md?t=1561970396932) - * [接口限流](files/10092_接口限流.md?t=1561970396932) - * [监控日志](files/10093_监控日志.md?t=1561970396932) - * [SDK开发](files/10095_SDK开发.md?t=1561970396932) - * [使用SpringCloudGateway](files/10096_使用SpringCloudGateway.md?t=1561970396932) - * [应用授权](files/10097_应用授权.md?t=1561970396932) - * [更改数据节点名称](files/10099_更改数据节点名称.md?t=1561970396932) - * [对接前端](files/10100_对接前端.md?t=1561970396933) - * [自定义过滤器](files/10102_自定义过滤器.md?t=1561970396933) - * [文件上传](files/10104_文件上传.md?t=1561970396933) - * [nacos注册中心](files/10106_nacos注册中心.md?t=1561970396933) + * [快速体验](files/10010_快速体验.md?t=1561975674073) + * [项目接入到SOP](files/10011_项目接入到SOP.md?t=1561975674089) + * [新增接口](files/10020_新增接口.md?t=1561975674089) + * [业务参数校验](files/10030_业务参数校验.md?t=1561975674090) + * [错误处理](files/10040_错误处理.md?t=1561975674090) + * [编写文档](files/10041_编写文档.md?t=1561975674090) + * [接口交互详解](files/10050_接口交互详解.md?t=1561975674090) + * [easyopen支持](files/10070_easyopen支持.md?t=1561975674090) + * [使用签名校验工具](files/10080_使用签名校验工具.md?t=1561975674090) + * [ISV管理](files/10085_ISV管理.md?t=1561975674090) + * [自定义路由](files/10086_自定义路由.md?t=1561975674090) + * [路由授权](files/10090_路由授权.md?t=1561975674090) + * [接口限流](files/10092_接口限流.md?t=1561975674090) + * [监控日志](files/10093_监控日志.md?t=1561975674091) + * [SDK开发](files/10095_SDK开发.md?t=1561975674091) + * [使用SpringCloudGateway](files/10096_使用SpringCloudGateway.md?t=1561975674091) + * [应用授权](files/10097_应用授权.md?t=1561975674091) + * [更改数据节点名称](files/10099_更改数据节点名称.md?t=1561975674091) + * [对接前端](files/10100_对接前端.md?t=1561975674091) + * [自定义过滤器](files/10102_自定义过滤器.md?t=1561975674091) + * [文件上传](files/10104_文件上传.md?t=1561975674091) + * [nacos注册中心](files/10106_nacos注册中心.md?t=1561975674091) + * [扩展其它注册中心](files/10107_扩展其它注册中心.md?t=1561975674091) * 原理分析 - * [原理分析之@ApiMapping](files/90010_原理分析之@ApiMapping.md?t=1561970396933) - * [原理分析之路由存储](files/90011_原理分析之路由存储.md?t=1561970396933) - * [原理分析之如何路由](files/90012_原理分析之如何路由.md?t=1561970396933) - * [原理分析之文档归纳](files/90013_原理分析之文档归纳.md?t=1561970396933) - * [常见问题](files/90100_常见问题.md?t=1561970396933) + * [原理分析之@ApiMapping](files/90010_原理分析之@ApiMapping.md?t=1561975674092) + * [原理分析之路由存储](files/90011_原理分析之路由存储.md?t=1561975674092) + * [原理分析之如何路由](files/90012_原理分析之如何路由.md?t=1561975674092) + * [原理分析之文档归纳](files/90013_原理分析之文档归纳.md?t=1561975674092) + * [常见问题](files/90100_常见问题.md?t=1561975674092) diff --git a/doc/docs/files/10106_nacos注册中心.md b/doc/docs/files/10106_nacos注册中心.md index a06a4f5a..ba28927a 100644 --- a/doc/docs/files/10106_nacos注册中心.md +++ b/doc/docs/files/10106_nacos注册中心.md @@ -1,51 +1,6 @@ # nacos注册中心 -完整代码在`registry-nacos`分支 - -SOP默认使用eureka注册中心,如果要换成nacos注册中心,步骤如下: - -- 实现`com.gitee.sop.registryapi.service.RegistryService`接口 - -1.找到`SOP/sop-common/sop-registry-api`工程,在service.impl包下新建一个类,实现RegistryService接口 - -```java -public class RegistryServiceNacos implements RegistryService { - - @Override - public List listAllService(int pageNo, int pageSize) throws Exception { - // TODO: 返回服务实例 - } - - @Override - public void onlineInstance(ServiceInstance serviceInstance) throws Exception { - // TODO: 实例上线 - } - - @Override - public void offlineInstance(ServiceInstance serviceInstance) throws Exception { - // TODO: 实例下线 - } -} -``` - -2.在`com.gitee.sop.registryapi.config.BaseRegistryConfig`中新增 - -```java -/** - * 当配置了registry.name=nacos生效 - * - * @return - */ -@Bean -@ConditionalOnProperty(prefix = "registry", name = "name", havingValue = "nacos") -RegistryService registryServiceNacos() { - return new RegistryServiceNacos(); -} -``` - -其中`@ConditionalOnProperty(prefix = "registry", name = "name", havingValue = "nacos")` -表示`application.properties`配置了`registry.name=nacos`参数才能生效,registry.name=nacos下文会讲到。 - +使用nacos作为注册中心,步骤如下: - 微服务端修改 @@ -90,15 +45,16 @@ spring: - SOP-admin修改 -修改yml文件,新增nacos服务器地址,`registry.name`填nacos +修改yml文件,设置nacos服务器地址,`registry.name`填nacos ```yaml # 注册中心地址,根据实际情况改,这里只是参数,并不会去注册 registry: - # 使用哪个配置中心,使用eureka,填eureka;使用nacos填nacos - name: nacos eureka-server-addr: http://localhost:1111/eureka/ + # nacos服务器地址 nacos-server-addr: 127.0.0.1:8848 + # 使用eureka,填:eureka,使用nacos填:nacos + name: nacos ``` - website-server修改 @@ -110,4 +66,5 @@ registry: - 参考资料 1.[nacos介绍及安装](https://nacos.io/zh-cn/docs/quick-start.html) + 2.[nacos spring cloud注册发现](https://nacos.io/zh-cn/docs/quick-start-spring-cloud.html) diff --git a/doc/docs/files/10107_扩展其它注册中心.md b/doc/docs/files/10107_扩展其它注册中心.md new file mode 100644 index 00000000..f52d701c --- /dev/null +++ b/doc/docs/files/10107_扩展其它注册中心.md @@ -0,0 +1,112 @@ +# 扩展其它注册中心 + +**注: nacos注册中心已经实现,本篇以nacos为例介绍如何扩展,如果要改成consul,可按照此方式进行修改** + +SOP默认使用eureka注册中心,如果要换成nacos注册中心,步骤如下: + +- 实现`com.gitee.sop.registryapi.service.RegistryService`接口 + +1.找到`SOP/sop-common/sop-registry-api`工程,在service.impl包下新建一个类,实现RegistryService接口 + +```java +public class RegistryServiceNacos implements RegistryService { + + @Override + public List listAllService(int pageNo, int pageSize) throws Exception { + // TODO: 返回服务实例 + } + + @Override + public void onlineInstance(ServiceInstance serviceInstance) throws Exception { + // TODO: 实例上线 + } + + @Override + public void offlineInstance(ServiceInstance serviceInstance) throws Exception { + // TODO: 实例下线 + } +} +``` + +2.在`com.gitee.sop.registryapi.config.BaseRegistryConfig`中新增 + +```java +/** + * 当配置了registry.name=nacos生效 + * + * @return + */ +@Bean +@ConditionalOnProperty(prefix = "registry", name = "name", havingValue = "nacos") +RegistryService registryServiceNacos() { + return new RegistryServiceNacos(); +} +``` + +其中`@ConditionalOnProperty(prefix = "registry", name = "name", havingValue = "nacos")` +表示`application.properties`配置了`registry.name=nacos`参数才能生效,registry.name=nacos下文会讲到。 + + +- 微服务端修改 + +1.修改微服务应用pom.xml,注释eureka服务发现依赖,添加nacos服务发现依赖 + +```xml + + + + + + org.springframework.cloud + spring-cloud-starter-alibaba-nacos-discovery + 0.2.2.RELEASE + + +``` + +2.yml文件新增nacos配置,并注释掉eureka相关配置 + +```yaml +spring: + cloud: + # nacos注册中心,和eureka只能用一个 + nacos: + discovery: + server-addr: 127.0.0.1:8848 +``` + +- 网关修改 + +找到`sop-gateway`工程,步骤同上 + +- SOP-admin修改 + + +修改yml文件,新增nacos服务器地址,`registry.name`填nacos + +```yaml +# 注册中心地址,根据实际情况改,这里只是参数,并不会去注册 +registry: + # 使用eureka,填:eureka,使用nacos填:nacos + name: nacos + eureka-server-addr: http://localhost:1111/eureka/ + nacos-server-addr: 127.0.0.1:8848 +``` + +- website-server修改 + +步骤同`SOP-admin修改` + +- 参考资料 + +1.[nacos介绍及安装](https://nacos.io/zh-cn/docs/quick-start.html) + +2.[nacos spring cloud注册发现](https://nacos.io/zh-cn/docs/quick-start-spring-cloud.html) diff --git a/sop-admin/sop-admin-server/pom.xml b/sop-admin/sop-admin-server/pom.xml index 97c43720..f3e41d94 100644 --- a/sop-admin/sop-admin-server/pom.xml +++ b/sop-admin/sop-admin-server/pom.xml @@ -30,7 +30,7 @@ com.gitee.sop sop-registry-api - 1.11.0-SNAPSHOT + 1.12.0-SNAPSHOT diff --git a/sop-admin/sop-admin-server/src/main/resources/application-dev.yml b/sop-admin/sop-admin-server/src/main/resources/application-dev.yml index 8bed2221..64b56db8 100644 --- a/sop-admin/sop-admin-server/src/main/resources/application-dev.yml +++ b/sop-admin/sop-admin-server/src/main/resources/application-dev.yml @@ -35,8 +35,9 @@ easyopen: # 注册中心地址,根据实际情况改,这里只是参数,并不会去注册 registry: eureka-server-addr: http://localhost:1111/eureka/ + # nacos服务器地址 nacos-server-addr: 127.0.0.1:8848 - # 使用哪个配置中心,使用eureka,填eureka;使用nacos填nacos + # 使用eureka,填:eureka,使用nacos填:nacos name: eureka diff --git a/sop-common/pom.xml b/sop-common/pom.xml index 3a5a7675..627e7d0d 100644 --- a/sop-common/pom.xml +++ b/sop-common/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.gitee.sop sop-common - 1.11.0-SNAPSHOT + 1.12.0-SNAPSHOT pom diff --git a/sop-common/sop-gateway-common/pom.xml b/sop-common/sop-gateway-common/pom.xml index 72958b00..8532ebda 100644 --- a/sop-common/sop-gateway-common/pom.xml +++ b/sop-common/sop-gateway-common/pom.xml @@ -5,11 +5,11 @@ com.gitee.sop sop-common - 1.11.0-SNAPSHOT + 1.12.0-SNAPSHOT ../pom.xml sop-gateway-common - 1.11.0-SNAPSHOT + 1.12.0-SNAPSHOT jar sop-gateway-common diff --git a/sop-common/sop-registry-api/pom.xml b/sop-common/sop-registry-api/pom.xml index 3a46bfea..83bd1dd1 100644 --- a/sop-common/sop-registry-api/pom.xml +++ b/sop-common/sop-registry-api/pom.xml @@ -5,7 +5,7 @@ 4.0.0 com.gitee.sop sop-registry-api - 1.11.0-SNAPSHOT + 1.12.0-SNAPSHOT UTF-8 diff --git a/sop-common/sop-service-common/pom.xml b/sop-common/sop-service-common/pom.xml index 7d94da07..cda7acb7 100644 --- a/sop-common/sop-service-common/pom.xml +++ b/sop-common/sop-service-common/pom.xml @@ -6,11 +6,11 @@ com.gitee.sop sop-common - 1.11.0-SNAPSHOT + 1.12.0-SNAPSHOT ../pom.xml sop-service-common - 1.11.0-SNAPSHOT + 1.12.0-SNAPSHOT jar sop-service-common diff --git a/sop-example/sop-auth/pom.xml b/sop-example/sop-auth/pom.xml index b7252cce..c51520ed 100644 --- a/sop-example/sop-auth/pom.xml +++ b/sop-example/sop-auth/pom.xml @@ -26,7 +26,7 @@ com.gitee.sop sop-service-common - 1.11.0-SNAPSHOT + 1.12.0-SNAPSHOT org.springframework.cloud diff --git a/sop-example/sop-book/sop-book-web/pom.xml b/sop-example/sop-book/sop-book-web/pom.xml index e468ab30..e0443e6b 100644 --- a/sop-example/sop-book/sop-book-web/pom.xml +++ b/sop-example/sop-book/sop-book-web/pom.xml @@ -24,7 +24,7 @@ com.gitee.sop sop-service-common - 1.11.0-SNAPSHOT + 1.12.0-SNAPSHOT com.gitee.sop diff --git a/sop-example/sop-easyopen/pom.xml b/sop-example/sop-easyopen/pom.xml index e7daadb3..f4bd1d23 100644 --- a/sop-example/sop-easyopen/pom.xml +++ b/sop-example/sop-easyopen/pom.xml @@ -29,7 +29,7 @@ com.gitee.sop sop-service-common - 1.11.0-SNAPSHOT + 1.12.0-SNAPSHOT org.springframework.cloud diff --git a/sop-example/sop-springmvc/pom.xml b/sop-example/sop-springmvc/pom.xml index fa52325f..0aea2861 100644 --- a/sop-example/sop-springmvc/pom.xml +++ b/sop-example/sop-springmvc/pom.xml @@ -20,7 +20,7 @@ com.gitee.sop sop-service-common - 1.11.0-SNAPSHOT + 1.12.0-SNAPSHOT diff --git a/sop-example/sop-story/sop-story-web/pom.xml b/sop-example/sop-story/sop-story-web/pom.xml index a38c4620..670cea0d 100644 --- a/sop-example/sop-story/sop-story-web/pom.xml +++ b/sop-example/sop-story/sop-story-web/pom.xml @@ -24,7 +24,7 @@ com.gitee.sop sop-service-common - 1.11.0-SNAPSHOT + 1.12.0-SNAPSHOT com.gitee.sop diff --git a/sop-gateway/pom.xml b/sop-gateway/pom.xml index aa4f3a25..cef66f3a 100644 --- a/sop-gateway/pom.xml +++ b/sop-gateway/pom.xml @@ -23,7 +23,7 @@ com.gitee.sop sop-gateway-common - 1.11.0-SNAPSHOT + 1.12.0-SNAPSHOT diff --git a/sop-website/website-server/pom.xml b/sop-website/website-server/pom.xml index 30464050..2e35282c 100644 --- a/sop-website/website-server/pom.xml +++ b/sop-website/website-server/pom.xml @@ -25,7 +25,7 @@ com.gitee.sop sop-registry-api - 1.11.0-SNAPSHOT + 1.12.0-SNAPSHOT diff --git a/sop-website/website-server/src/main/resources/application-dev.yml b/sop-website/website-server/src/main/resources/application-dev.yml index d6181365..79f736b6 100644 --- a/sop-website/website-server/src/main/resources/application-dev.yml +++ b/sop-website/website-server/src/main/resources/application-dev.yml @@ -3,10 +3,11 @@ server: # 注册中心地址,根据实际情况改,这里只是参数,并不会去注册 registry: - # 使用哪个配置中心,使用eureka,填eureka;使用nacos填nacos - name: nacos eureka-server-addr: http://localhost:1111/eureka/ + # nacos服务器地址 nacos-server-addr: 127.0.0.1:8848 + # 使用eureka,填:eureka,使用nacos填:nacos + name: eureka spring: application: From 7f42b3227ba4c9c175aff65696b4c2fbd26146d5 Mon Sep 17 00:00:00 2001 From: tanghc Date: Mon, 1 Jul 2019 18:25:10 +0800 Subject: [PATCH 4/8] 1.12.0 --- changelog.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/changelog.md b/changelog.md index c7b21f49..89035399 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,10 @@ # changelog +## 1.12.0 + +- admin后台新增角色管理 +- 支持nacos作为注册中心 + ## 1.11.0 - 秘钥管理改造 From a0941c63ed74d172de83ff1f7b03ab9b4f7341d7 Mon Sep 17 00:00:00 2001 From: tanghc Date: Mon, 1 Jul 2019 20:01:27 +0800 Subject: [PATCH 5/8] update --- doc/docs/files/10106_nacos注册中心.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/docs/files/10106_nacos注册中心.md b/doc/docs/files/10106_nacos注册中心.md index ba28927a..bf396475 100644 --- a/doc/docs/files/10106_nacos注册中心.md +++ b/doc/docs/files/10106_nacos注册中心.md @@ -2,9 +2,27 @@ 使用nacos作为注册中心,步骤如下: +- 准备工作 + +1.安装nacos,前往[最新稳定版本](https://github.com/alibaba/nacos/releases),下载最新版nacos + +2.启动nacos服务器,cd nacos/bin + +Linux/Unix/Mac,启动命令(standalone代表着单机模式运行,非集群模式): + +`sh startup.sh -m standalone` + +Windows,启动命令: + +`cmd startup.cmd` + +或者双击startup.cmd运行文件。 + +更多访问:https://nacos.io/zh-cn/docs/quick-start.html + - 微服务端修改 -1.修改微服务应用pom.xml,注释eureka服务发现依赖,添加nacos服务发现依赖 +1.修改微服务应用pom,打开`sop-example/sop-story/sop-story-web/pom.xml`,注释eureka服务发现依赖,添加nacos服务发现依赖 ```xml From f0a0c04581c4ad084b03d279938c6bef1c7ab477 Mon Sep 17 00:00:00 2001 From: tanghc Date: Mon, 1 Jul 2019 20:51:40 +0800 Subject: [PATCH 6/8] 1.12.0 --- .../com/gitee/sop/adminserver/bean/SopAdminConstants.java | 5 ----- .../com/gitee/sop/adminserver/bean/ZookeeperContext.java | 5 ----- .../java/com/gitee/sop/gatewaycommon/bean/SopConstants.java | 5 ----- .../gitee/sop/gatewaycommon/manager/ZookeeperContext.java | 5 ----- 4 files changed, 20 deletions(-) diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/SopAdminConstants.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/SopAdminConstants.java index 9f411a09..958a1977 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/SopAdminConstants.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/SopAdminConstants.java @@ -9,11 +9,6 @@ public class SopAdminConstants { */ public static final String SOP_SERVICE_ROUTE_PATH = "/com.gitee.sop.route"; - /** - * zookeeper存放路由授权信息根目录 - */ - public static final String SOP_ROUTE_PERMISSION_PATH = "/com.gitee.sop.isv.route.permission"; - /** * 消息监听路径 */ diff --git a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/ZookeeperContext.java b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/ZookeeperContext.java index 2f2ae540..c97e585e 100644 --- a/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/ZookeeperContext.java +++ b/sop-admin/sop-admin-server/src/main/java/com/gitee/sop/adminserver/bean/ZookeeperContext.java @@ -20,7 +20,6 @@ import java.util.Collections; import java.util.List; import static com.gitee.sop.adminserver.bean.SopAdminConstants.SOP_MSG_CHANNEL_PATH; -import static com.gitee.sop.adminserver.bean.SopAdminConstants.SOP_ROUTE_PERMISSION_PATH; /** * @author tanghc @@ -77,10 +76,6 @@ public class ZookeeperContext { return serviceIdPath + "/" + routeId; } - public static String getRoutePermissionPath() { - return SOP_ROUTE_PERMISSION_PATH; - } - public static String getIsvInfoChannelPath() { return SOP_MSG_CHANNEL_PATH + "/isvinfo"; } diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/SopConstants.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/SopConstants.java index d97e921a..c0ba6457 100644 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/SopConstants.java +++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/bean/SopConstants.java @@ -45,11 +45,6 @@ public class SopConstants { */ public static final String SOP_SERVICE_ROUTE_PATH = "/com.gitee.sop.route"; - /** - * zookeeper存放路由授权信息根目录 - */ - public static final String SOP_ROUTE_PERMISSION_PATH = "/com.gitee.sop.isv.route.permission"; - /** * 消息监听路径 */ diff --git a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/manager/ZookeeperContext.java b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/manager/ZookeeperContext.java index a72b0621..7507e653 100644 --- a/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/manager/ZookeeperContext.java +++ b/sop-common/sop-gateway-common/src/main/java/com/gitee/sop/gatewaycommon/manager/ZookeeperContext.java @@ -18,7 +18,6 @@ import java.util.List; import java.util.function.Consumer; import static com.gitee.sop.gatewaycommon.bean.SopConstants.SOP_MSG_CHANNEL_PATH; -import static com.gitee.sop.gatewaycommon.bean.SopConstants.SOP_ROUTE_PERMISSION_PATH; import static com.gitee.sop.gatewaycommon.bean.SopConstants.SOP_SERVICE_ROUTE_PATH; /** @@ -60,10 +59,6 @@ public class ZookeeperContext { return SOP_SERVICE_ROUTE_PATH; } - public static String getRoutePermissionPath() { - return SOP_ROUTE_PERMISSION_PATH; - } - public static String getIsvInfoChannelPath() { return SOP_MSG_CHANNEL_PATH + "/isvinfo"; } From 6882ef5415f7d5792da089733b0d87a690d6f9e8 Mon Sep 17 00:00:00 2001 From: tanghc Date: Mon, 1 Jul 2019 20:53:47 +0800 Subject: [PATCH 7/8] 1.12.0 --- .../com/gitee/sop/websiteserver/manager/DocManagerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/manager/DocManagerImpl.java b/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/manager/DocManagerImpl.java index fa3adabb..4837f7a3 100644 --- a/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/manager/DocManagerImpl.java +++ b/sop-website/website-server/src/main/java/com/gitee/sop/websiteserver/manager/DocManagerImpl.java @@ -86,7 +86,7 @@ public class DocManagerImpl implements DocManager { protected void loadDocInfo(ServiceInstance serviceInstance) { String query = this.buildQuery(); - String url = "http://" + serviceInstance.getIpPort() + "/v2/api-docs" + query; + String url = "http://" + serviceInstance.getIp() + ":" + serviceInstance.getPort() + "/v2/api-docs" + query; try { log.info("读取swagger文档,url:{}", url); ResponseEntity entity = restTemplate.getForEntity(url, String.class); From 8cbe2e71d600ee78405a042cca72b3250ca0ed2d Mon Sep 17 00:00:00 2001 From: tanghc Date: Tue, 2 Jul 2019 12:04:58 +0800 Subject: [PATCH 8/8] update --- README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/README.md b/README.md index 16037ee1..da66708a 100644 --- a/README.md +++ b/README.md @@ -45,11 +45,6 @@ SOP封装了开放平台大部分功能包括:签名验证、统一异常处 - 应用授权 - 监控日志 -## 分支说明 - -- develop: 日常开发分支 -- registry-nacos:使用nacos作为注册中心 -- SpringCloudGateway:网关使用spring cloud gateway,仅做体验用,不推荐 ## admin界面预览