Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
duckula
duckula-ops
提交
2d1b8272
duckula-ops
项目概览
duckula
/
duckula-ops
通知
6
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
duckula-ops
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2d1b8272
编写于
7月 22, 2021
作者:
偏锋书生
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1
上级
53e70292
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
45 addition
and
17 deletion
+45
-17
src/main/java/net/wicp/tams/app/duckula/controller/service/ContextInit.java
...wicp/tams/app/duckula/controller/service/ContextInit.java
+4
-3
src/main/java/net/wicp/tams/duckula/ops/pages/devops/FlinkConfig.java
...a/net/wicp/tams/duckula/ops/pages/devops/FlinkConfig.java
+41
-14
未找到文件。
src/main/java/net/wicp/tams/app/duckula/controller/service/ContextInit.java
浏览文件 @
2d1b8272
...
...
@@ -18,13 +18,14 @@ public class ContextInit implements ApplicationContextAware, ServletContextAware
public
static
volatile
String
pagePath
;
// page页面存放的根目录
public
static
volatile
String
webRootPath
;
// Webroot所在目录
@Autowired
private
SysGlobalMapper
sysGlobalMapper
;
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
//SysGlobalMapper sysGlobalMapper = applicationContext.getBean(SysGlobalMapper.class);
// SysGlobalMapper sysGlobalMapper =
// applicationContext.getBean(SysGlobalMapper.class);
SysGlobal
sysGlobal
=
sysGlobalMapper
.
selectById
(
1
l
);
if
(
sysGlobal
!=
null
)
{
ConfigGlobleName
.
putAwsConfig
(
sysGlobal
);
...
...
@@ -35,7 +36,7 @@ public class ContextInit implements ApplicationContextAware, ServletContextAware
public
void
setServletContext
(
ServletContext
servletContext
)
{
String
realPath
=
servletContext
.
getRealPath
(
"/"
);
ContextInit
.
webRootPath
=
realPath
;
// 配置根目录
String
rootPath
=
Thread
.
currentThread
().
getContextClassLoader
().
getResource
(
"."
).
getPath
();
String
rootPath
=
""
;
// Thread.currentThread().getContextClassLoader().getResource(".").getPath();//TODO在springjar独立运行时空指针,后面处理
String
appPackage
=
servletContext
.
getInitParameter
(
"tapestry.app-package"
);
ContextInit
.
pagePath
=
String
.
format
(
"%s%s/pages"
,
rootPath
,
appPackage
.
replace
(
"."
,
"/"
));
}
...
...
src/main/java/net/wicp/tams/duckula/ops/pages/devops/FlinkConfig.java
浏览文件 @
2d1b8272
...
...
@@ -114,22 +114,49 @@ public class FlinkConfig extends ParentPageBean<DevopsFlink> {
try
{
String
remoteDir
=
"~/flink/deploy"
;
conn
.
executeCommand
(
"mkdir -p "
+
remoteDir
);
conn
.
scpDir
(
localPath
,
remoteDir
,
"0744"
,
new
String
[]
{},
new
String
[]
{});
Result
result
=
conn
.
executeCommand
(
"sh "
+
remoteDir
+
"/package.sh prod-bigdata-flink01 prod-bigdata-flink02"
);
// TODO 不能打印日志
if
(
result
.
isSuc
())
{
String
message
=
result
.
getMessage
();
if
(
message
.
contains
(
"请手工执行distributeconf.sh"
))
{
Result
disResult
=
conn
.
executeCommand
(
"sh "
+
remoteDir
+
"/distributeconf.sh prod-bigdata-flink01 prod-bigdata-flink02"
);
if
(
disResult
.
isSuc
())
{
// 安装成功改状态
for
(
DevopsFlink
temp
:
list
)
{
temp
.
setIsInstall
(
YesOrNo
.
yes
.
name
());
devopsFlinkMapper
.
updateByPrimaryKeySelective
(
temp
);
conn
.
executeCommand
(
"rm -rf ~/flink/*log "
);
conn
.
scpDir
(
localPath
,
remoteDir
,
"0744"
,
new
String
[]
{},
new
String
[]
{});
// TODO 调试方便
conn
.
executeCommand
(
"sh "
+
remoteDir
+
"/package.sh prod-bigdata-flink01 prod-bigdata-flink02 &>~/flink/installlog"
);
TimeAssist
.
reDoWaitInit
(
"flinkconfig-install"
);
while
(
true
)
{
try
{
boolean
reDoWait
=
TimeAssist
.
reDoWait
(
"flinkconfig-install"
,
9
);
// 9次512秒9分钟不到
if
(
reDoWait
)
{
break
;
}
Result
freeResult
=
conn
.
executeCommand
(
"cat ~/flink/installlog"
);
if
(
freeResult
.
isSuc
())
{
if
(
freeResult
.
getMessage
().
contains
(
"请手工执行distributeconf.sh"
))
{
// 执行完了
conn
.
executeCommand
(
"sh "
+
remoteDir
+
"/distributeconf.sh prod-bigdata-flink01 prod-bigdata-flink02 &>~/flink/distributeconflog"
);
TimeAssist
.
reDoWaitInit
(
"flinkconfig-distributeconf"
);
while
(
true
)
{
boolean
reDoWait2
=
TimeAssist
.
reDoWait
(
"flinkconfig-distributeconf"
,
9
);
// 9次512秒9分钟不到
if
(
reDoWait2
)
{
break
;
}
Result
distributeconfResult
=
conn
.
executeCommand
(
"cat ~/flink/distributeconflog"
);
if
(
distributeconfResult
.
isSuc
())
{
if
(
distributeconfResult
.
getMessage
().
contains
(
"部署成功"
))
{
// 第二步成功
// 安装成功改状态
for
(
DevopsFlink
temp
:
list
)
{
temp
.
setIsInstall
(
YesOrNo
.
yes
.
name
());
devopsFlinkMapper
.
updateByPrimaryKeySelective
(
temp
);
}
break
;
}
else
if
(
distributeconfResult
.
getMessage
().
contains
(
"部署失败"
))
{
break
;
}
else
{
// 未完成,继续跑
}
}
}
break
;
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
finally
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录