Cloud native 与 Spring Cloud 最佳实践

Cloud native 与 Spring Cloud 最佳实践_简介

环境依赖
  1. OpenJDK 11
  2. Eclipse(STS 4.12+) 或 Intellij IDEA 2020.3.2+
  3. Docker Desktop 4.0+ 或 Podman 3.3+
  4. Postgres 12.8
  5. Spring Boot 2.5.5
  6. Spring Cloud 2020.0.4
  7. OpenShift (本地 4.8.5/CRC 1.32.1, 线上 4.8.11)

微服务模块
架构图
本地开发最佳实践
  1. 进入 xxxCloud 根目录, docker-compose up -d postgres 启动 postgres
  2. 启动 gateway 服务 (required)
  3. 启动 user api (required)
  4. 启动 product-compose api (optional)
  5. 启动 product api (optional,按需启动)
  6. 启动 review api (optional,按需启动)
  7. 进入到 xxxAdmin 项目, yarn dev 启动前端
Commit Lint 规范

commit message 的标准格式:

type(scope?): subject
scope is optional; multiple scopes are supported (current delimiter options: "/", "\" and ",")

示例:

"fix(scope): your commit message"
"chore: run tests on travis ci"
"fix(server): send cors headers"
"feat(blog): add comment section"

type:

build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test, wip

Build
$ mvn -B clean install -DskipTests=true -pl common
-> ~\.m2\repository\com\ibm\jrecloud\common\1.0.0\common-1.0.0.jar

$ mvn -B clean package -DskipTests=true -pl spring-cloud/gateway
-> <PROJECT_ROOT>\spring-cloud\gateway\target\gateway-1.0.0.jar

$ mvn -B clean package -DskipTests=true -pl microservices/product-api
-> <PROJECT_ROOT>\microservices\product-api\target\product-api-1.0.0.jar

$ mvn -B clean package -DskipTests=true -pl microservices/product-composite-api
-> <PROJECT_ROOT>\microservices\product-api\target\product-composite-api-1.0.0.jar

$ mvn -B clean package -DskipTests=true -pl microservices/review-api
-> <PROJECT_ROOT>\microservices\review-api\target\review-api-1.0.0.jar

$ mvn -B clean package -DskipTests=true -pl microservices/user-api
-> <PROJECT_ROOT>\microservices\user-api\user\user-api-1.0.0.jar