项目开发步骤(Windows)
基础平台
MySQL(必需)
Windows安装
- 下载MySQL 8安装程序
- 按照默认配置安装完成
Linux安装
- 下载MySQL 8安装程序
- 执行以下命令安装MySQL
tar xf mysql-*.rpm-bundle.tar
sudo yum install -y mysql-community-{server,client,common,libs}-*
- 获取root用户临时密码
sudo grep 'temporary password' /var/log/mysqld.log
输出消息包括如A temporary password is generated for root@localhost: 3i>(qm<(g2=W,则临时密码为3i>(qm<(g2=W
- 使用root用户登录,输入临时密码
mysql -uroot -p
- 修改root用户密码
ALTER USER 'root'@'localhost' IDENTIFIED BY 'CES1@corilead';
新建数据库和用户
- 登录MySQL控制台
mysql -u root -p
- 创建数据库twins 和数据库用户twinsadmin,并授予数据库用户权限
CREATE DATABASE twins DEFAULT CHARACTER SET utf8mb4;
CREATE USER 'twinsadmin'@'%' IDENTIFIED BY 'ECS1@corilead';
GRANT ALL PRIVILEGES ON twins.* TO 'twinsadmin'@'%';
- 保存以上信息,后续步骤将使用。
MySQL
Elasticsearch(可选)
Zeebe(可选)
MinIO(可选)
Nginx(必需)
java
/usr/java/jdk1.8.0_331-amd64/
Nacos(必需)
- 下载并解压[Nacos](https://github.com/alibaba/nacos/releases/download/2.0.4/nacos-server-2.0.4.zip)
- 启动Nacos
cd bin # Linux启动 sh startup.sh -m standalone # Windows启动 startup.cmd -m standalone
- 登录Nacos控制[http://localhost:8848/nacos],默认用户名和密码均为
nacos - 新建配置文件
shared-config.properties,并根据实际情况修改MySQL的连接字符串、用户名、密码,Elasticsearch的主机、用户名、密码,RbbitMQ的主机、用户名、密码,Redis的主机、密码
-
- Data ID: shared-config.properties
- Group: DEFAULT_GROUP
- 配置格式:Properties
- 配置内容:
# Data Source
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/corilead?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC&allowPublicKeyRe
trieval=true
#配置时把&改成&&可以通过,否则报URl解析失败
[spring.datasource.url=jdbc:mysql://49.4.122.244:3306/twins?useUnicode=true&&characterEncoding=utf8&&useSSL=false&&serverTimezone=UTC&&allowPublicKeyRetrieval=true]
spring.datasource.username=dbadmin
spring.datasource.password=dbadmin
# JPA
spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect
spring.jpa.open-in-view=false
spring.jpa.generate-ddl=true
# ElasticSearch
spring.elasticsearch.rest.uris=http://localhost:9200
# spring.elasticsearch.rest.username=user
# spring.elasticsearch.rest.password=secret
# RabbitMQ
spring.rabbitmq.addresses=amqp://localhost:5672
spring.rabbitmq.username=<username>
spring.rabbitmq.password=<password>
# REDIS
spring.redis.url=redis://user:password@localhost:6379
- 新建配置文件
resource-server.properties
-
- Data ID: resource-server.properties
- Group: DEFAULT_GROUP
- 配置格式: Properties
- 配置内容:
spring.security.oauth2.resourceserver.jwt.issuer-uri=http://localhost:8999/uaa
spring.cloud.stream.default-binder=rabbit
dubbo.registry.address=nacos://localhost:8848?namespace=dubbo
dubbo.application.name=${spring.application.name}-dubbo
dubbo.protocol.name=dubbo
dubbo.protocol.port=0
springdoc.swagger-ui.oauth.clientId=gateway
springdoc.swagger-ui.oauth.clientSecret=secret
application.openapi.oauth2.authorization-url=http://localhost:8999/uaa/oauth2/authorize
application.openapi.oauth2.token-url=http://localhost:8999/uaa/oauth2/token
- 新建配置文件
authorization-server.properties
-
- Data ID: authorization-server.properties
- Group: DEFAULT_GROUP
- 配置格式: Properties
- 配置内容:
spring.session.store-type=jdbc
application.auth.oauth2-issuer=http://localhost:8999/uaa
- 新建配置文件
gateway-server.properties
-
- Data ID: gateway-server.properties
- Group: DEFAULT_GROUP
- 配置格式: Properties
- 配置内容:
spring.security.oauth2.client.registration.uaa.authorization-grant-type=authorization_code
spring.security.oauth2.client.registration.uaa.client-id=gateway
spring.security.oauth2.client.registration.uaa.client-secret=secret
spring.security.oauth2.client.registration.uaa.client-authentication-method=basic
spring.security.oauth2.client.registration.uaa.client-name=UAA
spring.security.oauth2.client.registration.uaa.provider=uaa
spring.security.oauth2.client.registration.uaa.redirect-uri={baseUrl}/login/oauth2/code/{registrationId}
spring.security.oauth2.client.registration.uaa.scope=app
spring.security.oauth2.client.provider.uaa.authorization-uri=http://localhost:8999/uaa/oauth2/authorize
spring.security.oauth2.client.provider.uaa.token-uri=http://localhost:8999/uaa/oauth2/token
spring.security.oauth2.client.provider.uaa.user-info-uri=http://localhost:8999/uaa/api/user
spring.security.oauth2.client.provider.uaa.jwk-set-uri=http://localhost:8999/uaa/.well-known/jwks.json
spring.security.oauth2.client.provider.uaa.user-name-attribute=id
- 新建配置文件
gateway-routes.yml
-
- Data ID: gateway-routes.yml
- Group: DEFAULT_GROUP
- 配置格式: YAML
- 配置内容:
spring:
cloud:
gateway:
discovery:
locator:
enabled: true
lower-case-service-id: true
filters:
- TokenRelay=
- StripPrefix=1
routes:
- id: uaa
uri: http://localhost:8999/uaa
predicates:
- Path=/uaa
- id: console-service
uri: lb://console-service
predicates:
- Path=/api/v2/console/**
filters:
- TokenRelay=
- StripPrefix=3
- id: workflow-service
uri: lb://workflow-service
predicates:
- Path=/api/v2/workflow/**
filters:
- TokenRelay=
- StripPrefix=3
- id: search-service
uri: lb://search-service
predicates:
- Path=/api/v2/search/**
filters:
- TokenRelay=
- StripPrefix=3
- id: oss-service
uri: lb://oss-service
predicates:
- Path=/api/v2/oss/**
filters:
- TokenRelay=
- StripPrefix=3
认证服务(必需)
- 下载认证服务[authorization-server]()
- 启动认证服务
# Windows启动
java -jar authorization-server.jar
# Linux启动
nohup java -jar authorization-server.jar &
创建表:
nohup java -jar -Dspring.liquibase.enabled=true -jar authorization-server.jar &
网关服务(必需)
- 下载网关服务[gateway-server]()
- 启动网关服务
# Windows启动
java -jar gateway-server.jar
# Linux启动
nohup java -jar gateway-server.jar &
系统控制台(必需)
- 下载系统控制台服务[paas-console]()
- 启动系统控制台服务
# Windows启动 java -jar paas-console.jar # Linux启动 nohup java -jar paas-console.jar &
应用地址
系统控制台 http://49.4.122.244/plm/app/system-console
租户控制台 http://49.4.122.244/plm/app/tenant-console
http://117.78.33.254/plm/app/wms
项目开发
开发环境
后端开发
- 新建Spring Boot工程
- 修改pom.xml文件
-
- 定义微服务应用父依赖
<parent>
<groupId>com.corilead</groupId>
<artifactId>paas-parent</artifactId>
<version>3.1.0-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
-
- 增加微服务应用运行依赖
<dependency>
<groupId>com.corilead</groupId>
<artifactId>paas-starter-microservice</artifactId>
</dependency>
- 新建src/main/resources/bootstrap.yml文件,根据实际情况修改
spring.application.name参数值
server:
port: ${random.int(19001,19999)}
spring:
application:
name: spring-boot-application
cloud:
nacos:
server-addr: ${NACOS_SERVER:localhost:8848}
config:
shared-configs:
- data-id: shared-config.properties
refresh: true
extension-configs:
- data-id: resource-server.properties
refresh: true
dubbo:
registry:
address: ${NACOS_SERVER:localhost:8848}?username=${NACOS_USERNAME:nacos}&password=${NACOS_PASSWORD:nacos}&namespace=dubbo
application:
name: ${spring.application.name}-dubbo
register-mode: instance
protocol:
port: -1
前端开发
- 新建
Ant Design Pro项目 - 修改配置文件
config/config.ts
export default {
base: '/plm/app/wms/',
publicPath: '/plm/static/wms/',
outputPath: 'dist/wms',
};
- 修改配置文件
package.json
前后端联调
项目部署
后端部署
前端部署
验证测试
- 通过浏览器访问应用前端(http://localhost/plm/app/xxx)
3885

被折叠的 条评论
为什么被折叠?



