diff --git a/sop-admin/sop-admin-server/src/main/resources/application-dev.properties b/sop-admin/sop-admin-server/src/main/resources/application-dev.properties new file mode 100644 index 00000000..68597209 --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/resources/application-dev.properties @@ -0,0 +1,53 @@ +server.port=8082 +spring.application.name=sop-admin + +# ------- 需要改的配置 ------- +# mysql数据库账号 +mysql.username=root +mysql.password=root + +# eureka注册中心地址 +eureka.url=http://localhost:1111/eureka/ +# nacos注册中心地址 +nacos.url=127.0.0.1:8848 +# zookeeper地址 +zookeeper.url=localhost:2181 +# zipkin服务监控地址,没有开启不用改 +zipkin.url=http://127.0.0.1:9411/ +# ------- 需要改的配置end ------- + +######### 下面的配置基本不用改 ######### + +# token过期时间,分钟 +admin.access-token.timeout-minutes=30 +# 签名方式,rsa:支付宝开放平台签名方式,md5:淘宝开放平台签名方式 +sop.sign-type=rsa + +# zookeeper配置 +spring.cloud.zookeeper.connect-string=${zookeeper.url} +spring.cloud.zookeeper.baseSleepTimeMs=3000 +spring.cloud.zookeeper.maxRetries=3 + +spring.datasource.driver-class-name=com.mysql.jdbc.Driver +spring.datasource.url=jdbc:mysql://localhost:3306/sop?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull +spring.datasource.username=${mysql.username} +spring.datasource.password=${mysql.password} + +# 固定不用改 +easyopen.show-doc=false +easyopen.ignore-validate=true + +# 注册中心地址,根据实际情况改,这里只是参数,并不会去注册 +registry.eureka-server-addr=${eureka.url} +registry.nacos-server-addr=${nacos.url} +# 使用eureka,填:eureka,使用nacos填:nacos +registry.name=eureka + +logging.level.com.gitee=debug + +# 不用改 +mybatis.fill.com.gitee.fastmybatis.core.support.DateFillInsert=gmt_create +mybatis.fill.com.gitee.fastmybatis.core.support.DateFillUpdate=gmt_modified + +# 不用改,如果要改,请全局替换修改 +zuul.secret=MZZOUSTua6LzApIWXCwEgbBmxSzpzC diff --git a/sop-admin/sop-admin-server/src/main/resources/application.properties b/sop-admin/sop-admin-server/src/main/resources/application.properties new file mode 100644 index 00000000..257b3064 --- /dev/null +++ b/sop-admin/sop-admin-server/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.profiles.active=dev \ No newline at end of file diff --git a/sop-example/sop-book/sop-book-web/src/main/java/com/gitee/sop/bookweb/controller/DubboConsumerController.java b/sop-example/sop-book/sop-book-web/src/main/java/com/gitee/sop/bookweb/controller/DubboConsumerController.java index e75eefff..431c0a81 100644 --- a/sop-example/sop-book/sop-book-web/src/main/java/com/gitee/sop/bookweb/controller/DubboConsumerController.java +++ b/sop-example/sop-book/sop-book-web/src/main/java/com/gitee/sop/bookweb/controller/DubboConsumerController.java @@ -6,6 +6,7 @@ import com.gitee.sop.story.api.domain.Story; import com.gitee.sop.story.api.param.DemoParam; import com.gitee.sop.story.api.result.DemoResult; import com.gitee.sop.story.api.service.DemoService; +import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.RestController; /** @@ -17,16 +18,16 @@ import org.springframework.web.bind.annotation.RestController; * Feign的使用方式参见:com.gitee.sop.bookweb.controller.AlipayBookController#getBook2() */ @RestController +@Slf4j public class DubboConsumerController { - @Reference(version = "${demo.service.version}", - application = "${dubbo.application.id}", - url = "dubbo://localhost:12345") + @Reference(version = "1.0.0", url = "dubbo://127.0.0.1:12345") private DemoService demoService; // 作为开放接口 @ApiMapping(value = "dubbo.story.get") public Story openApi(DemoParam demoParam) { + log.info("dubbo consumer, param: {}", demoParam); // 通过dubbo调用story提供的服务 DemoResult dubboStory = demoService.getStory(demoParam); Story story = new Story(); diff --git a/sop-example/sop-book/sop-book-web/src/main/resources/application-dev.properties b/sop-example/sop-book/sop-book-web/src/main/resources/application-dev.properties new file mode 100644 index 00000000..6d7402c9 --- /dev/null +++ b/sop-example/sop-book/sop-book-web/src/main/resources/application-dev.properties @@ -0,0 +1,19 @@ +server.port=3333 +spring.application.name=book-service +spring.application.description=book服务 + +# eureka注册中心,如果使用nacos注册中心,这里要注释掉 +eureka.client.serviceUrl.defaultZone=http://localhost:1111/eureka/ +# nacos注册中心 +# spring.nacos.discovery.server-addr=127.0.0.1:8848 + +# zookeeper配置 +spring.cloud.zookeeper.connect-string=localhost:2181 + +# zipkin服务跟踪 +spring.zipkin.base-url=http://127.0.0.1:9411/ +# 设置sleuth收集信息的比率,默认0.1,最大是1,数字越大越耗性能 +spring.sleuth.sampler.probability=1 +# dubbo使用zipkin过滤器 +dubbo.provider.filter=tracing +dubbo.consumer.filter=tracing diff --git a/sop-example/sop-book/sop-book-web/src/main/resources/application.properties b/sop-example/sop-book/sop-book-web/src/main/resources/application.properties new file mode 100644 index 00000000..257b3064 --- /dev/null +++ b/sop-example/sop-book/sop-book-web/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.profiles.active=dev \ No newline at end of file diff --git a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/AlipayController.java b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/AlipayController.java index 10930107..835f9db7 100644 --- a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/AlipayController.java +++ b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/controller/AlipayController.java @@ -8,6 +8,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiOperation; import lombok.Data; +import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -21,6 +22,7 @@ import java.util.Date; * @author tanghc */ @RestController +@Slf4j @Api(tags = "故事接口") public class AlipayController { @@ -101,7 +103,7 @@ public class AlipayController { @ApiOperation(value = "获取故事信息", notes = "说明接口的详细信息,介绍,用途,注意事项等。") @ApiMapping(value = "alipay.story.find") public StoryVO getStory2(StoryParam story, HttpServletRequest request) { - System.out.println(story); + log.info("获取故事信息参数, story: {}", story); // 获取其它参数 System.out.println(request.getParameter("app_id")); StoryVO storyVO = new StoryVO(); diff --git a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/service/DefaultDemoService.java b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/service/DefaultDemoService.java index e9596e8a..2929f9ed 100644 --- a/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/service/DefaultDemoService.java +++ b/sop-example/sop-story/sop-story-web/src/main/java/com/gitee/sop/storyweb/service/DefaultDemoService.java @@ -4,9 +4,11 @@ import com.alibaba.dubbo.config.annotation.Service; import com.gitee.sop.story.api.param.DemoParam; import com.gitee.sop.story.api.result.DemoResult; import com.gitee.sop.story.api.service.DemoService; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; @Service(version = "1.0.0") +@Slf4j public class DefaultDemoService implements DemoService { /** @@ -21,6 +23,7 @@ public class DefaultDemoService implements DemoService { @Override public DemoResult getStory(DemoParam param) { + log.info("dubbo provider, param: {}", param); DemoResult demoResult = new DemoResult(); demoResult.setId(param.getId()); demoResult.setName("dubbo 白雪公主, param=" + param); diff --git a/sop-example/sop-story/sop-story-web/src/main/resources/application-dev.properties b/sop-example/sop-story/sop-story-web/src/main/resources/application-dev.properties new file mode 100644 index 00000000..67aa5e68 --- /dev/null +++ b/sop-example/sop-story/sop-story-web/src/main/resources/application-dev.properties @@ -0,0 +1,25 @@ +server.port=2222 +spring.application.name=story-service +spring.application.description=story服务 + +# eureka注册中心,如果使用nacos注册中心,这里要注释掉 +eureka.client.serviceUrl.defaultZone=http://localhost:1111/eureka/ +# nacos注册中心 +# spring.nacos.discovery.server-addr=127.0.0.1:8848 + +# zookeeper配置 +spring.cloud.zookeeper.connect-string=localhost:2181 + +# dubbo配置 +dubbo.protocol.name=dubbo +dubbo.protocol.port=12345 +dubbo.registry.address=N/A +dubbo.scan.base-packages=com.gitee.sop.storyweb.service + +# zipkin服务跟踪 +spring.zipkin.base-url=http://127.0.0.1:9411/ +# 设置sleuth收集信息的比率,默认0.1,最大是1,数字越大越耗性能 +spring.sleuth.sampler.probability=1 +# dubbo使用zipkin过滤器 +dubbo.provider.filter=tracing +dubbo.consumer.filter=tracing diff --git a/sop-example/sop-story/sop-story-web/src/main/resources/application.properties b/sop-example/sop-story/sop-story-web/src/main/resources/application.properties new file mode 100644 index 00000000..257b3064 --- /dev/null +++ b/sop-example/sop-story/sop-story-web/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.profiles.active=dev \ No newline at end of file diff --git a/sop-gateway/src/main/resources/application-dev.properties b/sop-gateway/src/main/resources/application-dev.properties new file mode 100644 index 00000000..fbaf6c9d --- /dev/null +++ b/sop-gateway/src/main/resources/application-dev.properties @@ -0,0 +1,52 @@ +server.port=8081 + +# ------- 需要改的配置 ------- +# mysql数据库账号 +mysql.username=root +mysql.password=root + +# eureka注册中心地址 +eureka.url=http://localhost:1111/eureka/ +# zookeeper地址 +zookeeper.url=localhost:2181 +# zipkin服务监控地址,没有开启不用改 +zipkin.url=http://127.0.0.1:9411/ +# ------- 需要改的配置end ------- + +######### 下面的配置基本不用改 ######### + +spring.application.name=api-gateway +# 入口地址,不用改,默认是/zuul +zuul.servlet-path=/api +# 禁用默认的过滤器,不能删,不用改 +zuul.FormBodyWrapperFilter.pre.disable=true +zuul.Servlet30WrapperFilter.pre.disable=true +# 不用改,如果要改,请全局替换修改 +zuul.secret=MZZOUSTua6LzApIWXCwEgbBmxSzpzC + +# https://blog.csdn.net/qq_36872046/article/details/81058045 +# 路由转发超时时间,毫秒,默认值1000,详见:RibbonClientConfiguration.DEFAULT_READ_TIMEOUT。 +# 如果微服务端 处理时间过长,会导致ribbon read超时,解决办法将这个值调大一点 +ribbon.ReadTimeout=2000 +# 设置为true(默认false),则所有请求都重试,默认只支持get请求重试 +# 请谨慎设置,因为post请求大多都是写入请求,如果要支持重试,确保服务的幂等性 +ribbon.OkToRetryOnAllOperations=false + +eureka.client.serviceUrl.defaultZone=${eureka.url} +spring.cloud.zookeeper.connect-string=${zookeeper.url} +#spring.cloud.gateway.discovery.locator.lower-case-service-id=true +#spring.cloud.gateway.discovery.locator.enabled=true +spring.datasource.driver-class-name=com.mysql.jdbc.Driver +spring.datasource.url=jdbc:mysql://localhost:3306/sop?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull +spring.datasource.username=${mysql.username} +spring.datasource.password=${mysql.password} + +# 文件上传配置 +spring.servlet.multipart.enabled=true +spring.servlet.multipart.max-file-size=20MB +spring.servlet.multipart.max-request-size=20MB + +# zipkin服务跟踪 +spring.zipkin.base-url=${zipkin.url} +# 设置sleuth收集信息的比率,默认0.1,最大是1,数字越大越耗性能 +spring.sleuth.sampler.probability=1 diff --git a/sop-gateway/src/main/resources/application.properties b/sop-gateway/src/main/resources/application.properties new file mode 100644 index 00000000..257b3064 --- /dev/null +++ b/sop-gateway/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.profiles.active=dev \ No newline at end of file diff --git a/sop-registry/src/main/resources/application-dev.properties b/sop-registry/src/main/resources/application-dev.properties new file mode 100644 index 00000000..5a62ba39 --- /dev/null +++ b/sop-registry/src/main/resources/application-dev.properties @@ -0,0 +1,14 @@ +server.port=1111 +spring.application.name=sop-registry + +# ------- 需要改的配置 ------- + +# eureka注册中心地址 +eureka.url=http://localhost:1111/eureka/ +# ------- 需要改的配置end ------- + +######### 下面的配置基本不用改 ######### + +eureka.client.fetch-registry=false +eureka.client.register-with-eureka=false +eureka.client.serviceUrl.defaultZone=${eureka.url} diff --git a/sop-registry/src/main/resources/application.properties b/sop-registry/src/main/resources/application.properties new file mode 100644 index 00000000..257b3064 --- /dev/null +++ b/sop-registry/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.profiles.active=dev \ No newline at end of file diff --git a/sop-website/website-server/src/main/resources/application-dev.properties b/sop-website/website-server/src/main/resources/application-dev.properties new file mode 100644 index 00000000..4fa2eedf --- /dev/null +++ b/sop-website/website-server/src/main/resources/application-dev.properties @@ -0,0 +1,30 @@ +server.port=8083 +spring.application.name=website-server + +# ------- 需要改的配置 ------- + +# eureka注册中心地址 +eureka.url=http://localhost:1111/eureka/ +# zookeeper地址 +zookeeper.url=localhost:2181 +# nacos地址 +nacos.url=127.0.0.1:8848 + +# ------- 需要改的配置end ------- + +# 注册中心地址,根据实际情况改,这里只是参数,并不会去注册 +registry.eureka-server-addr=${eureka.url} +# nacos服务器地址 +registry.nacos-server-addr=${nacos.url} +# 使用eureka,填:eureka,使用nacos填:nacos +registry.name=eureka + +spring.cloud.zookeeper.connect-string=${zookeeper.url} + +# 测试环境 +api.url-test=http://api-test.yourdomain.com/api +# 沙箱环境 +api.url-sandbox=http://localhost:8081/api +# 正式环境 +api.url-prod=http://open.yourdomain.com/api +api.pwd=doc#123 diff --git a/sop-website/website-server/src/main/resources/application.properties b/sop-website/website-server/src/main/resources/application.properties new file mode 100644 index 00000000..257b3064 --- /dev/null +++ b/sop-website/website-server/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.profiles.active=dev \ No newline at end of file