CPDM平台部署

项目开发步骤(Windows)

基础平台

MySQL(必需)

Windows安装

  1. 下载MySQL 8安装程序
  2. 按照默认配置安装完成

Linux安装

  1. 下载MySQL 8安装程序
  2. 执行以下命令安装MySQL
tar xf mysql-*.rpm-bundle.tar
sudo yum install -y mysql-community-{server,client,common,libs}-*
  1. 获取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

  1. 使用root用户登录,输入临时密码
mysql -uroot -p 
  1. 修改root用户密码
ALTER  USER  'root'@'localhost'  IDENTIFIED  BY  'CES1@corilead';

新建数据库和用户

  1. 登录MySQL控制台
mysql -u root -p

  1. 创建数据库twins 和数据库用户twinsadmin,并授予数据库用户权限
CREATE DATABASE twins DEFAULT CHARACTER SET utf8mb4;
CREATE USER 'twinsadmin'@'%' IDENTIFIED BY 'ECS1@corilead';
GRANT ALL PRIVILEGES ON twins.* TO 'twinsadmin'@'%';
  1. 保存以上信息,后续步骤将使用。

MySQL

Elasticsearch(可选)

Zeebe(可选)

MinIO(可选)

Nginx(必需)

java

/usr/java/jdk1.8.0_331-amd64/

Nacos(必需)

  1. 下载并解压[Nacos](https://github.com/alibaba/nacos/releases/download/2.0.4/nacos-server-2.0.4.zip)
  2. 启动Nacos
cd bin

# Linux启动
sh startup.sh -m standalone

# Windows启动
startup.cmd -m standalone
  1. 登录Nacos控制[http://localhost:8848/nacos],默认用户名和密码均为nacos
  2. 新建配置文件shared-config.properties,并根据实际情况修改MySQL的连接字符串、用户名、密码,Elasticsearch的主机、用户名、密码,RbbitMQ的主机、用户名、密码,Redis的主机、密码
    1. Data ID: shared-config.properties
    2. Group: DEFAULT_GROUP
    3. 配置格式:Properties
    4. 配置内容:
# 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
  1. 新建配置文件resource-server.properties
    1. Data ID: resource-server.properties
    2. Group: DEFAULT_GROUP
    3. 配置格式: Properties
    4. 配置内容:
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
  1. 新建配置文件authorization-server.properties
    1. Data ID: authorization-server.properties
    2. Group: DEFAULT_GROUP
    3. 配置格式: Properties
    4. 配置内容:
spring.session.store-type=jdbc

application.auth.oauth2-issuer=http://localhost:8999/uaa
  1. 新建配置文件gateway-server.properties
    1. Data ID: gateway-server.properties
    2. Group: DEFAULT_GROUP
    3. 配置格式: Properties
    4. 配置内容:
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
  1. 新建配置文件gateway-routes.yml
    1. Data ID: gateway-routes.yml
    2. Group: DEFAULT_GROUP
    3. 配置格式: YAML
    4. 配置内容:
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

项目开发

开发环境

后端开发

  1. 新建Spring Boot工程
  2. 修改pom.xml文件
    1. 定义微服务应用父依赖
<parent>
  <groupId>com.corilead</groupId>
  <artifactId>paas-parent</artifactId>
  <version>3.1.0-SNAPSHOT</version>
  <relativePath/> <!-- lookup parent from repository -->
</parent>
    1. 增加微服务应用运行依赖
<dependency>
  <groupId>com.corilead</groupId>
  <artifactId>paas-starter-microservice</artifactId>
</dependency>
  1. 新建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

前端开发

  1. 新建Ant Design Pro项目
  2. 修改配置文件config/config.ts
export default {
  base: '/plm/app/wms/',
  publicPath: '/plm/static/wms/',
  outputPath: 'dist/wms',
};
  1. 修改配置文件package.json

前后端联调

项目部署

后端部署

前端部署

验证测试

  • 通过浏览器访问应用前端(http://localhost/plm/app/xxx)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值