1.说明
在产品发布的时候,我们我们需要将微服务应用和前端打包成一个包,平台提供编译打包的工具,实现一键打包。
2.编译打包
分为前端和后端,目标是将前端和后端的代码打包编译后,拷贝到一个发布的目录。
2.1 后端打包过程
2.1.1 修改系统生产配置
在发布时修改成生产配置。
2.1.2 修改生产文件配置
这里安装生产环境的配置进行设置。
2.1.3 打包代码
修改打包参数配置。编辑 build.properties 文件。
安装图片说明修改实际的参数。
# 打包输出目录
jpaasoutDir=D:/temp/202104
# 表单设计器地址
jpaasFormDir=D:/work/redxun/form/jpaas-form
# maven setting 文件地址
mvnSetting=D:/mvn/settings_new.xml
# maven 安装路径
mvnHome=D:/program/maven3.6.3
# 表单代码路径
jpaas-form=D:/work/redxun/jpaas-form
# BPM代码路径
jpaas-bpm=D:/work/redxun/jpaas-bpm-all
# 手机端
jpaas-mobile=D:/work/redxun/jpaas/jpaas_mobile
# 定时任务项目目录
jpaas-job=D:/work/redxun/jpaas/job-admin
打包工具说明
打包工具使用的时ANT脚本。
命令 | 说明 |
---|---|
buildFront | 是分别编译三个前端程序,并将这些程序的编译后的代码拷贝到 发布目录 |
buildJar | 这个是使用maven 编译项目,并将编译后的代码copy到发布目录 |
copyjar | 这个是将生成的JAR 拷贝到 发布目录 |
jpaas-form-web | 这个是编译表单的源码,并将编译后的代码copy 到发布目录 |
jpaas-vue-web | 这个是将编译 后台管理界面代码,并将编译后的代码 copy到发布目录 |
jpaas_bpm_designer_web | 这个是将编译流程设计器代码,并将编译后的代码 copy到发布目录 |
生成部署包 | 这个是将 后台和 前台的 代码进行编译,并copy到发布目录 |
3. 打包完成后我们需要进行启动部署
3.1 目录结构
比如我们的代码包结构如下
front 放的是前端的代码
这个分别放的是三个前端程序的代码
jar 放的是后端程序的代码
3.2 前端代码使用nginx 配置
配置方法如下:
location /jpaas {
alias /home/jpaasnew/front/jpaas-vue;
index index.html index.htm;
try_files $uri $uri/ /jpaas/index.html;
}
location /api/ {
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:9900/;
}
location /form {
alias /home/jpaasnew/front/jpaas-form;
index index.html index.htm;
try_files $uri $uri/ /form/index.html;
}
location /bpm-designer {
alias /home/jpaasnew/front/bpm-designer;
index index.html index.htm;
try_files $uri $uri /bpm-designer/index.html;
}
location /job {
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:7878;
}
这里我们使用nginx 进行映射。
3.3 后端微服务启动
startup.sh 这个是启动所有的微服务,当应用启动过时,就 杀掉之前的 应用进程,再重启。
startup.sh 文件内容
echo "starting redxun jpaas"
echo "reload nginx"
nginx -s reload
export DAVINCI3_HOME=/home/jpaas/front/jpaas-davinci
PROCESS="$(ps -ef|grep job-admin|grep -v grep|awk '{print $2}')"
if [[ -n $PROCESS ]];
then
echo "job-admin running... start kill..."
kill -9 $PROCESS
else
echo "job-admin not running"
fi
PROCESS="$(ps -ef|grep jpaas-auth|grep -v grep|awk '{print $2}')"
if [[ -n $PROCESS ]];
then
echo "jpaas-auth running... start kill..."
kill -9 $PROCESS
else
echo "jpaas-auth not running"
fi
PROCESS="$(ps -ef|grep jpaas-bpm|grep -v grep|awk '{print $2}')"
if [[ -n $PROCESS ]];
then
echo "jpaas-bpm running... start kill..."
kill -9 $PROCESS
else
echo "jpaas-bpm not running"
fi
PROCESS="$(ps -ef|grep jpaas-form|grep -v grep|awk '{print $2}')"
if [[ -n $PROCESS ]];
then
echo "jpaas-form running... start kill..."
kill -9 $PROCESS
else
echo "jpaas-form not running"
fi
PROCESS="$(ps -ef|grep jpaas-portal|grep -v grep|awk '{print $2}')"
if [[ -n $PROCESS ]];
then
echo "jpaas-portal running... start kill..."
kill -9 $PROCESS
else
echo "jpaas-portal not running"
fi
PROCESS="$(ps -ef|grep jpaas-system|grep -v grep|awk '{print $2}')"
if [[ -n $PROCESS ]];
then
echo "jpaas-system running... start kill..."
kill -9 $PROCESS
else
echo "jpaas-system not running"
fi
PROCESS="$(ps -ef|grep jpaas-user|grep -v grep|awk '{print $2}')"
if [[ -n $PROCESS ]];
then
echo "jpaas-user running... start kill..."
kill -9 $PROCESS
else
echo "jpaas-user not running"
fi
PROCESS="$(ps -ef|grep jpaas-ureport|grep -v grep|awk '{print $2}')"
if [[ -n $PROCESS ]];
then
echo "jpaas-ureport running... start kill..."
kill -9 $PROCESS
else
echo "jpaas-ureport not running"
fi
PROCESS="$(ps -ef|grep sc-gateway|grep -v grep|awk '{print $2}')"
if [[ -n $PROCESS ]];
then
echo "sc-gateway running... start kill..."
kill -9 $PROCESS
else
echo "sc-gateway not running"
fi
PROCESS="$(ps -ef|grep davinci-server|grep -v grep|awk '{print $2}')"
if [[ -n $PROCESS ]];
then
echo "davinci-server running... start kill..."
kill -9 $PROCESS
else
echo "davinci-server not running"
fi
PROCESS="$(ps -ef|grep jpaas-oa|grep -v grep|awk '{print $2}')"
if [[ -n $PROCESS ]];
then
echo "jpaas-oa running... start kill..."
kill -9 $PROCESS
else
echo "jpaas-oa not running"
fi
echo "starting jpaas-gateway "
nohup java -jar -Xbootclasspath/a:. -Xms512m -Xmx512m sc-gateway.jar --nacos.address=localhost:8848 > logs/jpaas-gateway.out &
echo "starting jpaas-auth "
nohup java -jar -Xbootclasspath/a:. -Xms512m -Xmx512m jpaas-auth.jar --nacos.address=localhost:8848 &
echo "starting job-admin "
nohup java -jar -Xbootclasspath/a:. -Xms512m -Xmx512m job-admin.jar --nacos.address=localhost:8848 &
echo "starting jpaas-bpm "
nohup java -jar -Xbootclasspath/a:. -Xms1024m -Xmx1024m -Xmn512m jpaas-bpm.jar --nacos.address=localhost:8848 &
echo "starting jpaas-form "
nohup java -jar -Xbootclasspath/a:. -Xms1024m -Xmx1024m jpaas-form.jar --nacos.address=localhost:8848 &
echo "starting jpaas-portal "
nohup java -jar -Xbootclasspath/a:. -Xms512m -Xmx512m jpaas-portal.jar --nacos.address=localhost:8848 > logs/jpaas-portal.out &
echo "starting jpaas-system "
nohup java -jar -Xbootclasspath/a:. -Xms512m -Xmx512m jpaas-system.jar --nacos.address=localhost:8848 &
echo "starting jpaas-user "
nohup java -jar -Xbootclasspath/a:. -Xms512m -Xmx512m jpaas-user.jar --nacos.address=localhost:8848 &
echo "starting jpaas-ureport "
nohup java -jar -Xbootclasspath/a:. -Xms512m -Xmx512m jpaas-ureport.jar --nacos.address=localhost:8848 &
echo "starting davinci-server "
nohup java -jar -Xbootclasspath/a:. -Xms512m -Xmx512m davinci-server_3.01.jar --nacos.address=localhost:8848 &
#echo "starting jpaas-oa "
#nohup java -jar -Xms256m -Xmx256m jpaas-oa.jar --nacos.address=localhost:8848 &
stop.sh 这个命令时停止所有的微服务。
remove.sh 这个时删除 后台的jar包代码。
文档更新时间: 2021-05-19 12:36 作者:csx