@winner-fed/winner-deploy 3.1.5 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/genDockerPackage.js +3 -3
- package/src/genWebPackage.js +4 -4
- package/src/see.js +12 -4
- package/src/utils.js +0 -4
- package/templates/see/bash/deploy.xml +16 -14
- package/templates/see/bash/scripts/afterInstall.sh +1 -1
- package/templates/see/bash/scripts/install.sh +7 -6
- package/templates/see/bash/scripts/uninstall.sh +3 -3
- package/templates/see/docker/deploy.xml +12 -11
- package/templates/see/python/deploy.xml +16 -14
- package/templates/see/python/scripts/afterInstall.py +3 -2
- package/templates/see/python/scripts/install.py +5 -4
- package/templates/see/python/scripts/uninstall.py +5 -3
package/package.json
CHANGED
package/src/genDockerPackage.js
CHANGED
|
@@ -51,15 +51,15 @@ exports.genDockerPackage = function genDockerPackage (seePackageName, options, h
|
|
|
51
51
|
fs.ensureDirSync(`${tmp}/template`)
|
|
52
52
|
|
|
53
53
|
if (isWinnerProject()) {
|
|
54
|
-
fs.outputFileSync(`./${tmp}/template
|
|
54
|
+
fs.outputFileSync(`./${tmp}/template/config.local.js`, template ? genTemplate(template, variables) : '')
|
|
55
55
|
} else if (isProProject() || isProProject(name)) { // 子包目录 dist/'name'/sysconfig.js
|
|
56
56
|
// 这里做了默认重写
|
|
57
57
|
// 兼容操作员中心产品
|
|
58
58
|
configFileName = 'sysconfig';
|
|
59
|
-
fs.outputFileSync(`./${tmp}/template
|
|
59
|
+
fs.outputFileSync(`./${tmp}/template/sysconfig.js`, template ? genTemplate(template, variables) : '')
|
|
60
60
|
} else {
|
|
61
61
|
// 自定义配置文件的名字
|
|
62
|
-
fs.outputFileSync(`./${tmp}/template/${
|
|
62
|
+
fs.outputFileSync(`./${tmp}/template/${configFileName}.js`, template ? genTemplate(template, variables) : '')
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
// 生成 k8s-deploy-res.yaml
|
package/src/genWebPackage.js
CHANGED
|
@@ -37,15 +37,15 @@ exports.genSeePackage = function genSeePackage (seePackageName, options, handler
|
|
|
37
37
|
// 缺少 template 目录会导致 SEE 平台上传发布物报错
|
|
38
38
|
fs.ensureDirSync(`${tmp}/template`)
|
|
39
39
|
if (isWinnerProject()) {
|
|
40
|
-
fs.outputFileSync(`./${tmp}/template
|
|
40
|
+
fs.outputFileSync(`./${tmp}/template/config.local.js`, template ? genTemplate(template, variables) : '')
|
|
41
41
|
} else if (isProProject() || isProProject(name)) { // 子包目录 dist/'name'/sysconfig.js
|
|
42
42
|
// 这里做了默认重写
|
|
43
43
|
// 兼容操作员中心产品
|
|
44
44
|
configFileName = 'sysconfig';
|
|
45
|
-
fs.outputFileSync(`./${tmp}/template
|
|
45
|
+
fs.outputFileSync(`./${tmp}/template/sysconfig.js`, template ? genTemplate(template, variables) : '')
|
|
46
46
|
} else {
|
|
47
47
|
// 自定义配置文件的名字
|
|
48
|
-
fs.outputFileSync(`./${tmp}/template/${
|
|
48
|
+
fs.outputFileSync(`./${tmp}/template/${configFileName}.js`, template ? genTemplate(template, variables) : '')
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
if (scriptsType === 'python') {
|
|
@@ -86,7 +86,7 @@ exports.genSeePackage = function genSeePackage (seePackageName, options, handler
|
|
|
86
86
|
description
|
|
87
87
|
}))
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
if (handler) {
|
|
91
91
|
handler((cb) => {
|
|
92
92
|
genZipPackage(seePackageName, tmp, () => {
|
package/src/see.js
CHANGED
|
@@ -19,7 +19,9 @@ exports.genDeployXml = function genDeployXml ({
|
|
|
19
19
|
}) {
|
|
20
20
|
const template = fs.readFileSync(resolveFile(`python/deploy.xml`))
|
|
21
21
|
|
|
22
|
-
return tpl(template
|
|
22
|
+
return tpl(template, {
|
|
23
|
+
interpolate: /{{([\s\S]+?)}}/g
|
|
24
|
+
})({
|
|
23
25
|
system,
|
|
24
26
|
type,
|
|
25
27
|
name,
|
|
@@ -42,7 +44,9 @@ exports.genDeployXml = function genDeployXml ({
|
|
|
42
44
|
|
|
43
45
|
exports.genScripts = function genScripts (name, options) {
|
|
44
46
|
const template = fs.readFileSync(resolveFile(`python/scripts/${name}.py`))
|
|
45
|
-
return tpl(template
|
|
47
|
+
return tpl(template, {
|
|
48
|
+
interpolate: /{{([\s\S]+?)}}/g
|
|
49
|
+
})(options)
|
|
46
50
|
}
|
|
47
51
|
|
|
48
52
|
exports.genTemplate = function genTemplate (file, variables = []) {
|
|
@@ -121,7 +125,9 @@ exports.genDockerDeployXml = function genDockerDeployXml ({
|
|
|
121
125
|
}) {
|
|
122
126
|
const template = fs.readFileSync(resolveFile(`docker/deploy.xml`))
|
|
123
127
|
|
|
124
|
-
return tpl(template
|
|
128
|
+
return tpl(template, {
|
|
129
|
+
interpolate: /{{([\s\S]+?)}}/g
|
|
130
|
+
})({
|
|
125
131
|
system,
|
|
126
132
|
type,
|
|
127
133
|
name,
|
|
@@ -171,7 +177,9 @@ exports.genDeployXmlBySh = function genDeployXmlBySh ({
|
|
|
171
177
|
}) {
|
|
172
178
|
const template = fs.readFileSync(resolveFile(`bash/deploy.xml`));
|
|
173
179
|
|
|
174
|
-
return tpl(template
|
|
180
|
+
return tpl(template, {
|
|
181
|
+
interpolate: /{{([\s\S]+?)}}/g
|
|
182
|
+
})({
|
|
175
183
|
system,
|
|
176
184
|
type,
|
|
177
185
|
name,
|
package/src/utils.js
CHANGED
|
@@ -2,39 +2,41 @@
|
|
|
2
2
|
<deploy name="">
|
|
3
3
|
<basic describe="基本信息">
|
|
4
4
|
<packType describe="包类型" options="pack:全量包;patch:补丁包">pack</packType>
|
|
5
|
-
<systemType describe="系统类型"
|
|
6
|
-
<appName describe="发布物名称"
|
|
7
|
-
<appType describe="发布物类型"
|
|
8
|
-
<appDescribe describe="发布包说明"
|
|
9
|
-
<version describe="发布包版本"
|
|
5
|
+
<systemType describe="系统类型">{{ system }}</systemType>
|
|
6
|
+
<appName describe="发布物名称">{{ name }}</appName>
|
|
7
|
+
<appType describe="发布物类型">{{ appType }}</appType>
|
|
8
|
+
<appDescribe describe="发布包说明">{{ description }}</appDescribe>
|
|
9
|
+
<version describe="发布包版本">{{ version }}</version>
|
|
10
10
|
<group>bizframe</group>
|
|
11
11
|
<packInEffect describe="影响的主包(只有补丁需要配置,填写主包的版本号)" />
|
|
12
12
|
</basic>
|
|
13
13
|
<globalConfig describe="系统全局配置" />
|
|
14
14
|
<subSystems describe="子系统集合">
|
|
15
|
-
<system id="
|
|
15
|
+
<system id="{{ name }}" type="{{ type }}" name="{{ name }}" mode="cluster" front="">
|
|
16
16
|
<scale describe="集群规模" />
|
|
17
17
|
<scripts describe="集群脚本集">
|
|
18
18
|
<script name="beforeInstall" path="" describe="安装前处理"/>
|
|
19
|
-
<script name="install" path="./scripts
|
|
20
|
-
<script name="afterInstall" path="./scripts
|
|
19
|
+
<script name="install" path="./scripts/{{ name }}/install.sh" describe="部署"/>
|
|
20
|
+
<script name="afterInstall" path="./scripts/{{ name }}/afterInstall.sh" describe="安装后处理"/>
|
|
21
21
|
<script name="start" path="" describe="启动" />
|
|
22
22
|
<script name="validateStart" path="" describe="启动状态检测" />
|
|
23
23
|
<script name="stop" path="" describe="停止" />
|
|
24
24
|
<script name="validateStop" path="" describe="停止状态监测" />
|
|
25
25
|
<script name="backup" path="" describe="备份" />
|
|
26
26
|
<script name="rollback" path="" describe="回滚" />
|
|
27
|
-
<script name="uninstall" path="./scripts
|
|
27
|
+
<script name="uninstall" path="./scripts/{{ name }}/uninstall.sh" describe="卸载" />
|
|
28
28
|
</scripts>
|
|
29
29
|
<variables describe="集群基本参数">
|
|
30
30
|
<field name="user" label="安装用户" type="input">root</field>
|
|
31
31
|
<field name="workspace" label="前端安装目录" type="input" tooltip="IAR上存放前端根目录">/usr/local/nginx/html</field>
|
|
32
|
-
|
|
32
|
+
<field name="webAppName" label="前端应用名" type="input" tooltip="与IAR中的location前端目录名称保持一致">{{ name }}</field>
|
|
33
|
+
|
|
34
|
+
{{ variables }}
|
|
33
35
|
</variables>
|
|
34
|
-
<config path="./${
|
|
35
|
-
<config path="./scripts
|
|
36
|
-
<config path="./scripts
|
|
37
|
-
<config path="./scripts
|
|
36
|
+
<config path="./${webAppName}/{{ configFileName }}.js" encoding="UTF-8"/>
|
|
37
|
+
<config path="./scripts/{{ name }}/install.sh" encoding="UTF-8"/>
|
|
38
|
+
<config path="./scripts/{{ name }}/afterInstall.sh" encoding="UTF-8"/>
|
|
39
|
+
<config path="./scripts/{{ name }}/uninstall.sh" encoding="UTF-8"/>
|
|
38
40
|
<node describe="节点私有配置信息"/>
|
|
39
41
|
</system>
|
|
40
42
|
</subSystems>
|
|
@@ -4,20 +4,21 @@
|
|
|
4
4
|
# 拷贝前端工程文件到运行目录
|
|
5
5
|
if [ "{{type}}" = "subsystem" ]; then
|
|
6
6
|
# 子系统执行逻辑
|
|
7
|
-
#
|
|
8
|
-
ls -I tmp | xargs
|
|
7
|
+
# 程序执行的当前路径,删除 ${workspace}/{{name}},然后将 tmp/source 的所有文件及文件夹都拷贝到 workspace 目录下
|
|
8
|
+
# ls -I tmp | xargs
|
|
9
|
+
rm -rf ${workspace}/${webAppName}
|
|
9
10
|
\cp -rf tmp/source/* ${workspace}/
|
|
10
11
|
else
|
|
11
12
|
# 主系统执行逻辑
|
|
12
|
-
if [ -d "${workspace}
|
|
13
|
-
cd "${workspace}
|
|
13
|
+
if [ -d "${workspace}/${webAppName}" ]; then
|
|
14
|
+
cd "${workspace}/${webAppName}"
|
|
14
15
|
# 查看文件名带有 "manifest." 文件,然后进行删除
|
|
15
16
|
ls | grep "manifest." | xargs rm -rf
|
|
16
17
|
rm -rf frame common static sysconfig.js index.html
|
|
17
18
|
cd -
|
|
18
19
|
fi
|
|
19
|
-
mkdir -p ${workspace}
|
|
20
|
-
\cp -rf tmp/source/* ${workspace}
|
|
20
|
+
mkdir -p ${workspace}/${webAppName}
|
|
21
|
+
\cp -rf tmp/source/* ${workspace}/${webAppName}
|
|
21
22
|
fi
|
|
22
23
|
# 扫尾清除
|
|
23
24
|
rm -rf tmp
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
if [ "{{type}}" = "subsystem" ]; then
|
|
5
5
|
# 子系统执行逻辑
|
|
6
6
|
if [ -d "${workspace}" ]; then
|
|
7
|
-
rm -rf ${workspace}
|
|
7
|
+
rm -rf ${workspace}/${webAppName}
|
|
8
8
|
fi
|
|
9
9
|
else
|
|
10
10
|
# 主系统执行逻辑
|
|
11
|
-
if [ -d "${workspace}
|
|
12
|
-
rm -rf ${workspace}
|
|
11
|
+
if [ -d "${workspace}/${webAppName}" ]; then
|
|
12
|
+
rm -rf ${workspace}/${webAppName}
|
|
13
13
|
fi
|
|
14
14
|
fi
|
|
15
15
|
exit 0
|
|
@@ -2,26 +2,27 @@
|
|
|
2
2
|
<deploy name="" type="docker" arch="k8s">
|
|
3
3
|
<basic describe="基本信息">
|
|
4
4
|
<packType describe="包类型" options="pack:全量包;patch:补丁包">pack</packType>
|
|
5
|
-
<systemType describe="系统类型"
|
|
6
|
-
<appType describe="应用类型"
|
|
7
|
-
<appName describe="应用名称"
|
|
8
|
-
<appDescribe describe="应用说明"
|
|
9
|
-
<version describe="应用版本"
|
|
5
|
+
<systemType describe="系统类型">{{ system }}</systemType>
|
|
6
|
+
<appType describe="应用类型">{{ type }}</appType>
|
|
7
|
+
<appName describe="应用名称">{{ name }}</appName>
|
|
8
|
+
<appDescribe describe="应用说明">{{ description }}</appDescribe>
|
|
9
|
+
<version describe="应用版本">{{ version }}</version>
|
|
10
10
|
<group>bizframe</group>
|
|
11
11
|
<packInEffect describe="影响的主包(只有补丁需要配置,填写主包的版本号)" />
|
|
12
12
|
</basic>
|
|
13
13
|
<globalConfig describe="系统全局配置" />
|
|
14
14
|
<subSystems describe="子系统集合">
|
|
15
|
-
<system id="
|
|
15
|
+
<system id="{{ name }}" type="" name="{{ name }}" mode="cluster" front="">
|
|
16
16
|
<variables describe="集群基本参数">
|
|
17
17
|
<field name="user" label="安装用户" type="input">root</field>
|
|
18
|
-
<field name="workspace" label="前端安装目录" type="
|
|
18
|
+
<field name="workspace" label="前端安装目录" type="hidden" tooltip="IAR上存放前端目录" >/home/hsiar/hsiar-green/html</field>
|
|
19
|
+
<field name="webAppName" label="前端应用名" type="input" tooltip="与IAR中的location前端目录名称保持一致">{{ name }}</field>
|
|
19
20
|
|
|
20
21
|
<!-- K8S部署配置 -->
|
|
21
22
|
<field name="division_k8s" label="K8S部署配置" type="division" fold="false">
|
|
22
|
-
<field name="web_app_web_service_name" label="Web服务名" type="input" required="false" tooltip="用于service的域名配置,需与HSIAR
|
|
23
|
+
<field name="web_app_web_service_name" label="Web服务名" type="input" required="false" tooltip="用于service的域名配置,需与HSIAR的路由对应,默认为{{web_app_web_service_name}}">{{web_app_web_service_name}}</field>
|
|
23
24
|
<field name="registry_url" label="镜像中心" type="input" required="false">package.hundsun.com</field>
|
|
24
|
-
<field name="image" label="镜像" type="input" required="true"
|
|
25
|
+
<field name="image" label="镜像" type="input" required="true">{{dockerImage}}</field>
|
|
25
26
|
<field name="image_pull_policy" label="镜像拉取策略" visible="true" type="select" options="Always:Always;IfNotPresent:IfNotPresent;Never:Never">IfNotPresent</field>
|
|
26
27
|
<field name="image_pull_secrets_enable" label="镜像拉取凭证开启" type="switchForm" options="true:ON;false:OFF" default="true">
|
|
27
28
|
<field name="image_pull_secrets" label="镜像拉取凭证" type="input" required="true" visible="true">global</field>
|
|
@@ -37,9 +38,9 @@
|
|
|
37
38
|
<field name="liveness_probe_enable" label="存活检查探针开启" type="switch" options="true:ON;false:OFF">false</field>
|
|
38
39
|
</field>
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
{{ variables }}
|
|
41
42
|
</variables>
|
|
42
|
-
<config path="./${
|
|
43
|
+
<config path="./${webAppName}/{{ configFileName }}.js" encoding="UTF-8"/>
|
|
43
44
|
<config reference="" encoding="utf-8" path="./k8s-deploy-res.yaml" />
|
|
44
45
|
<node describe="节点私有配置信息" />
|
|
45
46
|
</system>
|
|
@@ -2,39 +2,41 @@
|
|
|
2
2
|
<deploy name="">
|
|
3
3
|
<basic describe="基本信息">
|
|
4
4
|
<packType describe="包类型" options="pack:全量包;patch:补丁包">pack</packType>
|
|
5
|
-
<systemType describe="系统类型"
|
|
6
|
-
<appName describe="发布物名称"
|
|
7
|
-
<appType describe="发布物类型"
|
|
8
|
-
<appDescribe describe="发布包说明"
|
|
9
|
-
<version describe="发布包版本"
|
|
5
|
+
<systemType describe="系统类型">{{ system }}</systemType>
|
|
6
|
+
<appName describe="发布物名称">{{ name }}</appName>
|
|
7
|
+
<appType describe="发布物类型">{{ appType }}</appType>
|
|
8
|
+
<appDescribe describe="发布包说明">{{ description }}</appDescribe>
|
|
9
|
+
<version describe="发布包版本">{{ version }}</version>
|
|
10
10
|
<group>bizframe</group>
|
|
11
11
|
<packInEffect describe="影响的主包(只有补丁需要配置,填写主包的版本号)" />
|
|
12
12
|
</basic>
|
|
13
13
|
<globalConfig describe="系统全局配置" />
|
|
14
14
|
<subSystems describe="子系统集合">
|
|
15
|
-
<system id="
|
|
15
|
+
<system id="{{ name }}" type="{{ type }}" name="{{ name }}" mode="cluster" front="">
|
|
16
16
|
<scale describe="集群规模" />
|
|
17
17
|
<scripts describe="集群脚本集">
|
|
18
18
|
<script name="beforeInstall" path="" describe="安装前处理"/>
|
|
19
|
-
<script name="install" path="./scripts
|
|
20
|
-
<script name="afterInstall" path="./scripts
|
|
19
|
+
<script name="install" path="./scripts/{{ name }}/install.py" describe="部署"/>
|
|
20
|
+
<script name="afterInstall" path="./scripts/{{ name }}/afterInstall.py" describe="安装后处理"/>
|
|
21
21
|
<script name="start" path="" describe="启动" />
|
|
22
22
|
<script name="validateStart" path="" describe="启动状态检测" />
|
|
23
23
|
<script name="stop" path="" describe="停止" />
|
|
24
24
|
<script name="validateStop" path="" describe="停止状态监测" />
|
|
25
25
|
<script name="backup" path="" describe="备份" />
|
|
26
26
|
<script name="rollback" path="" describe="回滚" />
|
|
27
|
-
<script name="uninstall" path="./scripts
|
|
27
|
+
<script name="uninstall" path="./scripts/{{ name }}/uninstall.py" describe="卸载" />
|
|
28
28
|
</scripts>
|
|
29
29
|
<variables describe="集群基本参数">
|
|
30
30
|
<field name="user" label="安装用户" type="input">root</field>
|
|
31
31
|
<field name="workspace" label="前端安装目录" type="input" tooltip="IAR上存放前端根目录">/usr/local/nginx/html</field>
|
|
32
|
-
|
|
32
|
+
<field name="webAppName" label="前端应用名" type="input" tooltip="与IAR中的location前端目录名称保持一致">{{ name }}</field>
|
|
33
|
+
|
|
34
|
+
{{ variables }}
|
|
33
35
|
</variables>
|
|
34
|
-
<config path="./${
|
|
35
|
-
<config path="./scripts
|
|
36
|
-
<config path="./scripts
|
|
37
|
-
<config path="./scripts
|
|
36
|
+
<config path="./${webAppName}/{{ configFileName }}.js" encoding="UTF-8"/>
|
|
37
|
+
<config path="./scripts/{{ name }}/install.py" encoding="UTF-8"/>
|
|
38
|
+
<config path="./scripts/{{ name }}/afterInstall.py" encoding="UTF-8"/>
|
|
39
|
+
<config path="./scripts/{{ name }}/uninstall.py" encoding="UTF-8"/>
|
|
38
40
|
<node describe="节点私有配置信息"/>
|
|
39
41
|
</system>
|
|
40
42
|
</subSystems>
|
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
import os
|
|
6
6
|
import utils
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
# 读取 deploy.xml 配置文件定义的 webAppName
|
|
9
|
+
webAppName = "${webAppName}"
|
|
9
10
|
# TIPS: 执行脚本的路径是在 安装目录 下,对应 deploy.xml 里的 workspace 字段
|
|
10
|
-
pkgPath = os.path.join(os.getcwd(),
|
|
11
|
+
pkgPath = os.path.join(os.getcwd(), webAppName)
|
|
11
12
|
|
|
12
13
|
def chmodPkg():
|
|
13
14
|
for root,dirs,files in os.walk(pkgPath):
|
|
@@ -19,9 +19,10 @@ except:
|
|
|
19
19
|
print("Failed to perform module reload, continue installation")
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
name = "
|
|
23
|
-
type = "
|
|
24
|
-
|
|
22
|
+
name = "{{name}}"
|
|
23
|
+
type = "{{type}}"
|
|
24
|
+
# 读取 deploy.xml 配置文件定义的 webAppName
|
|
25
|
+
webAppName = "${webAppName}"
|
|
25
26
|
|
|
26
27
|
def install(name, type):
|
|
27
28
|
conf = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), "conf")
|
|
@@ -46,7 +47,7 @@ def install(name, type):
|
|
|
46
47
|
source = ""
|
|
47
48
|
|
|
48
49
|
if(type == "bizframe"):
|
|
49
|
-
destinationdir = "./" +
|
|
50
|
+
destinationdir = "./" + webAppName + "/" + fileJson[x]["dir"]
|
|
50
51
|
source = "./tmp/source/" + fileJson[x]["path"]
|
|
51
52
|
elif(type == "subsystem"):
|
|
52
53
|
destinationdir = "./" + fileJson[x]["dir"]
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
import os
|
|
5
5
|
import utils
|
|
6
6
|
|
|
7
|
-
name = "
|
|
8
|
-
type = "
|
|
7
|
+
name = "{{name}}"
|
|
8
|
+
type = "{{type}}"
|
|
9
|
+
# 读取 deploy.xml 配置文件定义的 webAppName
|
|
10
|
+
webAppName = "${webAppName}"
|
|
9
11
|
|
|
10
|
-
utils.clear(
|
|
12
|
+
utils.clear(webAppName, type)
|
|
11
13
|
|
|
12
14
|
os.popen("rm -rf ./scripts/" + name)
|