This article introduces the rapid deployment of the Spring Cloud Blade microservice platform using Rainbond . Spring Cloud Blade is a microservice architecture upgraded and optimized from commercial-level projects. It is built using core technologies such as Spring Boot 2.7 and Spring Cloud 2021, and fully complies with Alibaba's coding standards. Provides two front-end frameworks based on React and Vue for quickly building an enterprise-level SaaS multi-tenant microservice platform.
About Spring Cloud Blade
- The front-end and back-end separation mode is adopted, and the front-end open source two frameworks: Sword (based on React, Ant Design), Saber (based on Vue, Element-UI)
- The backend adopts the SpringCloud family bucket, and at the same time highly encapsulates its basic components, and open source a framework separately: BladeTool
- BladeTool has been pushed to the Maven central library, which can be imported directly, reducing the bloated project and focusing more on business development
- Integrate Sentinel to protect service stability from multiple dimensions such as flow control, circuit breaker degradation, and system load.
- The registration center and configuration center select Nacos to reduce the size of the project and strengthen the linkage between modules.
- Minimalist encapsulates the bottom layer of multi-tenancy, and uses less code in exchange for a more scalable SaaS multi-tenant system.
- With reference to OAuth2, a multi-terminal authentication system is implemented, and the token permissions of the controllable subsystems are isolated from each other.
- Learn from Security, encapsulate the Secure module, and use JWT for Token authentication, which can expand and integrate fine-grained control schemes such as Redis.
- Project subcontracting is clear, and the development model of microservices is standardized, so that the division of labor between packages is clear.
module description
SpringBlade
├── blade-auth -- 授权服务提供
├── blade-common -- 常用工具封装包
├── blade-gateway -- Spring Cloud 网关
├── blade-ops -- 运维中心
├ ├── blade-admin -- spring-cloud后台管理
├ ├── blade-develop -- 代码生成
├ ├── blade-resource -- 资源管理
├ ├── blade-seata-order -- seata分布式事务demo
├ ├── blade-seata-storage -- seata分布式事务demo
├── blade-service -- 业务模块
├ ├── blade-desk -- 工作台模块
├ ├── blade-log -- 日志模块
├ ├── blade-system -- 系统模块
├ └── blade-user -- 用户模块
├── blade-service-api -- 业务模块api封装
├ ├── blade-desk-api -- 工作台api
├ ├── blade-dict-api -- 字典api
├ ├── blade-system-api -- 系统api
└── └── blade-user-api -- 用户api
Spring Cloud Blade fully deployed service topology diagram
Quickly deploy Spring Cloud Blade based on the application store
Deploy Spring Cloud Blade through the open source application store, search in Platform Management -> Application Market -> Open Source Application Store and install it with one click.SpringBlade
After the deployment is complete, the service topology diagram of the complete deployment of Spring Cloud Blade is shown in the figure above.
Deploy Spring Cloud Blade based on source code
This article is based on the deployment of Spring Cloud Blade v3.5.0 .
1. Deploy Nacos
Deploy through the open source application store Nacos
, search for Nacos单机
and 2.1.2
.
2. Deploy Redis
Deploy through the open source application store Redis
, search for Redis
and 5.0.7
.
3. Deploy Sentinel Dashboard
Deploy through the open source application store Sentinel Dashboard
, search for Sentinel-Dashboard
and 1.8.6
.
Fourth, initialize the database
Nacos
The built- in component installed from the open source application store Mysql
, enter the component -> port -> open external services, and connect through the client tool.
- Create
blade
a database . - Initialize table structure and data: Blade SQL
5. Deploy Blade backend services
1. To create a component based on source code, fill in the following information:
content | |
---|---|
component name | customize |
Component English name | customize |
Warehouse Address | https://gitee.com/smallc/SpringBlade |
Code Version: Tag | v3.5.0 |
2. Detect multi-module construction and enter the multi-module construction page
- Before creating, on the multi-module construction page -> Modify button on the right -> modify the startup command of each module, as follows.
- After creation, delete the default port of each component, add a corresponding new port and port alias for each component, and open the internal service of the port, as follows.
- Build the component after the modification is complete.
components | port | start command |
---|---|---|
blade-auth | 8100 | web: java $JAVA_OPTS -jar blade-auth/target/blade-auth.jar |
blade-gateway | 80 | web: java $JAVA_OPTS -jar blade-gateway/target/blade-gateway.jar |
blade-admin | 7002 | web: java $JAVA_OPTS -jar blade-ops/blade-admin/target/blade-admin.jar |
blade-develop | 7007 | web: java $JAVA_OPTS -jar blade-ops/blade-develop/target/blade-develop.jar |
blade-report | 8108 | web: java $JAVA_OPTS -jar blade-ops/blade-report/target/blade-report.jar |
blade-resource | 8010 | web: java $JAVA_OPTS -jar blade-ops/blade-resource/target/blade-resource.jar |
blade-swagger | 18000 | web: java $JAVA_OPTS -jar blade-ops/blade-swagger/target/blade-swagger.jar |
blade-desk | 8105 | web: java $JAVA_OPTS -jar blade-service/blade-desk/target/blade-desk.jar |
blade-log | 8103 | web: java $JAVA_OPTS -jar blade-service/blade-log/target/blade-log.jar |
blade-system | 8106 | web: java $JAVA_OPTS -jar blade-service/blade-system/target/blade-system.jar |
blade-user | 8102 | web: java $JAVA_OPTS -jar blade-service/blade-user/target/blade-user.jar |
3. Edit dependencies, switch to 编排模式
drag components to establish dependencies.
4. Go to Nacos
Component -> Port -> Open 8848
the external service of the port, access Nacos and log in, default user password nacos/nacos
, and create a configuration file.
Create a blade.yaml
configuration file with the following content:
#服务器配置
server:
undertow:
# 以下的配置会影响buffer,这些buffer会用于服务器连接的IO操作,有点类似netty的池化内存管理
buffer-size: 1024
# 是否分配的直接内存
direct-buffers: true
# 线程配置
threads:
# 设置IO线程数, 它主要执行非阻塞的任务,它们会负责多个连接, 默认设置每个CPU核心一个线程
io: 16
# 阻塞任务线程池, 当执行类似servlet请求阻塞操作, undertow会从这个线程池中取得线程,它的值设置取决于系统的负载
worker: 400
#spring配置
spring:
cloud:
sentinel:
eager: true
devtools:
restart:
log-condition-evaluation-delta: false
livereload:
port: 23333
#feign配置
feign:
sentinel:
enabled: true
okhttp:
enabled: true
httpclient:
enabled: false
#对外暴露端口
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: always
#knife4j配置
knife4j:
#启用
enable: true
#基础认证
basic:
enable: false
username: blade
password: blade
#增强配置
setting:
enableSwaggerModels: true
enableDocumentManage: true
enableHost: false
enableHostText: http://localhost
enableRequestCache: true
enableFilterMultipartApis: false
enableFilterMultipartApiMethodType: POST
language: zh-CN
enableFooter: false
enableFooterCustom: true
footerCustomContent: Copyright © 2022 SpringBlade All Rights Reserved
#swagger配置信息
swagger:
title: SpringBlade 接口文档系统
description: SpringBlade 接口文档系统
version: 3.5.0
license: Powered By SpringBlade
licenseUrl: https://bladex.vip
terms-of-service-url: https://bladex.vip
contact:
name: smallchill
email: [email protected]
url: https://gitee.com/smallc
#blade配置
blade:
token:
sign-key: 请配置32位签名提高安全性
xss:
enabled: true
skip-url:
- /weixin
secure:
skip-url:
- /test/**
client:
- client-id: sword
path-patterns:
- /sword/**
- client-id: saber
path-patterns:
- /saber/**
tenant:
column: tenant_id
tables:
- blade_notice
Create a blade-dev.yaml
configuration file with the following content:
#spring配置
spring:
redis:
##redis 单机环境配置
host: 127.0.0.1
port: 6379
password:
database: 0
ssl: false
#项目模块集中配置
blade:
#通用开发生产环境数据库地址(特殊情况可在对应的子工程里配置覆盖)
datasource:
dev:
url: jdbc:mysql://127.0.0.1:3306/blade?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8
username: root
password: root
Update or restart all components Nacos
Mysql
Redis
Sentinel Dashboard
except .
6. Deploy the Blade front-end Saber
- To create a component based on source code, fill in the following information:
content | |
---|---|
component name | customize |
Component English name | customize |
Warehouse Address | https://gitee.com/zhangbigqi/Saber.git |
code version | v3.5.0 |
- Go to
Saber
Components -> Ports -> Delete the default port, add a new8080
port and open the external service. - Edit dependencies, switch to
编排模式
drag components to build dependencies, andSaber
update the components.blade-gateway
- Access
Saber UI
and .
After the deployment is complete, the service topology diagram of the complete deployment of Spring Cloud Blade is shown in the figure above.