Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
U
ubains-module-test
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
郑晓兵
ubains-module-test
Commits
9f8a1cb0
提交
9f8a1cb0
authored
5月 14, 2026
作者:
陈泽健
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(edit):调整补充远程自动化部署需求文档描述,约束AI执行
上级
f5495e58
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
439 行增加
和
1 行删除
+439
-1
check_data_dir.ps1
AuxiliaryTool/ScriptTool/RemoteDeploy/check_data_dir.ps1
+47
-0
check_deploy_packages.ps1
...aryTool/ScriptTool/RemoteDeploy/check_deploy_packages.ps1
+26
-0
execute_deploy.ps1
AuxiliaryTool/ScriptTool/RemoteDeploy/execute_deploy.ps1
+153
-0
extract_and_deploy.ps1
AuxiliaryTool/ScriptTool/RemoteDeploy/extract_and_deploy.ps1
+139
-0
monitor_deploy.ps1
AuxiliaryTool/ScriptTool/RemoteDeploy/monitor_deploy.ps1
+55
-0
quick_check.ps1
AuxiliaryTool/ScriptTool/RemoteDeploy/quick_check.ps1
+17
-0
_PRD_远程自动化部署_需求文档.md
Docs/PRD/远程自动化部署/_PRD_远程自动化部署_需求文档.md
+2
-1
没有找到文件。
AuxiliaryTool/ScriptTool/RemoteDeploy/check_data_dir.ps1
0 → 100644
浏览文件 @
9f8a1cb0
$ScriptDir
=
Split-Path
-Parent
$MyInvocation
.MyCommand.Path
$PlinkPath
=
Join-Path
$ScriptDir
"plink.exe"
function
Invoke-SSH
{
param
([
string
]
$Command
)
$psi
=
New-Object
System.Diagnostics.ProcessStartInfo
$psi
.FileName
=
$PlinkPath
$psi
.Arguments
=
"-pw Ubains@123 -P 22 root@192.168.5.52
$Command
"
$psi
.UseShellExecute
=
$false
$psi
.RedirectStandardOutput
=
$true
$psi
.RedirectStandardError
=
$true
$psi
.CreateNoWindow
=
$true
$p
=
New-Object
System.Diagnostics.Process
$p
.StartInfo
=
$psi
$p
.Start
()
| Out-Null
$p
.WaitForExit
(
60000
)
return
$p
.StandardOutput.ReadToEnd
()
}
Write-Host
"========================================"
-ForegroundColor Cyan
Write-Host
"Checking /data directory on server"
-ForegroundColor Cyan
Write-Host
"========================================"
-ForegroundColor Cyan
Write-Host
""
$result
=
Invoke-SSH -Command
"ls -la /data"
Write-Host
$result
Write-Host
""
Write-Host
"========================================"
-ForegroundColor Cyan
Write-Host
"Looking for deployment scripts"
-ForegroundColor Cyan
Write-Host
"========================================"
-ForegroundColor Cyan
Write-Host
""
$scripts
=
Invoke-SSH -Command
"find /data -name '*.sh' -type f 2>/dev/null | head -20"
Write-Host
$scripts
Write-Host
""
Write-Host
"========================================"
-ForegroundColor Cyan
Write-Host
"Checking Docker status"
-ForegroundColor Cyan
Write-Host
"========================================"
-ForegroundColor Cyan
Write-Host
""
$docker
=
Invoke-SSH -Command
"docker ps -a 2>&1"
Write-Host
$docker
AuxiliaryTool/ScriptTool/RemoteDeploy/check_deploy_packages.ps1
0 → 100644
浏览文件 @
9f8a1cb0
$ScriptDir
=
Split-Path
-Parent
$MyInvocation
.MyCommand.Path
$PlinkPath
=
Join-Path
$ScriptDir
"plink.exe"
$ServerIP
=
"192.168.5.52"
$Username
=
"root"
$Password
=
"Ubains@123"
$SSHPort
=
22
Write-Host
"Checking deployment packages on server..."
-ForegroundColor Cyan
Write-Host
""
$psi
=
New-Object
System.Diagnostics.ProcessStartInfo
$psi
.FileName
=
$PlinkPath
$psi
.Arguments
=
"-pw
$Password
-P
$SSHPort
${
Username
}
@
${
ServerIP
}
'ls -la /data && echo --- && find /data -maxdepth 2 -name *.sh -type f 2>/dev/null'"
$psi
.UseShellExecute
=
$false
$psi
.RedirectStandardOutput
=
$true
$psi
.RedirectStandardError
=
$true
$psi
.CreateNoWindow
=
$true
$p
=
New-Object
System.Diagnostics.Process
$p
.StartInfo
=
$psi
$p
.Start
()
| Out-Null
$p
.WaitForExit
(
60000
)
$stdout
=
$p
.StandardOutput.ReadToEnd
()
Write-Host
$stdout
AuxiliaryTool/ScriptTool/RemoteDeploy/execute_deploy.ps1
0 → 100644
浏览文件 @
9f8a1cb0
$ScriptDir
=
Split-Path
-Parent
$MyInvocation
.MyCommand.Path
$PlinkPath
=
Join-Path
$ScriptDir
"plink.exe"
function
Invoke-SSH
{
param
([
string
]
$Command
,
[
int
]
$TimeoutMs
=
600000
)
$psi
=
New-Object
System.Diagnostics.ProcessStartInfo
$psi
.FileName
=
$PlinkPath
$psi
.Arguments
=
"-pw Ubains@123 -P 22 root@192.168.5.52
$Command
"
$psi
.UseShellExecute
=
$false
$psi
.RedirectStandardOutput
=
$true
$psi
.RedirectStandardError
=
$true
$psi
.CreateNoWindow
=
$true
$p
=
New-Object
System.Diagnostics.Process
$p
.StartInfo
=
$psi
$p
.Start
()
| Out-Null
$p
.WaitForExit
(
$TimeoutMs
)
$stdout
=
$p
.StandardOutput.ReadToEnd
()
$stderr
=
$p
.StandardError.ReadToEnd
()
return
@
{
Output
=
$stdout
Error
=
$stderr
ExitCode
=
$p
.ExitCode
}
}
Write-Host
"========================================"
-ForegroundColor Cyan
Write-Host
"Executing Deployment Script"
-ForegroundColor Cyan
Write-Host
"========================================"
-ForegroundColor Cyan
Write-Host
""
# First, let's check the deployment script help
Write-Host
"Step 1: Checking deployment script information..."
-ForegroundColor Yellow
$helpResult
=
Invoke-SSH -Command
"cd /data/offline_auto_unifiedPlatform && head -50 new_auto.sh"
Write-Host
"Deployment script header:"
-ForegroundColor Gray
Write-Host
(
$helpResult
.Output |
Select-Object
-First 30
)
Write-Host
""
# Check script permissions and make executable
Write-Host
"Step 2: Setting script permissions..."
-ForegroundColor Yellow
$chmodResult
=
Invoke-SSH -Command
"chmod +x /data/offline_auto_unifiedPlatform/*.sh"
Write-Host
"Permissions set"
-ForegroundColor Green
Write-Host
""
# Start the deployment script in background with logging
Write-Host
"Step 3: Starting deployment script..."
-ForegroundColor Yellow
Write-Host
"This will take approximately 40 minutes..."
-ForegroundColor Gray
Write-Host
""
# Create log directory
$mkdirResult
=
Invoke-SSH -Command
"mkdir -p /var/log/deploy"
# Run deployment in background with output logging
$deployCmd
=
"cd /data/offline_auto_unifiedPlatform && nohup bash new_auto.sh > /var/log/deploy/deploy.log 2>&1 & echo
$!
"
$pidResult
=
Invoke-SSH -Command
$deployCmd
$deployPid
=
$pidResult
.Output.Trim
()
Write-Host
"Deployment started with PID:
$deployPid
"
-ForegroundColor Green
Write-Host
"Log file: /var/log/deploy/deploy.log"
-ForegroundColor Gray
Write-Host
""
# Monitor initial output
Write-Host
"Waiting for deployment to initialize..."
-ForegroundColor Yellow
Start-Sleep
-Seconds 10
# Check if process is still running
$checkResult
=
Invoke-SSH -Command
"ps aux | grep
$deployPid
| grep -v grep"
if
(
$checkResult
.Output
)
{
Write-Host
"Deployment process is running!"
-ForegroundColor Green
Write-Host
""
# Show initial log output
$logResult
=
Invoke-SSH -Command
"tail -50 /var/log/deploy/deploy.log 2>/dev/null || echo 'Log not available yet'"
if
(
$logResult
.Output -ne
"Log not available yet"
)
{
Write-Host
"Initial deployment output:"
-ForegroundColor Gray
Write-Host
$logResult
.Output
}
}
else
{
Write-Host
"Deployment process may have completed quickly or exited"
-ForegroundColor Yellow
Write-Host
""
# Check exit status
$logResult
=
Invoke-SSH -Command
"cat /var/log/deploy/deploy.log 2>/dev/null || echo 'No log file'"
Write-Host
"Deployment log:"
-ForegroundColor Gray
Write-Host
$logResult
.Output
}
Write-Host
""
Write-Host
"========================================"
-ForegroundColor Green
Write-Host
"Deployment is running in background!"
-ForegroundColor Green
Write-Host
"========================================"
-ForegroundColor Green
Write-Host
""
Write-Host
"To monitor deployment progress, SSH into server and run:"
-ForegroundColor Yellow
Write-Host
" tail -f /var/log/deploy/deploy.log"
-ForegroundColor Gray
Write-Host
""
Write-Host
"To check if deployment is still running:"
-ForegroundColor Yellow
Write-Host
" ps aux | grep new_auto.sh"
-ForegroundColor Gray
Write-Host
""
# Setup monitoring loop
Write-Host
"Press Ctrl+C to stop monitoring"
-ForegroundColor Yellow
Write-Host
"Monitoring deployment progress (will show last 20 lines every 30 seconds)..."
-ForegroundColor Gray
Write-Host
""
$maxWait
=
3600
# 60 minutes max
$elapsed
=
0
$lastLines
=
""
while
(
$elapsed
-lt
$maxWait
)
{
Start-Sleep
-Seconds 30
$elapsed
+
=
30
$minutes
=
[
math]::Floor
(
$elapsed
/ 60
)
# Get latest log lines
$logResult
=
Invoke-SSH -Command
"tail -20 /var/log/deploy/deploy.log 2>/dev/null"
if
(
$logResult
.Output -and
$logResult
.Output -ne
$lastLines
)
{
$lastLines
=
$logResult
.Output
Write-Host
"========================================"
-ForegroundColor DarkGray
Write-Host
"Progress update (
$minutes
minutes):"
-ForegroundColor Cyan
Write-Host
"========================================"
-ForegroundColor DarkGray
Write-Host
$lastLines
Write-Host
""
}
# Check if process still running
$checkResult
=
Invoke-SSH -Command
"ps aux | grep new_auto.sh | grep -v grep | wc -l"
if
(
$checkResult
.Output.Trim
()
-eq
"0"
)
{
Write-Host
"Deployment process has completed!"
-ForegroundColor Green
Write-Host
""
# Show final log
$finalLog
=
Invoke-SSH -Command
"tail -100 /var/log/deploy/deploy.log"
Write-Host
"Final deployment log:"
-ForegroundColor Gray
Write-Host
$finalLog
.Output
break
}
}
Write-Host
""
Write-Host
"========================================"
-ForegroundColor Green
Write-Host
"Deployment monitoring completed!"
-ForegroundColor Green
Write-Host
"========================================"
-ForegroundColor Green
Write-Host
""
AuxiliaryTool/ScriptTool/RemoteDeploy/extract_and_deploy.ps1
0 → 100644
浏览文件 @
9f8a1cb0
$ScriptDir
=
Split-Path
-Parent
$MyInvocation
.MyCommand.Path
$PlinkPath
=
Join-Path
$ScriptDir
"plink.exe"
function
Invoke-SSH
{
param
([
string
]
$Command
,
[
int
]
$TimeoutMs
=
600000
)
$psi
=
New-Object
System.Diagnostics.ProcessStartInfo
$psi
.FileName
=
$PlinkPath
$psi
.Arguments
=
"-pw Ubains@123 -P 22 root@192.168.5.52
$Command
"
$psi
.UseShellExecute
=
$false
$psi
.RedirectStandardOutput
=
$true
$psi
.RedirectStandardError
=
$true
$psi
.CreateNoWindow
=
$true
$p
=
New-Object
System.Diagnostics.Process
$p
.StartInfo
=
$psi
$p
.Start
()
| Out-Null
$p
.WaitForExit
(
$TimeoutMs
)
$stdout
=
$p
.StandardOutput.ReadToEnd
()
$stderr
=
$p
.StandardError.ReadToEnd
()
return
@
{
Output
=
$stdout
Error
=
$stderr
ExitCode
=
$p
.ExitCode
}
}
Write-Host
"========================================"
-ForegroundColor Cyan
Write-Host
"Deployment Package Extraction & Deploy"
-ForegroundColor Cyan
Write-Host
"========================================"
-ForegroundColor Cyan
Write-Host
""
# Step 1: Verify MD5 checksum
Write-Host
"Step 1: Verifying MD5 checksum..."
-ForegroundColor Yellow
$md5Result
=
Invoke-SSH -Command
"cd /data && md5sum -c offline_auto_unifiedPlatform.tar.gz.md5"
if
(
$md5Result
.Output -match
"OK"
)
{
Write-Host
"MD5 checksum verified: OK"
-ForegroundColor Green
}
else
{
Write-Host
"MD5 checksum check:"
-ForegroundColor Yellow
Write-Host
$md5Result
.Output
Write-Host
"Warning: MD5 check failed, but continuing..."
-ForegroundColor Yellow
}
Write-Host
""
# Step 2: Extract deployment package
Write-Host
"Step 2: Extracting deployment package..."
-ForegroundColor Yellow
Write-Host
"This may take 10-30 minutes depending on file size..."
-ForegroundColor Gray
Write-Host
""
# Extract in background with nohup
$extractCmd
=
"cd /data && nohup tar -xzf offline_auto_unifiedPlatform.tar.gz > /tmp/extract.log 2>&1 & echo
$!
"
$pidResult
=
Invoke-SSH -Command
$extractCmd
Write-Host
"Extraction process started with PID:
$(
$pidResult
.Output.Trim
(
)
)"
-ForegroundColor Green
Write-Host
"You can monitor progress with: tail -f /tmp/extract.log"
-ForegroundColor Gray
Write-Host
""
# Wait a bit and check if extraction is happening
Start-Sleep
-Seconds 10
$checkResult
=
Invoke-SSH -Command
"ps aux | grep tar | grep -v grep"
if
(
$checkResult
.Output
)
{
Write-Host
"Extraction is in progress..."
-ForegroundColor Green
Write-Host
$checkResult
.Output
Write-Host
""
}
else
{
# Check if extraction completed quickly
$lsResult
=
Invoke-SSH -Command
"ls -la /data | grep -E '^d'"
Write-Host
"Current directories in /data:"
-ForegroundColor Gray
Write-Host
$lsResult
.Output
Write-Host
""
}
# Step 3: Check for deployment scripts after extraction
Write-Host
"Step 3: Looking for deployment scripts..."
-ForegroundColor Yellow
Write-Host
"Waiting for extraction to complete..."
-ForegroundColor Gray
Write-Host
""
# Wait for extraction (check every 30 seconds)
$maxWait
=
1800
# 30 minutes max
$elapsed
=
0
while
(
$elapsed
-lt
$maxWait
)
{
$checkExtract
=
Invoke-SSH -Command
"test -f /tmp/extract.log && tail -5 /tmp/extract.log || echo 'no log'"
if
(
$checkExtract
.Output -notmatch
"no log"
)
{
Write-Host
"Extract log:
$(
$checkExtract
.Output.Trim
(
)
)"
-ForegroundColor Gray
}
# Check if tar process is still running
$tarRunning
=
Invoke-SSH -Command
"ps aux | grep 'tar.*offline_auto' | grep -v grep | wc -l"
if
(
$tarRunning
.Output.Trim
()
-eq
"0"
)
{
Write-Host
"Extraction completed!"
-ForegroundColor Green
break
}
Start-Sleep
-Seconds 30
$elapsed
+
=
30
$minutes
=
[
math]::Floor
(
$elapsed
/ 60
)
Write-Host
"Still extracting... (
$minutes
minutes elapsed)"
-ForegroundColor Yellow
}
Write-Host
""
# Final check of extracted contents
Write-Host
"Step 4: Checking extracted contents..."
-ForegroundColor Yellow
$lsResult
=
Invoke-SSH -Command
"ls -la /data"
Write-Host
"Contents of /data:"
-ForegroundColor Gray
Write-Host
$lsResult
.Output
Write-Host
""
# Find deployment scripts
$scriptsResult
=
Invoke-SSH -Command
"find /data -maxdepth 3 -name '*.sh' -type f 2>/dev/null | head -20"
if
(
$scriptsResult
.Output
)
{
Write-Host
"Found deployment scripts:"
-ForegroundColor Green
$scriptsResult
.Output -split
"
`n
"
|
Where
-Object
{
$_
-ne
""
}
|
ForEach
-Object
{
Write-Host
"
$_
"
-ForegroundColor Gray
}
}
else
{
Write-Host
"No deployment scripts found yet"
-ForegroundColor Yellow
}
Write-Host
""
Write-Host
"========================================"
-ForegroundColor Green
Write-Host
"Extraction completed!"
-ForegroundColor Green
Write-Host
"========================================"
-ForegroundColor Green
Write-Host
""
Write-Host
"Next steps:"
-ForegroundColor Yellow
Write-Host
"1. Check the extracted deployment scripts above"
-ForegroundColor Gray
Write-Host
"2. Run the main deployment script"
-ForegroundColor Gray
Write-Host
"3. Monitor deployment progress"
-ForegroundColor Gray
Write-Host
""
AuxiliaryTool/ScriptTool/RemoteDeploy/monitor_deploy.ps1
0 → 100644
浏览文件 @
9f8a1cb0
# Simple Deployment Monitor
$PlinkPath
=
"E:\GithubData\ubains-module-test\AuxiliaryTool\ScriptTool\RemoteDeploy\plink.exe"
Write-Host
"========================================"
-ForegroundColor Cyan
Write-Host
"Deployment Status Monitor"
-ForegroundColor Cyan
Write-Host
"========================================"
-ForegroundColor Cyan
Write-Host
""
function
Invoke-SSH
{
param
([
string
]
$Command
)
$psi
=
New-Object
System.Diagnostics.ProcessStartInfo
$psi
.FileName
=
$PlinkPath
$psi
.Arguments
=
"-pw Ubains@123 -P 22 root@192.168.5.52
$Command
"
$psi
.UseShellExecute
=
$false
$psi
.RedirectStandardOutput
=
$true
$psi
.RedirectStandardError
=
$true
$psi
.CreateNoWindow
=
$true
$p
=
New-Object
System.Diagnostics.Process
$p
.StartInfo
=
$psi
$p
.Start
()
| Out-Null
$p
.WaitForExit
(
60000
)
return
$p
.StandardOutput.ReadToEnd
()
}
# Check if deployment is still running
$running
=
Invoke-SSH -Command
"ps aux | grep new_auto.sh | grep -v grep | wc -l"
if
(
$running
.Trim
()
-eq
"1"
)
{
Write-Host
"Deployment Status: RUNNING"
-ForegroundColor Green
}
else
{
Write-Host
"Deployment Status: COMPLETED or STOPPED"
-ForegroundColor Yellow
}
Write-Host
""
# Show recent log output
Write-Host
"Recent deployment log (last 30 lines):"
-ForegroundColor Gray
Write-Host
"========================================"
-ForegroundColor Gray
$log
=
Invoke-SSH -Command
"tail -30 /var/log/deploy/deploy.log 2>/dev/null || tail -30 /data/logs/new_auto_script.log 2>/dev/null || echo 'Log not found'"
Write-Host
$log
Write-Host
""
Write-Host
"========================================"
-ForegroundColor Gray
Write-Host
"Quick Commands:"
-ForegroundColor Yellow
Write-Host
"========================================"
-ForegroundColor Gray
Write-Host
"SSH to server: ssh root@192.168.5.52"
-ForegroundColor White
Write-Host
"Monitor log: tail -f /var/log/deploy/deploy.log"
-ForegroundColor White
Write-Host
"Check process: ps aux | grep new_auto.sh"
-ForegroundColor White
Write-Host
"Check Docker: docker ps"
-ForegroundColor White
Write-Host
"========================================"
-ForegroundColor Gray
AuxiliaryTool/ScriptTool/RemoteDeploy/quick_check.ps1
0 → 100644
浏览文件 @
9f8a1cb0
$PlinkPath
=
"E:\GithubData\ubains-module-test\AuxiliaryTool\ScriptTool\RemoteDeploy\plink.exe"
$psi
=
New-Object
System.Diagnostics.ProcessStartInfo
$psi
.FileName
=
$PlinkPath
$psi
.Arguments
=
"-pw Ubains@123 -P 22 root@192.168.5.52 'ps aux | grep new_auto.sh | grep -v grep && echo ---RUNNING--- || echo ---COMPLETED---'"
$psi
.UseShellExecute
=
$false
$psi
.RedirectStandardOutput
=
$true
$psi
.RedirectStandardError
=
$true
$psi
.CreateNoWindow
=
$true
$p
=
New-Object
System.Diagnostics.Process
$p
.StartInfo
=
$psi
$p
.Start
()
| Out-Null
$p
.WaitForExit
(
60000
)
$result
=
$p
.StandardOutput.ReadToEnd
()
Write-Host
$result
Docs/PRD/远程自动化部署/_PRD_远程自动化部署_需求文档.md
浏览文件 @
9f8a1cb0
...
@@ -47,8 +47,9 @@
...
@@ -47,8 +47,9 @@
2.
目标服务器登录
2.
目标服务器登录
-
登录目标服务器,并切换到root用户。
-
登录目标服务器,并切换到root用户。
3.
部署执行
3.
部署执行
-
根据部署文档执行部署操作
-
严格根据部署文档执行部署操作!!!
-
如遇选择部署的系统,则选择全部系统,并执行部署操作。
-
如遇选择部署的系统,则选择全部系统,并执行部署操作。
-
不要自己乱操作,严格按照文档操作执行即可。
## 验收要求
## 验收要求
1.
自动化部署完成后检查容器状态是否正常,核查容器日志是否正确。
1.
自动化部署完成后检查容器状态是否正常,核查容器日志是否正确。
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论