wdp项目开发及部署
# 简介
功能叠加;前期通过vue
过渡,再通过微前端项目过渡;
- 内嵌渐进式
- iframe, vue项目过渡
- 微前端集成
# 脚本
# 构建时env维护版本
一套前端代码,通过配置参数构建,打包发布不同现场版本;
# 前端可定制参数
可定制的参数 | 参数说明 | 可选及默认 | 备注 |
---|---|---|---|
isPro | 是否是生产环境 | 默认true | 不能代理的情况下,web ,capacity 两项目用到 |
defaultLang | 默认系统语言 | 默认zh ;可选zh ,en | 目前与isHideLang 连用 |
isHideLang | 是否屏蔽切换国际化功能 | 默认false | 目前与defaultLang 连用 |
isTokenAuth | 是否使用Token权限验证 | 默认true |
# .env
对应的现场版本
Env | 构建参数 | 对应现场版本说明 |
---|---|---|
.env.default | build.sh | 标准版本默认 |
.env.defaultCookie | build.sh defaultCookie | 标准版本Cookie验证方式 |
.env.intl | build.sh intl | 国际版本全英文,无切换国际化功能 |
.env.intlCookie | build.sh intlCookie | 国际版本Cookie验证方式 |
# 构建4项目
后端
*.xml
,和*.properties
相关配置不做维护处理,只更新前端dist; 要修改原来的删除原来的静态目录,再做软连接,修改为替换前端静态文件;
# build.sh
#!/bin/bash
###
# @Author: samy
# @email: yessz#foxmail.com
# @time: 2021-03-11 15:59:05
# @modAuthor: samy
# @modTime: 2021-03-29 16:28:41
# @desc: 构建部署脚本
# Copyright © 2015~2021 BDP FE
###
set -e
curDir=$(
cd "$(dirname "$0")"
pwd
)
admDir=${curDir}/admin/main/resources/ui/admin-web
webDir=${curDir}/web
viewCapDir=${curDir}/views/capacity-scheduler/src/main/resources/ui
viewFileDir=${curDir}/views/files/src/main/resources/ui
admDirDist=dist/admin
webDirDist=dist/web
viewCapDirDist=dist/views/capacity
viewFileDirDist=dist/views/files
replacePro() {
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i "" "s#^var isPro = false.*#var isPro = true;#g" $1
else
sed -i "s#^var isPro = false.*#var isPro = true;#g" $1
fi
}
echo "=====环境依赖初始化==node版本===源配置===="
node -v
npm config set registry https://registry.npm.taobao.org
# npm config list
rm -rf ${curDir}/dist
mkdir -p ${curDir}/${admDirDist} ${curDir}/${webDirDist} ${curDir}/${viewCapDirDist} ${curDir}/${viewFileDirDist}
echo "==================================admin===================================="
cd ${admDir}
echo "=======bower使用==zip==命令========="
unzip -o ${admDir}/app/assets/zip/bower_components.zip -d ${admDir}/app/
npm i
npm run build
echo "=====admin项目===构建成功====="
cp -R dist/* ${curDir}/${admDirDist}/
# cp ../../view.xml ${curDir}/${admDirDist}/
echo "=====admin项目===拷贝成功====="
echo "==================================web===================================="
cd ${webDir}
replacePro ${webDir}/app/config.js
echo "=====web项目==config中的apiPrefix===替换成功===="
npm i
npm run build
echo "=====web项目===构建成功====="
cp -R public/* ${curDir}/${webDirDist}/
echo "=====web项目===拷贝成功====="
echo "===========================capacity-scheduler==============================="
cd ${viewCapDir}
replacePro ${viewCapDir}/app/adapters.js
echo "=======bower使用==zip==命令========="
unzip -o ${viewCapDir}/zip/bower_components.zip
npm i
npm run build
echo "=====capacity项目===构建成功====="
cp -R public/* ${curDir}/${viewCapDirDist}/
# cp ../view.xml ${curDir}/${viewCapDirDist}/
# cp ../view.log4j.properties ${curDir}/${viewCapDirDist}/
echo "=====capacity项目===拷贝成功====="
# 要考虑到后端的yarn组件命令会跟前端包管理的命令冲突问题;
echo "======================yarn预处理=====yarn版本==========源配置=================="
cd ${curDir}
npm i
./node_modules/.bin/yarn config set registry https://registry.npm.taobao.org/ -g
./node_modules/.bin/yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ -g
# ./node_modules/.bin/yarn config list
echo "=================================files======================================"
cd ${viewFileDir}
# 这个项目不用做配置替换直接用的ember自带的环境
echo "=======bower使用==zip==命令========="
unzip -o ${viewFileDir}/zip/bower_components.zip
${curDir}/node_modules/.bin/yarn install
${curDir}/node_modules/.bin/yarn build
echo "=====file项目===构建成功====="
cp -R dist/* ${curDir}/${viewFileDirDist}/
# cp ../view.xml ${curDir}/${viewFileDirDist}/
# cp ../view.log4j.properties ${curDir}/${viewFileDirDist}/
echo "=====file项目===拷贝成功====="
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
前端这边构建的脚本优化,支持单独构建某个子项目功能;build.sh a w c f
, 不传递参数的话,默认构建全部4个项目;
#!/bin/bash
###
# @Author: samy
# @email: yessz#foxmail.com
# @time: 2021-03-11 15:59:05
# @modAuthor: samy
# @modTime: 2021-04-07 17:01:47
# @desc: 构建部署脚本
# Copyright © 2015~2021 BDP FE
###
set -e
curDir=$(
cd "$(dirname "$0")"
pwd
)
admDir=${curDir}/admin/main/resources/ui/admin-web
webDir=${curDir}/web
viewCapDir=${curDir}/views/capacity-scheduler/src/main/resources/ui
viewFileDir=${curDir}/views/files/src/main/resources/ui
admDirDist=dist/admin
webDirDist=dist/web
viewCapDirDist=dist/views/capacity
viewFileDirDist=dist/views/files
curPro='admin'
replacePro() {
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i "" "s#^var isPro = false.*#var isPro = true;#g" $1
else
sed -i "s#^var isPro = false.*#var isPro = true;#g" $1
fi
}
buildAdmin() {
curPro='buildAdmin'
echo "==================================${curPro}===================================="
cd ${admDir}
echo "=======bower使用==zip==命令========="
unzip -o ${admDir}/app/assets/zip/bower_components.zip -d ${admDir}/app/
npm i
npm run build
echo "=====${curPro}项目===构建成功====="
cp -R dist/* ${curDir}/${admDirDist}/
echo "=====${curPro}项目===拷贝成功====="
}
buildWeb() {
curPro='buildWeb'
echo "==================================${curPro}===================================="
cd ${webDir}
replacePro ${webDir}/app/config.js
echo "=====${curPro}项目==config中的apiPrefix===替换成功===="
npm i
npm run build
echo "=====${curPro}项目===构建成功====="
cp -R public/* ${curDir}/${webDirDist}/
echo "=====${curPro}项目===拷贝成功====="
}
buildCapacity() {
curPro='buildCapacity'
echo "==================================${curPro}===================================="
cd ${viewCapDir}
replacePro ${viewCapDir}/app/adapters.js
echo "=======bower使用==zip==命令========="
unzip -o ${viewCapDir}/zip/bower_components.zip
npm i
npm run build
echo "=====${curPro}项目===构建成功====="
cp -R public/* ${curDir}/${viewCapDirDist}/
echo "=====${curPro}项目===拷贝成功====="
}
buildFiles() {
# 要考虑到后端的yarn组件命令会跟前端包管理的命令冲突问题;
curPro='buildFiles'
echo "==================================${curPro}===================================="
echo "======================yarn预处理=====yarn版本==========源配置=================="
cd ${curDir}
npm i
./node_modules/.bin/yarn config set registry https://registry.npm.taobao.org/ -g
./node_modules/.bin/yarn config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ -g
./node_modules/.bin/yarn config list
cd ${viewFileDir}
# 这个项目不用做配置替换直接用的ember自带的环境
echo "=======bower使用==zip==命令========="
unzip -o ${viewFileDir}/zip/bower_components.zip
${curDir}/node_modules/.bin/yarn install
${curDir}/node_modules/.bin/yarn build
echo "=====${curPro}项目===构建成功====="
cp -R dist/* ${curDir}/${viewFileDirDist}/
echo "=====${curPro}项目===拷贝成功====="
}
echo "=====环境依赖初始化==node版本===源配置====="
node -v
npm config set registry https://registry.npm.taobao.org
# npm config list
rm -rf ${curDir}/dist
mkdir -p ${curDir}/${admDirDist} ${curDir}/${webDirDist} ${curDir}/${viewCapDirDist} ${curDir}/${viewFileDirDist}
echo '=====build all pro====='
buildAdmin
buildWeb
buildCapacity
buildFiles
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# 单独构建子项目
if [ $# -gt 0 ]; then
for i in "$@"; do
case $i in
a | admin )
buildAdmin
;;
w | web)
buildWeb
;;
c | capacity)
buildCapacity
;;
f | files)
buildFiles
;;
*)
echo "项目命令不存在"
;;
esac
done
else
echo '=====build all pro====='
buildAdmin
buildWeb
buildCapacity
buildFiles
fi
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
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
# 版本功能
curDir=$(
cd "$(dirname "$0")"
pwd
)
versionDist=dist/web/version.txt
# 提交在web目录下处理打印版本信息
printVersion() {
cd ${curDir}
echo "==================================printVersion===================================="
curBranch=`git show-ref | grep $(git log --pretty=%h -1) | sed 's|.*/\(.*\)|\1|' | sort -u | grep -v HEAD`
commitID=`git rev-parse --short HEAD`
commitTime=`git show --pretty=format:"%ci" | head -1`
version=${curBranch}@${commitID}@${commitTime}
echo "${version}" > ${versionDist}
echo "=====版本记录生产version.txt成功====${version}======"
}
if [ $# -gt 0 ]; then
else
echo '=====build all pro====='
fi
printVersion
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
优化json后配置
# 提交在web目录下处理打印版本信息
printVersion() {
cd ${curDir}
echo "==================================printVersion===================================="
curBranch=$(git show-ref | grep $(git log --pretty=%h -1) | sed 's|.*/\(.*\)|\1|' | sort -u | grep -v HEAD)
commitID=$(git rev-parse --short HEAD)
commitTime=$(git show --pretty=format:"%ci" | head -1)
buildTime=$(date "+%Y-%m-%d %H:%M:%S")
echo "{
\"version\":{
\"curBranch\": \"$curBranch\",
\"commitID\": \"$commitID\",
\"commitTime\": \"$commitTime\"
},
\"buildCfg\":{
\"buildTime\": \"$buildTime\",
\"envName\":\"$envName\",
\"isPro\":$isPro,
\"defaultLang\":$defaultLang,
\"isHideLang\":$isHideLang,
\"isTokenAuth\":$isTokenAuth
}
}" > $versionDist
echo "=====版本记录生产version.json成功========"
cat $versionDist
}
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
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
verion.json
{
"version":{
"curBranch": "dev",
"commitID": "9abb4e67",
"commitTime": "2022-01-13 15:11:48 +0800"
},
"buildCfg":{
"buildTime": "2022-01-13 16:33:29",
"envName":".env.intlCookie",
"isPro":true,
"defaultLang":"en",
"isHideLang":true,
"isTokenAuth":false
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 特殊部分Adm项目
记得要加入META-INF
目录和view.xml
文件;
<view>
<name>ADMIN_VIEW</name>
<label>Wdp Admin View</label>
<version>1.0</version>
<system>true</system>
<instance>
<name>INSTANCE</name>
<description>This view provides administration capabilities for Wdp</description>
<visible>false</visible>
</instance>
</view>
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# Docker容器方式构建【推荐】
Dockerfile
FROM centos:centos7
VOLUME /opt/mountDir
ARG gitlab_username
ARG gitlab_password
ENV build_params=""
RUN yum install git wget curl unzip gcc make python3 cmake gcc-c++ -y
# RUN curl --silent --location https://rpm.nodesource.com/setup_10.x | bash -
# RUN yum install nodejs -y
RUN wget http://10.xx.xxx.xxx:58888/files/nodejs/10.24.0/node-v10.24.0-linux-x64.tar.gz \
&& tar xvf node-v10.24.0-linux-x64.tar.gz \
&& mv node-v10.24.0-linux-x64 nodejs \
&& mv nodejs /usr/local/nodejs \
&& ln -s /usr/local/nodejs/bin/npm /usr/local/bin/ \
&& ln -s /usr/local/nodejs/bin/node /usr/local/bin/ \
&& ln -s /usr/local/nodejs/bin/npx /usr/local/bin/ \
&& npm config set registry https://registry.npm.taobao.org/
RUN git clone -b dev http://${gitlab_username}:${gitlab_password}@10.xxx.51/xxx/wdp-web.git /opt/wdp-web/
RUN echo -e "" >> /opt/wdp-web/build.sh
RUN echo -e "mv \${curDir}/dist/admin \${curDir}/dist/wdp-admin" >> /opt/wdp-web/build.sh
RUN echo -e "mv \${curDir}/dist/web \${curDir}/dist/wdp-web" >> /opt/wdp-web/build.sh
RUN echo -e "mv \${curDir}/dist/views/capacity \${curDir}/dist/views/wdp-views-capacity-scheduler" >> /opt/wdp-web/build.sh
RUN echo -e "mv \${curDir}/dist/views/files \${curDir}/dist/views/wdp-views-files" >> /opt/wdp-web/build.sh
RUN echo -e "mv \${curDir}/dist/wdp-admin /opt/mountDir" >> /opt/wdp-web/build.sh
RUN echo -e "mv \${curDir}/dist/wdp-web /opt/mountDir" >> /opt/wdp-web/build.sh
RUN echo -e "mv \${curDir}/dist/views/wdp-views-capacity-scheduler /opt/mountDir" >> /opt/wdp-web/build.sh
RUN echo -e "mv \${curDir}/dist/views/wdp-views-files /opt/mountDir" >> /opt/wdp-web/build.sh
RUN echo -e "chmod -R 777 /opt/mountDir" >> /opt/wdp-web/build.sh
CMD /usr/bin/bash /opt/wdp-web/build.sh ${build_params}
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
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
build-wdp.sh
外部总体触发构建
#!/usr/bin/bash
#########################################################################
# #
# wdp打包总脚本,用于docker构建wdp子项目 #
# #
#########################################################################
source /etc/profile
gitlab_username=""
gitlab_password=""
input_params=""
helpfunc(){
echo "usage: sh build-wdp.sh --gitlab-username=gitlab-username --gitlab-password=gitlab-password --build-params=build-params"
echo "The building parameters could only contain all, wdp-server, wdp-agent, wdp-admin, wdp-metrics, wdp-views-capacity-scheduler or wdp-views-files."
echo "If you want to build all rpm packages, you can run the build-wdp.sh script with command of 'sh build-wdp.sh --gitlab_username=gitlab_username --gitlab_password=gitlab_password --build-params=all'."
echo "Except from that, if you want to build wdp-server rpm package only, you can run the command of 'sh build-wdp.sh --gitlab_username=gitlab_username --gitlab_password=gitlab_password --build-params=wdp-server'."
echo "Lastly, if you want to build more than one rpm package, take wdp-server and wdp-agent from example, please run the command of 'sh build-wdp.sh --gitlab_username=gitlab_username --gitlab_password=gitlab_password --build-params=wdp-server,wdp-agent'."
}
if [[ $1 == "--help" || $1 = "-h" ]]; then
helpfunc
exit
fi
GETOPT_ARGS=`getopt -o l:r:b:w: -al gitlab-username:,gitlab-password:,build-params: -- "$@"`
eval set -- "$GETOPT_ARGS"
while [ -n "$1" ]
do
case "$1" in
-u|--gitlab-username) gitlab_username=$2; shift 2;;
-p|--gitlab-password) gitlab_password=$2; shift 2;;
-b|--build-params) input_params=$2; shift 2;;
--) break;;
*) helpfunc; break;;
esac
done
if [[ -z $gitlab_username || -z $gitlab_password || -z $input_params ]]; then
helpfunc
exit
fi
build_params=(${input_params//,/ })
if [[ ! "${build_params[@]}" =~ "all" && \
! "${build_params[@]}" =~ "wdp-server" && \
! "${build_params[@]}" =~ "wdp-agent" && \
! "${build_params[@]}" =~ "wdp-admin" && \
! "${build_params[@]}" =~ "wdp-metrics" && \
! "${build_params[@]}" =~ "wdp-views-capacity-scheduler" && \
! "${build_params[@]}" =~ "wdp-views-files" ]]; then
echo "The building parameters are not satisfied, please use --help to show the usage!"
exit
fi
# maybe error
if [[ "${#build_params[*]}" == 1 && "${build_params[@]}" =~ "all" ]]; then
echo "build all rpm packages"
cd /opt/wdp-package/src/main/sh/
sh /opt/wdp-package/src/main/sh/download-wdp-server-agent.sh ${gitlab_username} ${gitlab_password}
sh /opt/wdp-package/src/main/sh/build-wdp-web.sh ${gitlab_username} ${gitlab_password}
sh /opt/wdp-package/src/main/sh/build-wdp-views-files.sh
sh /opt/wdp-package/src/main/sh/build-wdp-views-capacity.sh
sh /opt/wdp-package/src/main/sh/build-wdp-server.sh
sh /opt/wdp-package/src/main/sh/build-wdp-metrics.sh
sh /opt/wdp-package/src/main/sh/build-wdp-agent.sh
exit
fi
if [[ "${build_params[@]}" =~ "wdp-server" ]]; then
echo "build wdp-server rpm packages"
fi
if [[ "${build_params[@]}" =~ "wdp-agent" ]]; then
echo "build wdp-agent rpm packages"
fi
if [[ "${build_params[@]}" =~ "wdp-admin" ]]; then
echo "build wdp-admin rpm packages"
fi
if [[ "${build_params[@]}" =~ "wdp-metrics" ]]; then
echo "build wdp-metrics rpm packages"
fi
if [[ "${build_params[@]}" =~ "wdp-views-capacity-scheduler" ]]; then
echo "build wdp-views-capacity-scheduler rpm packages"
fi
if [[ "${build_params[@]}" =~ "wdp-views-files" ]]; then
echo "build wdp-views-files rpm packages"
fi
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# 部署
跟之前的ambari
改造部署一致,修改为wdp
即可;
# 配置账户
配置一个sudo
权限的账户,用于ftp拉去dist.zip;
sudo useradd -m iwdpxx
sudo passwd iwdpxxx
chmod u+w /etc/sudoers
vi /etc/sudoers # 注意设置拷贝路径格式问题;
iwdpxxx ALL=(ALL) NOPASSWD:ALL
1
2
3
4
5
6
2
3
4
5
6
切换到iwdp账户,安装相关依赖;
sudo yum -y install vim ftp
1
# 触发脚本
# jks上触发
- 全局配置部署的服务器; 172.21.73.xxx-ixxx; 172.21.73.xxx; ixxx
- 选择对应的分支版本;
- 对应待部署的ssh服务器;
# 准备脚本
从已经有的机器上scp拷贝脚本:
mkdir -p fe-deploy/sh fe-deploy/bak && cd fe-deploy
scp -r iwdp@172.21.73.xx:/home/iwdp/fe-deploy/sh ./
1
2
2
# 本机测试
cd fe-deploy
sh sh/getdist.sh
1
2
2
# getdist.sh
每个jks项目对应的项目路径不一样要记得修改;
#!/bin/bash
sleep 1
ftp -niv <<!
open 10.45.47.xx
user jkuser xx
binary
cd /var/lib/jenkins/workspace/wdp-web-master
lcd /home/iwdp/fe-deploy
prompt
get dist.zip
close
bye
!
sleep 1
pwd
ls -la
datetime=$(date "+%Y%m%d%H%M%S")
sudo rm -rf dist
sudo /usr/bin/unzip dist.zip
#rm -f dist.zip
sudo mv dist.zip bak/dist-${datetime}.zip
echo "解压成功,部署成功"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# replace.sh
兼容views组件相关配置;
后端
*.xml
,和*.properties
相关配置不做维护处理,只更新前端dist; 要修改原来的删除原来的静态目录,再做软连接,修改为替换前端静态文件;
#!/bin/bash
###
# @email: yessz#foxmail.com
# @time: 2021-03-11 15:59:05
# @modAuthor: samy
# @modTime: 2021-03-15 17:24:01
# @desc: dist引用
# Copyright © 2015~2021 BDP FE
###
set -e
isLn=$1
distDir=/home/iwdp/fe-deploy/dist
webDir=/usr/lib/wdp-server/web
admDir=/var/lib/wdp-server/resources/views/work/ADMIN_VIEW\{1.0}
capacityDir=/var/lib/wdp-server/resources/views/work/CAPACITY-SCHEDULER{1.0}
filesDir=/var/lib/wdp-server/resources/views/work/FILES{1.0}
#if [ -z "$isLn" ]; then
# sudo rm -rf ${webDir} ${admDir} # 优化后不做删除处理,直接替换源码;
# sudo ln -s ${distDir}/web ${webDir}
# sudo ln -s ${distDir}/admin ${admDir}
# sudo ln -s ${distDir}/views/capacity ${capacityDir}
# sudo ln -s ${distDir}/views/files ${filesDir}
sudo cp -R ${distDir}/web/* ${webDir}
sudo cp -R ${distDir}/admin/* ${admDir}
sudo cp -R ${distDir}/views/capacity/* ${capacityDir}
sudo cp -R ${distDir}/views/files/* ${filesDir}
echo "静态资源替换成功!"
#echo "软引用替换成功!"
#else
# echo "========跳过创建软引用========="
#fi
echo "wdp-server 重启中"
sudo wdp-server stop
sudo wdp-server start --skip-database-check
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
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
简化后:
#!/bin/bash
#
# @time: 2021-03-11 15:59:05
# @modAuthor: samy
# @modTime: 2021-03-15 17:24:01
# @desc: dist引用
# Copyright © 2015~2021 BDP FE
###
set -e
isLn=$1
distDir=/home/iwdp/fe-deploy/dist
webDir=/usr/lib/wdp-server/web
admDir=/var/lib/wdp-server/resources/views/work/ADMIN_VIEW\{1.0}
capacityDir=/var/lib/wdp-server/resources/views/work/CAPACITY-SCHEDULER{1.0}
filesDir=/var/lib/wdp-server/resources/views/work/FILES{1.0}
sudo cp -R ${distDir}/web/* ${webDir}
sudo cp -R ${distDir}/admin/* ${admDir}
sudo cp -R ${distDir}/views/capacity/* ${capacityDir}
sudo cp -R ${distDir}/views/files/* ${filesDir}
echo "静态资源替换成功!"
sudo wdp-server stop
echo "wdp-server 重启中"
sudo wdp-server start --skip-database-check
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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 归档成品
**/*dist.zip
1
# 项目显示
# 新版本处理[优化]
目前集群内部不能访问外网,只能通过httpd处理【也可以借助JKS自带的构建后的产物地址】;
# 构建JKS机器
构建产物处理
cd $WORKSPACE
httpdPath=/var/www/html/files/wdp/web
rm -rf dist*
#sh build.sh defaultCookie intl intlCookie
sh build.sh
tar -zcvf dist.tar.gz dist
cp -rf dist.tar.gz $httpdPath/
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
cd $WORKSPACE
httpdPath=/var/www/html/files/wdp/web
env=defaultCookie
rm -rf dist*
#sh build.sh defaultCookie intl intlCookie
sh build.sh $env
tar -zcvf dist_$env.tar.gz dist
cp -rf dist_$env.tar.gz $httpdPath/
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
**/*dist*.gz
相关脚本放置httpd
replace.sh
可以也把它放在httpd中和dist.tar.gz
#!/bin/bash
set -e
distDir=/srv/wdp-web/dist
webDir=/usr/lib/wdp-server/web
admDir=/var/lib/wdp-server/resources/views/work/ADMIN_VIEW\{1.0}
capacityDir=/var/lib/wdp-server/resources/views/work/CAPACITY-SCHEDULER{1.0}
filesDir=/var/lib/wdp-server/resources/views/work/FILES{1.0}
sudo cp -R ${distDir}/web/* ${webDir}
sudo cp -R ${distDir}/admin/* ${admDir}
sudo cp -R ${distDir}/views/capacity/* ${capacityDir}
sudo cp -R ${distDir}/views/files/* ${filesDir}
echo "静态资源替换成功!"
sudo wdp-server stop
echo "wdp-server 重启中"
sudo wdp-server start --skip-database-check
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 服务器集群机器
getWeb.sh
运行:sh /srv/wdp-web/getWeb.sh
#!/bin/bash
mkdir -p /srv/wdp-web/ && cd /srv/wdp-web
echo "=====前端资源下载在===/srv/wdp-web====目录中======="
distName=dist
if [ $1 ]; then
distName=dist_$1
fi
wget http://10.45.xx.116:58888/files/wdp/web/$distName.tar.gz
tar zxvf $distName.tar.gz
wget http://10.45.xxx.116:58888/files/wdp/web/replace.sh
sh replace.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
部署方式简化:【推荐】
cd /srv/wdp-web && rm -rf *
wget http://10.45.xxx.116:58888/files/wdp/web/getWeb.sh
#sh getWeb.sh defaultCookie/intl/intlCookie
sh getWeb.sh
#sh getWeb.sh defaultCookie
1
2
3
4
5
6
2
3
4
5
6
# 版本维护
目前版本维护:dev ===> 1.1.0 ===> 1.1.0_release
- dev 新功能,不稳定版本;
- 1.1.0 稳定版本;
- 1.1.0_release 稳定版本;
上次更新: 2023/11/17, 05:08:18