# 平台环境部署
# 概述
该部署文档主要针对开发、测试两种研发环境的部署说明。UAT环境或者生产环境请移步生产环境部署
# 部署前准备
平台基础服务应用只需要一台linux系统部署,涉及到的中间件视业务使用情况需要一到三台服务器。
# 最低配置
系统 | 必选 | 内存 | 存盘 | 中间件 | 作用 |
---|---|---|---|---|---|
centos7.6 | 是 | 16GB | 500G | 应用 | 功能区 |
centos7.6 | 是 | 16GB | 500G | mysql、redis、nacos、nginx | 必装中间件 |
# 普通配置
系统 | 必选 | 内存 | 存盘 | 中间件 | 作用 |
---|---|---|---|---|---|
centos7.6 | 是 | 32GB | 500G | 应用 | 功能区 |
centos7.6 | 是 | 16GB | 500G | mysql | 数据库 |
centos7.6 | 是 | 16GB | 500G | redis、nacos、nginx | 必装中间件 |
# 高可用配置
系统 | 必选 | 内存 | 存盘 | 中间件 | 作用 |
---|---|---|---|---|---|
centos7.6 * 2 | 是 | 32GB | 500G | 应用 | 功能区 |
centos7.6 * 2 | 是 | 16GB | 1T | mysql | 数据库 |
centos7.6 * 3 | 是 | 16GB | 500G | redis、nacos、nginx | 必装中间件 |
# 扩展配置
- 非必选,视业务情况自行选择
系统 | 必选 | 内存 | 存盘 | 中间件 | 作用 |
---|---|---|---|---|---|
centos7.6 | 否 | 64G | 1T | fastdfs、预览服务、在线编辑服务 | 业务选装 |
centos7.6 | 否 | 64G | 500G | jenkins、nodejs、maven、git、GrayLog | DevOps工具 |
# 防火墙开放端口
- 中间件服务端口自行指定,以下为默认端口
服务 | 端口 |
---|---|
mysql | 3306 |
nacos | 8848 |
redis | 6379 |
fastdfs | 22122/22123 |
nginx | 80 |
网关 | 10000 |
技术中心 | 10010 |
系统管理 | 10020 |
认证中心 | 10030 |
集成管理 | 10040 |
demo服务 | 10050 |
文件服务 | 10060 |
门户服务 | 10070 |
流程服务 | 10080 |
流程引擎 | 10090 |
消息中心 | 10100 |
系统版本centos7官网下载 (opens new window),推荐安装7.6.1810版本
标题中 * 代表必须,没有 * 代表根据业务使用情况选择
# 中间件部署
# * 数据库部署
数据库目前系统维护两套兼容性,SQLServer与Mysql两种数据库。系统中持久层使用MyBatis-plus,理论上兼容常见数据库,具体视情况而定,自行测试可用性即可。
# SQLServer
SQLServer 数据库建议购买正版数据库,自行根据官方文档部署。
# Mysql
Mysql 目前已测试版本为5.7,8.0版本,部署完后根据版本在配置中心适当调整数据库链接参数即可。如下提供docker安装5.7版本教程,酌情选择。
# pull 镜像
docker pull mysql:5.7
# 挂载目录 宿主机 /data/mysql/data 容器 /var/lib/mysql,123456可自行设置合适密码
docker run -d -e MYSQL_ROOT_PASSWORD=123456 --name mysql -v /data/mysql/data:/var/lib/mysql -p 3306:3306 mysql:5.7
# 进入容器内部
docker exec -it 镜像id /bin/bash
# 连接数据库
mysql -u root -p
123456
# 选择数据库 mysql
use mysql;
# 设置root账户
grant all privileges on *.* to root@"%" identified by "123456" with grant option;
# 更新权限
flush privileges;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# * Redis部署
redis版本需要5.0以上,参考docker安装:
docker pull redis:latest
# 创建redis配置目录
mkdir -p /home/redis
# 下载redis.conf
wget http://download.redis.io/redis-stable/redis.conf
# 编辑 redis.conf
vi redis.conf
---------- 配置文件 ----------------
bind 127.0.0.1 #注释掉这部分,这是限制redis只能本地访问
protected-mode no #默认yes,开启保护模式,限制为本地访问
daemonize no #默认no,改为yes意为以守护进程方式启动,可后台运行,除非kill进程(可选),改为yes会使配置文件方式启动redis失败
dir ./ #输入本地redis数据库存放文件夹(可选)
appendonly yes #redis持久化(可选)
---------- 配置文件 ----------------
# 运行 指定密码添加 --requirepass "password"
docker run -p 6379:6379 --name redis -v /home/redis/redis.conf:/etc/redis/redis.conf -v /home/redis/data:/data -d redis redis-server /etc/redis/redis.conf
------------ 启动命令 --------------
-p 6380:6380 端口映射:前表示主机部分,:后表示容器部分。
--name myredis 指定该容器名称,查看和进行操作都比较方便。
-v 挂载目录,规则与端口映射相同。
-d redis 表示后台启动redis
redis-server /etc/redis/redis.conf 以配置文件启动redis,加载容器内的conf文件,最终找到的是挂载的目录/usr/local/docker/redis.conf
appendonly yes 开启redis 持久化
------------ 启动命令 --------------
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# * Nacos部署
自行安装,参考官网 (opens new window)
# * nginx部署
酌情设置系统环境变量,nginx使用教程参考网上资料。
cd /usr/local
# 下载nginx安装包
wget "http://download.glink.glkyun.com/glodon-gosp/tools/nginx/nginx.tar" --http-user=${account} --http-passwd=${password}
# 解压
tar -xvf nginx.tar
2
3
4
5
# Elasticsearch部署
# 安装包下载
# 解压tar包
# 移动安装包到 /usr/local 下
tar -zxvf elasticsearch-7.6.2-linux-x86_64.tar.gz
2
# 配置文件
进入配置文件目录
cd elasticsearch-7.6.2/config/
1编辑一下属性
#集群名 cluster.name: test-elasticsearch #节点名 node.name: es-node1 #数据目录自定义 path.data: /usr/local/elasticsearch-7.6.2/data #日志目录自定义 path.logs: /usr/local/elasticsearch-7.6.2/logs # 所有主机可以访问 network.host: 0.0.0.0 # 服务端口 http.port: 9200 #发现节点配置 cluster.initial_master_nodes: ["es-node1"]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 新建账号
- 创建用户
useradd esuser
- 文件夹赋权
chown -R esuser /usr/local/elasticsearch-7.6.2
chown -R esuser:esuser /usr/local/elasticsearch-7.6.2
2
# 修改limits.conf
# root 账号操作
vi /etc/security/limits.conf
#在文件中添加如下配置
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nprop 4069
2
3
4
5
6
7
# 修改sysctl.conf
# root 账号操作
vi /etc/sysctl.conf
#文件中添加一下配置
vm.max_map_count=262145
#刷新文件
sysctl -p
2
3
4
5
6
# 启动服务
su esuser
cd elasticsearch-7.6.2/bin
./elasticsearch -d
2
3
# 访问
http://ip:9200
- 注意防火墙端口是否开启
# 分布式文件服务
# 下载镜像
wget "http://download.glink.glkyun.com/glodon-gosp/tools/fastdfs/fastdfs_3.3.tar" --http-user=${account} --http-passwd=${password}
# 装载镜像
docker load -i fastdfs_3.3.tar
# 创建文件目录
mkdir -p /data/fastdfs_docker/storage
mkdir -p /data/fastdfs_docker/tracker
# 启动容器 开启 22122、23000,88,8888,8080 端口
docker run -e TRACKER_SERVER=${IP}:22122 -d --network="host" -v /data/fastdfs_docker/storage:/var/fdfs --name storage delron/fastdfs:3.3 storage
docker run -e TRACKER_SERVER=${IP}:22122 -d --network="host" -v /data/fastdfs_docker/tracker:/var/fdfs --name tracker delron/fastdfs:3.3 tracker
2
3
4
5
6
7
8
9
10
# 文件预览
# 文件预览服务2.0(不包含2.0)之前的只需要安装预览服务即可
# 安装fileview
#下载
wget http://download.glink.glkyun.com/glodon-gosp/tools/kkFileView-4.0.0.tar.gz
#解压
tar -zxvf kkFileView-4.0.0.tar.gz
cd kkFileView-4.0.0/bin
#启动
sh start.sh
#检查
ps -ef | grep kkFileView-4.0.0
2
3
4
5
6
7
8
9
10
11
12
13
# 配置nginx
location /fileview/ {
proxy_pass http://IP:8012/fileview/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 200M;
}
2
3
4
5
6
7
8
# nacos配置修改
# 修改默认配置dev.yml DEFAULT_GROUP
#dev.yml -》 DEFAULT_GROUP
nepoch:
whiteList: #下面添加
- /files/download/**
2
3
4
重启网关
# 修改文件配置file.yml
file.yml-》DEV_GROUP
nepoch:
glink:
upload:
#fastdfs/minio
type: fastdfs
2
3
4
5
6
# 部署新的文件服务
下载最新日期
http://download.glink.glkyun.com/glodon-gosp/glink/V2.0/
当前最新日期文档下载glink-file-service-2.0-SNAPSHOT.jar
# 5.前端组件升级
"@adam/glink": "0.5.47",
# 6.确保当前预览服务可以访问到文件信息
curl 文件地址
#
API地址:http://IP:9000/web-apps/apps/api/documents/api.js
# 任务中心
# kafka
- 使用流程需要自行安装
# 准备工作
- 数据库脚本下载: 链接 (opens new window)
# 安装包介绍
安装包下载 :链接 (opens new window)
解压安装包
tar -xvf nepoch-job.tar
1安装包目录结构
├── nepoch-job │ ├── executor # 执行器 │ │ ├── config # 配置文件 │ │ │ └── application.yml │ │ ├── logs # 日志 │ │ │ └── nepoch-job.log │ │ ├── nepoch-job-1.0-SNAPSHOT.jar # 执行器包 │ │ └── start.sh # 启动脚本,执行 sh start.sh start|stop|restart|status │ └── manager # 管理端 │ ├── config # 配置文件 │ │ └── application.properties │ ├── logs # 日志 │ │ └── xxl-job-admin.log │ ├── start.sh # 启动脚本,执行 sh start.sh start|stop|restart|status │ └── xxl-job-admin-2.3.0.jar # 管理端包
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 配置文件
管理端配置
vi nepoch-job/manager/config/application.properties
### 服务端口 server.port=8086 server.servlet.context-path=/xxl-job-admin ### 数据库配置 spring.datasource.url=jdbc:mysql://ip:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&serverTimezone=Asia/Shanghai spring.datasource.username=root spring.datasource.password=password spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver ### email 配置 spring.mail.host=smtp.qq.com spring.mail.port=25 spring.mail.username=xxx spring.mail.from=xxx spring.mail.password=xxx spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.starttls.enable=true spring.mail.properties.mail.smtp.starttls.required=true spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory ### 任务日志保存时间(天) xxl.job.logretentiondays=30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23执行器配置
vi nepoch-job/executor/config/application.yml
server: port: 8087 spring: application: name: nepoch-job redis: database: 0 host: 127.0.0.1 port: 6379 password: *** # token配置 nepoch: third-party-system: accessTokenUrl: **** apiClientId: **** apiSecret: **** # 任务管理中心 xxl: job: admin: #调度中心部署跟地址 [选填]:如调度中心集群部署存在多个地址则用逗号分隔。为空则关闭自动注册; addresses: http://127.0.0.1:8086/xxl-job-admin # 执行器通讯TOKEN [选填]:非空时启用; accessToken: executor: # 执行器AppName [选填]:执行器心跳注册分组依据;为空则关闭自动注册 appname: nepoch-job # 执行器注册 [选填]:优先使用该配置作为注册地址,为空时使用内嵌服务 ”IP:PORT“ 作为注册地址。 address: # 执行器IP [选填]:默认为空表示自动获取IP,多网卡时可手动设置指定IP,该IP不会绑定Host仅作为通讯实用; ip: # 执行器端口号 [选填]:小于等于0则自动获取;默认端口为9999,单机部署多个执行器时,注意要配置不同执行器端口; port: 9999 # 执行器运行日志文件存储磁盘路径 [选填] :需要对该路径拥有读写权限;为空则使用默认路径; logpath: # 执行器日志文件保存天数 [选填] : 过期日志自动清理, 限制值大于等于3时生效; 否则, 如-1, 关闭自动清理功能; logretentiondays: 30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# 服务启动
管理端启动
cd nepoch-job/manager/ ./start.sh start
1
2执行器启动
cd nepoch-job/executor/ ./start.sh start
1
2
# 应用部署
# 数据库初始化
根据需求酌情创建库,带 * 的必选
数据库脚本(mysql、sqlserver):下载地址 (opens new window)
- * 创建认证数据库 glink-oidc
CREATE DATABASE IF NOT EXISTS glink-oidc;
使用dbeaver工具导入 glink-oidc.sql 脚本
- * 创建云平台数据库 glink-saas
CREATE DATABASE IF NOT EXISTS glink-saas;
使用dbeaver工具导入 glink-saas.sql 脚本
- 创建流程数据库 glink-flowable
CREATE DATABASE IF NOT EXISTS glink-flowable;
使用dbeaver工具导入 glink-flowable.sql
- 创建技术中心数据库 glink-technology
CREATE DATABASE IF NOT EXISTS glink-technology;
使用dbeaver工具导入 glink-technology.sql
- 创建门户数据库 glink-portal
CREATE DATABASE IF NOT EXISTS glink-portal;
使用dbeaver工具导入 glink-portal.sql
- 创建demo数据库 glink-stms
CREATE DATABASE IF NOT EXISTS glink-stms;
使用dbeaver工具导入 glink-stms.sql
- 创建消息数据库 glink-msgc
CREATE DATABASE IF NOT EXISTS glink-msgc;
使用dbeaver工具导入 glink-msgc.sql
- 执行增量脚本
wget http://download.glink.glkyun.com/glodon-gosp/glink/V2.0/sql/incrementSql/*
# 对应库执行增量脚本
2
# Nacos配置初始化
- nacos中创建namespace,
[{
"命名空间ID": "GLINK-DEV",
"命名空间名": "dev",
"描述": "开发环境"
},
{
"命名空间ID": "GLINK-TEST",
"命名空间名": "test",
"描述": "测试环境"
}]
2
3
4
5
6
7
8
9
10
- 导入nacos配置 在对应的nacos的命名空间中导入相应配置,配置文件:下载地址 (opens new window)
- 修改db、redis、es、fastdfs等配置项
- 特别注意 :gateway.yml 配置注意 clientId 与 clientSecret 数据来源于 glink-oidc 数据库中的 client-detail 表对应的字段。 此处请详细阅读 业务系统入驻指南
# 前端部署
# 前端资源
cd /opt/saas
wget "http://download.glink.glkyun.com/glodon-gosp/glink/V2.0/web/workplat-web.tar" --http-user=${account} --http-passwd=${password}
tar -xvf workplat-web.tar
2
3
# nginx配置
cd /usr/local/nginx/conf/conf.d
wget "http://download.glink.glkyun.com/glodon-gosp/glink/V2.0/nginx-conf/nginx-conf.zip" --http-user=${account} --http-passwd=${password}
unzip nginx-conf.zip
2
3
# * 认证代理配置
- 修改 oidc.nginx.conf,指向后端认证服务,注意端口开放
location ^~ /nepoch-oidc {
proxy_set_header Host $host:$server_port;
proxy_set_header X-real-ip $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 指向认证后端服务地址
proxy_pass http://127.0.0.1:10030;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
}
2
3
4
5
6
7
8
9
# * 网关代理配置
设置为网关服务地址(示例:127.0.0.1:10000)
修改 gateway.upstream.conf,指向后端网关服务,注意端口开放
upstream gateway-servers {
server ip:port;
}
2
3
# 文件代理配置
设置fastdfs文件服务器地址(示例:127.0.0.1:22123)
创建 file.upstream.conf
upstream file-servers {
server ip:port;
}
2
3
# 自定义应用(demo)
- 创建 demo.nginx.conf
server {
listen 80;
server_name demo.custom.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location /api/ {
proxy_set_header Host $host:$server_port;
proxy_set_header X-real-ip $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://gateway-servers/;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_hide_header X-Frame-Options;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
}
location /group1/ {
proxy_pass http://file-servers/group1/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 200M;
}
location / {
# 修改目录为当前demo服务前端目录
root /opt/saas/workplat-web/demo-web;
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 启动
cd /usr/local/nginx/sbin
# 启动
./nginx
# 重启
./nginx -s reload
2
3
4
5
平台前端涉及到认证中心登录页与基础平台管理端前端。web容器示例使用nginx,可视情况自行调整。
# 后端部署
平台后端涉及到认证oidc、系统管理system、集成管理intergation、技术中心technology、网关gateway、文件服务file、流程适配器workflowProcesser、自研流程引擎workflowEditor、门户portal酌情启动。 如果业务中不使用流程、文件等可只启动认证中心、网关、系统管理、集成管理、技术中心。
# java环境
mkdir -p /home/software
cd /home/software
# 下载jdk包
wget "http://download.glink.glkyun.com/glodon-gosp/tools/jdk-8u172-linux-x64.tar.gz" --http-user=${account} --http-passwd=${password}
# 复制jdk包至/home下
cp jdk-8u172-linux-x64.tar.gz /home
# 解压jdk
cd /home
tar -zxvf jdk-8u172-linux-x64.tar.gz
# 配置环境变量
vi /etc/profile
------------------------ 末尾添加 -------------------------
#JAVA_ENV
export JAVA_HOME=/home/jdk1.8.0_172
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
------------------------ 末尾添加 -------------------------
source /etc/profile
# 查看jdk版本
java -version
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 安装包下载
# 创建安装包目录
mkdir -p /opt/saas/build_result
# 下载后端资源包
cd /opt/saas/build_result
wget "http://download.glink.glkyun.com/glodon-gosp/glink/V2.0/jar/*" --http-user=${account} --http-passwd=${password}
2
3
4
5
6
# 启动脚本下载
cd /opt/saas/
wget "http://download.glink.glkyun.com/glodon-gosp/glink/V2.0/shell/*" --http-user=${account} --http-passwd=${password}
2
- 修改 restart_server_module.sh 脚本中相关信息
# nacos配置
--nacos.address=127.0.0.1:8848 --nacos.group=DEV_GROUP --nacos.namespace=dev --spring.profiles.active=dev >> $2.log 2>&1 &
2
# 服务启动
# * 环境host配置
vi /etc/hosts
${nginx机器IP} oidc.glkyun.com
${nginx机器IP} glink-cloud-platform.glkyun.com
2
3
# * 启动所有服务
cd /opt/saas
# 启动
./restart_all.sh
# 查看日志
tailf workplat-server/${jar名称}.log
2
3
4
5
# 启动单个服务
# 查看服务启动命令
cd /opt/saas
cat restart_all.sh
# 执行需要的服务启动命令
2
3
4
业务系统后端开发 →