Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
U
ubains-module-test
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
郑晓兵
ubains-module-test
Commits
f5495e58
提交
f5495e58
authored
5月 14, 2026
作者:
陈泽健
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(add): 输出AI远程自动化部署需求文档执行远程上传部署
上级
41e1fdb3
展开全部
隐藏空白字符变更
内嵌
并排
正在显示
18 个修改的文件
包含
2703 行增加
和
0 行删除
+2703
-0
accept_host_key.bat
AuxiliaryTool/ScriptTool/RemoteDeploy/accept_host_key.bat
+27
-0
auto_deploy.ps1
AuxiliaryTool/ScriptTool/RemoteDeploy/auto_deploy.ps1
+898
-0
auto_deploy.sh
AuxiliaryTool/ScriptTool/RemoteDeploy/auto_deploy.sh
+471
-0
auto_deploy_simple.ps1
AuxiliaryTool/ScriptTool/RemoteDeploy/auto_deploy_simple.ps1
+98
-0
auto_deploy_v2.ps1
AuxiliaryTool/ScriptTool/RemoteDeploy/auto_deploy_v2.ps1
+123
-0
check_server.ps1
AuxiliaryTool/ScriptTool/RemoteDeploy/check_server.ps1
+21
-0
deploy_check.ps1
AuxiliaryTool/ScriptTool/RemoteDeploy/deploy_check.ps1
+195
-0
full_deploy.ps1
AuxiliaryTool/ScriptTool/RemoteDeploy/full_deploy.ps1
+271
-0
plink.exe
AuxiliaryTool/ScriptTool/RemoteDeploy/plink.exe
+0
-0
pscp.exe
AuxiliaryTool/ScriptTool/RemoteDeploy/pscp.exe
+0
-0
192.168.5.52_check_20260514_182855.md
...emoteDeploy/reports/192.168.5.52_check_20260514_182855.md
+26
-0
192.168.5.52_deployment_report_20260514_181857.md
...reports/192.168.5.52_deployment_report_20260514_181857.md
+14
-0
192.168.5.52_deployment_report_20260514_182735.md
...reports/192.168.5.52_deployment_report_20260514_182735.md
+14
-0
test_error.txt
AuxiliaryTool/ScriptTool/RemoteDeploy/test_error.txt
+0
-0
test_output.txt
AuxiliaryTool/ScriptTool/RemoteDeploy/test_output.txt
+0
-0
upload_and_deploy.ps1
AuxiliaryTool/ScriptTool/RemoteDeploy/upload_and_deploy.ps1
+212
-0
upload_deploy.bat
AuxiliaryTool/ScriptTool/RemoteDeploy/upload_deploy.bat
+109
-0
upload_deploy.ps1
AuxiliaryTool/ScriptTool/RemoteDeploy/upload_deploy.ps1
+224
-0
没有找到文件。
AuxiliaryTool/ScriptTool/RemoteDeploy/accept_host_key.bat
0 → 100644
浏览文件 @
f5495e58
@echo off
REM Accept SSH host key for remote server
REM Usage: accept_host_key.bat
setlocal enabledelayedexpansion
set SERVER_IP=192.168.5.52
set SSH_PORT=22
set USERNAME=root
set PASSWORD=Ubains@123
echo ========================================
echo Accepting SSH host key for %SERVER_IP%
echo ========================================
REM Use plink to accept host key (will prompt)
echo Please accept the host key when prompted...
echo.
plink.exe -pw %PASSWORD% -P %SSH_PORT% %USERNAME%@%SERVER_IP% echo "Host key accepted"
echo.
echo ========================================
echo Host key acceptance completed
echo ========================================
endlocal
AuxiliaryTool/ScriptTool/RemoteDeploy/auto_deploy.ps1
0 → 100644
浏览文件 @
f5495e58
此差异已折叠。
点击以展开。
AuxiliaryTool/ScriptTool/RemoteDeploy/auto_deploy.sh
0 → 100644
浏览文件 @
f5495e58
此差异已折叠。
点击以展开。
AuxiliaryTool/ScriptTool/RemoteDeploy/auto_deploy_simple.ps1
0 → 100644
浏览文件 @
f5495e58
# Simple Remote Deployment Script using Windows OpenSSH
# Author: Automation Team
# Date: 2026-05-14
param
(
[
string
]
$ServerIP
=
"192.168.5.52"
,
[
string
]
$Username
=
"root"
,
[
string
]
$Password
=
"Ubains@123"
,
[
int
]
$SSHPort
=
22
)
$ScriptDir
=
Split-Path
-Parent
$MyInvocation
.MyCommand.Path
$ReportsDir
=
Join-Path
$ScriptDir
"reports"
$LogFile
=
Join-Path
$ReportsDir
"deploy_
$(
Get-Date
-Format
'yyyyMMdd_HHmmss'
)
.log"
# Create reports directory
if
(
-not
(
Test-Path
$ReportsDir
))
{
New-Item
-ItemType Directory -Path
$ReportsDir
-Force | Out-Null
}
# Logging function
function
Write
-Log
{
param
([
string
]
$Message
,
[
string
]
$Level
=
"INFO"
)
$Timestamp
=
Get-Date
-Format
"yyyy-MM-dd HH:mm:ss"
$LogMessage
=
"[
$Timestamp
] [
$Level
]
$Message
"
Write-Host
$LogMessage
Add-Content
-Path
$LogFile
-Value
$LogMessage
}
# SSH command function using plink with host key auto-accept
function
Invoke-SSHCommand
{
param
([
string
]
$Command
,
[
int
]
$Timeout
=
300
)
$PlinkPath
=
Join-Path
$ScriptDir
"plink.exe"
# Create temporary plink session to accept host key
$Args
=
@
(
"-pw"
,
$Password
,
"-P"
,
$SSHPort
,
"-hostkey"
,
'*'
,
"
$Username
@
$ServerIP
"
,
$Command
)
$Output
=
&
$PlinkPath
$Args
2>&1
return
$Output
}
Write
-Log
"========================================"
Write
-Log
"New Unified Platform Deployment Script"
Write
-Log
"Target Server:
${
ServerIP
}
"
Write
-Log
"========================================"
# Test SSH connection
Write
-Log
"Testing SSH connection..."
$TestResult
=
Invoke-SSHCommand -Command
"echo 'connection_ok'"
if
(
$TestResult
-match
"connection_ok"
)
{
Write
-Log
"SSH connection successful"
"OK"
# Get server information
Write
-Log
"Getting server information..."
$SystemInfo
=
Invoke-SSHCommand -Command
"uname -a"
Write
-Log
"Server OS:
$SystemInfo
"
# Check if /data/services exists (new platform)
$PlatformCheck
=
Invoke-SSHCommand -Command
"test -d /data/services && echo 'new' || echo 'old'"
Write
-Log
"Platform type:
$PlatformCheck
"
# Check Docker status
Write
-Log
"Checking Docker status..."
$DockerCheck
=
Invoke-SSHCommand -Command
"docker ps --format 'table {{.Names}}\t{{.Status}}' 2>&1"
if
(
$LASTEXITCODE
-eq 0
)
{
Write
-Log
"Docker is running"
Write-Host
"
`n
========== Container Status =========="
Write-Host
$DockerCheck
Write-Host
"========== Container Status End ==========
`n
"
}
else
{
Write
-Log
"Docker is not running or not accessible"
"WARN"
}
}
else
{
Write
-Log
"SSH connection failed"
"ERROR"
Write
-Log
"Error:
$TestResult
"
"ERROR"
Write
-Log
""
Write
-Log
"Please ensure:"
"INFO"
Write
-Log
"1. Server IP is correct:
$ServerIP
"
"INFO"
Write
-Log
"2. SSH port is open:
$SSHPort
"
"INFO"
Write
-Log
"3. Username and password are correct"
"INFO"
Write
-Log
"4. Server is reachable from this machine"
"INFO"
}
Write
-Log
"========================================"
Write
-Log
"Deployment script completed"
Write
-Log
"Log file:
$LogFile
"
Write
-Log
"========================================"
AuxiliaryTool/ScriptTool/RemoteDeploy/auto_deploy_v2.ps1
0 → 100644
浏览文件 @
f5495e58
# Remote Deployment Script using Windows OpenSSH
# Author: Automation Team
# Date: 2026-05-14
[
Console]::OutputEncoding
=
[
System.Text.Encoding]::UTF8
$ScriptDir
=
Split-Path
-Parent
$MyInvocation
.MyCommand.Path
$ReportsDir
=
Join-Path
$ScriptDir
"reports"
if
(
-not
(
Test-Path
$ReportsDir
))
{
New-Item
-ItemType Directory -Path
$ReportsDir
-Force | Out-Null
}
$LogFile
=
Join-Path
$ReportsDir
"deploy_
$(
Get-Date
-Format
'yyyyMMdd_HHmmss'
)
.log"
function
Write
-Log
{
param
([
string
]
$Message
,
[
string
]
$Color
=
"White"
)
$Timestamp
=
Get-Date
-Format
"yyyy-MM-dd HH:mm:ss"
$LogMessage
=
"[
$Timestamp
]
$Message
"
Write-Host
$LogMessage
-ForegroundColor
$Color
Add-Content
-Path
$LogFile
-Value
$LogMessage
}
Write
-Log
"========================================"
"Cyan"
Write
-Log
"New Unified Platform Deployment Script"
"Cyan"
Write
-Log
"========================================"
"Cyan"
# Configuration
$ServerIP
=
"192.168.5.52"
$Username
=
"root"
$Password
=
"Ubains@123"
$SSHPort
=
22
# Use plink.exe
$PlinkPath
=
Join-Path
$ScriptDir
"plink.exe"
Write
-Log
"Target Server:
${
ServerIP
}
:
${
SSHPort
}
"
Write
-Log
""
# Step 1: Accept host key
Write
-Log
"Step 1: Establishing SSH connection (accepting host key)..."
"Yellow"
# Create a process to start plink and automatically answer 'y' to host key prompt
$StartInfo
=
New-Object
System.Diagnostics.ProcessStartInfo
$StartInfo
.FileName
=
$PlinkPath
$StartInfo
.Arguments
=
"-pw
$Password
-P
$SSHPort
$Username
@
${
ServerIP
}
echo 'connection_ok'"
$StartInfo
.UseShellExecute
=
$false
$StartInfo
.RedirectStandardInput
=
$true
$StartInfo
.RedirectStandardOutput
=
$true
$StartInfo
.RedirectStandardError
=
$true
$StartInfo
.CreateNoWindow
=
$true
$Process
=
New-Object
System.Diagnostics.Process
$Process
.StartInfo
=
$StartInfo
$Process
.Start
()
| Out-Null
# Automatically answer 'y' to any prompts
$Process
.StandardInput.WriteLine
(
"y"
)
$Process
.StandardInput.Close
()
# Wait for process to complete
$Process
.WaitForExit
(
30000
)
$Output
=
$Process
.StandardOutput.ReadToEnd
()
$Error
=
$Process
.StandardError.ReadToEnd
()
if
(
$Output
-match
"connection_ok"
)
{
Write
-Log
"SSH connection established successfully!"
"Green"
# Step 2: Get server information
Write
-Log
""
Write
-Log
"Step 2: Getting server information..."
"Cyan"
$StartInfo
.Arguments
=
"-pw
$Password
-P
$SSHPort
$Username
@
${
ServerIP
}
uname -a"
$Process2
=
New-Object
System.Diagnostics.Process
$Process2
.StartInfo
=
$StartInfo
$Process2
.Start
()
| Out-Null
$Process2
.WaitForExit
(
30000
)
$ServerInfo
=
$Process2
.StandardOutput.ReadToEnd
()
Write
-Log
"Server OS:
$ServerInfo
"
"Green"
# Step 3: Check Docker status
Write
-Log
""
Write
-Log
"Step 3: Checking Docker status..."
"Cyan"
$StartInfo
.Arguments
=
"-pw
$Password
-P
$SSHPort
$Username
@
${
ServerIP
}
docker ps --format 'table {{.Names}}\t{{.Status}}'"
$Process3
=
New-Object
System.Diagnostics.Process
$Process3
.StartInfo
=
$StartInfo
$Process3
.Start
()
| Out-Null
$Process3
.WaitForExit
(
30000
)
$DockerOutput
=
$Process3
.StandardOutput.ReadToEnd
()
if
(
$DockerOutput
)
{
Write
-Log
"Docker is running"
"Green"
Write-Host
""
Write-Host
"========== Container Status =========="
-ForegroundColor Cyan
Write-Host
$DockerOutput
Write-Host
"========== Container Status End =========="
-ForegroundColor Cyan
Write-Host
""
}
else
{
Write
-Log
"Docker is not running or not accessible"
"Yellow"
}
Write
-Log
""
Write
-Log
"========================================"
"Green"
Write
-Log
"Connection test completed successfully!"
"Green"
Write
-Log
"========================================"
"Green"
}
else
{
Write
-Log
"SSH connection failed"
"Red"
Write
-Log
"Error:
$Error
"
"Red"
Write
-Log
""
Write
-Log
"Possible reasons:"
"Yellow"
Write
-Log
"1. Server IP is incorrect"
"Yellow"
Write
-Log
"2. SSH port is closed"
"Yellow"
Write
-Log
"3. Username or password is incorrect"
"Yellow"
Write
-Log
"4. Server is not reachable"
"Yellow"
}
Write
-Log
""
Write
-Log
"Log file:
$LogFile
"
AuxiliaryTool/ScriptTool/RemoteDeploy/check_server.ps1
0 → 100644
浏览文件 @
f5495e58
$ScriptDir
=
Split-Path
-Parent
$MyInvocation
.MyCommand.Path
$PlinkPath
=
Join-Path
$ScriptDir
"plink.exe"
$psi
=
New-Object
System.Diagnostics.ProcessStartInfo
$psi
.FileName
=
$PlinkPath
$psi
.Arguments
=
"-pw Ubains@123 -P 22 root@192.168.5.52 'ls -la /home && echo --- && ls -la /home/deploy 2>&1'"
$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
(
30000
)
$stdout
=
$p
.StandardOutput.ReadToEnd
()
$stderr
=
$p
.StandardError.ReadToEnd
()
Write-Host
$stdout
Write-Host
$stderr
AuxiliaryTool/ScriptTool/RemoteDeploy/deploy_check.ps1
0 → 100644
浏览文件 @
f5495e58
# Deployment Check Script - Simplified Version
# Author: Automation Team
# Date: 2026-05-14
[
Console]::OutputEncoding
=
[
System.Text.Encoding]::UTF8
$ScriptDir
=
Split-Path
-Parent
$MyInvocation
.MyCommand.Path
$ReportsDir
=
Join-Path
$ScriptDir
"reports"
if
(
-not
(
Test-Path
$ReportsDir
))
{
New-Item
-ItemType Directory -Path
$ReportsDir
-Force | Out-Null
}
$LogFile
=
Join-Path
$ReportsDir
"deploy_
$(
Get-Date
-Format
'yyyyMMdd_HHmmss'
)
.log"
function
Write
-Log
{
param
([
string
]
$Message
,
[
string
]
$Color
=
"White"
)
$Timestamp
=
Get-Date
-Format
"yyyy-MM-dd HH:mm:ss"
$LogMessage
=
"[
$Timestamp
]
$Message
"
Write-Host
$LogMessage
-ForegroundColor
$Color
Add-Content
-Path
$LogFile
-Value
$LogMessage
}
function
Invoke-SSHCommand
{
param
([
string
]
$Command
)
$PlinkPath
=
Join-Path
$ScriptDir
"plink.exe"
$psi
=
New-Object
System.Diagnostics.ProcessStartInfo
$psi
.FileName
=
$PlinkPath
$psi
.Arguments
=
"-pw
$Password
-P
$SSHPort
${
Username
}
@
${
ServerIP
}
$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
)
$stdout
=
$p
.StandardOutput.ReadToEnd
()
$stderr
=
$p
.StandardError.ReadToEnd
()
return
@
{
Output
=
$stdout
ExitCode
=
$p
.ExitCode
}
}
# Configuration
$ServerIP
=
"192.168.5.52"
$Username
=
"root"
$Password
=
"Ubains@123"
$SSHPort
=
22
$Results
=
@
{}
Write
-Log
"========================================"
"Cyan"
Write
-Log
"Deployment Check Script"
"Cyan"
Write
-Log
"Target:
${
ServerIP
}
"
"Cyan"
Write
-Log
"========================================"
"Cyan"
# Test connection
Write
-Log
"Testing SSH connection..."
"Yellow"
$result
=
Invoke-SSHCommand -Command
"echo 'ok'"
if
(
$result
.Output -match
"ok"
)
{
Write
-Log
"Connection successful"
"Green"
$Results
.Connection
=
"OK"
}
else
{
Write
-Log
"Connection failed"
"Red"
exit
1
}
# Get server info
Write
-Log
"Getting server information..."
"Yellow"
$osInfo
=
Invoke-SSHCommand -Command
"uname -a"
Write
-Log
"OS:
$(
$osInfo
.Output.Trim
(
)
)"
"White"
$diskInfo
=
Invoke-SSHCommand -Command
"df -h /home | awk 'NR==2 {print \
$4
}'"
Write
-Log
"Disk space:
$(
$diskInfo
.Output.Trim
(
)
)"
"White"
# Check Docker
Write
-Log
"Checking Docker status..."
"Yellow"
$dockerResult
=
Invoke-SSHCommand -Command
"docker ps --format 'table {{.Names}}\t{{.Status}}' 2>&1"
if
(
$dockerResult
.ExitCode -eq 0
)
{
Write
-Log
"Docker is running"
"Green"
Write-Host
""
Write-Host
"========== Containers =========="
-ForegroundColor Cyan
Write-Host
$dockerResult
.Output
Write-Host
"========== Containers End =========="
-ForegroundColor Cyan
Write-Host
""
$Results
.Docker
=
"Running"
}
else
{
Write
-Log
"Docker is not accessible"
"Red"
$Results
.Docker
=
"Not Running"
}
# Check services
Write
-Log
"Checking services..."
"Yellow"
$services
=
@
(
@
{
Name
=
"ExtAPI"
;
Path
=
"/data/services/api/java-meeting/java-meeting-extapi/logs/ubains-INFO-AND-ERROR.log"
}
,
@
{
Name
=
"InnerAPI"
;
Path
=
"/data/services/api/java-meeting/java-meeting2.0/logs/ubains-INFO-AND-ERROR.log"
}
,
@
{
Name
=
"Monitor"
;
Path
=
"/data/services/api/python-cmdb/log/uinfo.log"
}
,
@
{
Name
=
"Voice"
;
Path
=
"/data/services/api/python-voice/log/uinfo.log"
}
)
foreach
(
$svc
in
$services
)
{
$logResult
=
Invoke-SSHCommand -Command
"test -f '
$(
$svc
.Path
)
' && echo 'exists' || echo 'not_found'"
if
(
$logResult
.Output -match
"exists"
)
{
$tailResult
=
Invoke-SSHCommand -Command
"tail -20 '
$(
$svc
.Path
)
'"
if
(
$tailResult
.Output -match
"ERROR|Exception"
)
{
Write
-Log
"
$(
$svc
.Name
)
: Log contains errors"
"Yellow"
$Results
[
$svc
.Name]
=
"Has Errors"
}
else
{
Write
-Log
"
$(
$svc
.Name
)
: Log OK"
"Green"
$Results
[
$svc
.Name]
=
"OK"
}
}
else
{
Write
-Log
"
$(
$svc
.Name
)
: Log file not found"
"Red"
$Results
[
$svc
.Name]
=
"Not Found"
}
}
# Test APIs
Write
-Log
"Testing API endpoints..."
"Yellow"
$apis
=
@
(
@
{
Name
=
"ExtAPI"
;
URL
=
"https://
${
ServerIP
}
/exapi/message/getMsgPageList"
;
Expected
=
"A0076"
}
,
@
{
Name
=
"Meeting"
;
URL
=
"https://
${
ServerIP
}
/meetingV3/api/systemConfiguration/globalConfig?companyNumber=CN-SZ-00-0201"
;
Expected
=
"A0078"
}
,
@
{
Name
=
"Monitor"
;
URL
=
"https://
${
ServerIP
}
/monitor/api2/api/servermonitor/"
;
Expected
=
"40000014"
}
,
@
{
Name
=
"Voice"
;
URL
=
"https://
${
ServerIP
}
/voice/api/iflytek/roommaster?company_id=1&user_id=8&company_secret=57d00f9f-020f-5f1f-b788-55fae843bceb&getall=1"
;
Expected
=
"40000003"
}
)
foreach
(
$api
in
$apis
)
{
$curlResult
=
Invoke-SSHCommand -Command
"curl -k '
$(
$api
.URL
)
' 2>/dev/null"
if
(
$curlResult
.Output -match
$api
.Expected
)
{
Write
-Log
"
$(
$api
.Name
)
: API OK"
"Green"
$Results
[
"
$(
$api
.Name
)
API"
]
=
"OK"
}
else
{
Write
-Log
"
$(
$api
.Name
)
: API Error"
"Yellow"
$Results
[
"
$(
$api
.Name
)
API"
]
=
"Error"
}
}
# Generate report
Write
-Log
"Generating report..."
"Yellow"
$report
=
@
"
# Deployment Check Report
## Server:
$ServerIP
## Results
- Connection:
$(
$Results
.Connection
)
- Docker:
$(
$Results
.Docker
)
## Services
"
@
foreach
(
$svc
in
$services
)
{
$report
+
=
"
`n
-
$(
$svc
.Name
)
:
$(
$Results
[
$svc
.Name]
)
"
}
$report
+
=
"
`n
\n## APIs
`n
"
foreach
(
$api
in
$apis
)
{
$report
+
=
"
`n
-
$(
$api
.Name
)
:
$(
$Results
[
"
$(
$api
.Name
)
API"
]
)
"
}
$report
+
=
@
"
## Access URLs
- Frontend: https://
${
ServerIP
}
/
- Maintenance: https://
${
ServerIP
}
/#/LoginConfig
- Backend: https://
${
ServerIP
}
/#/LoginAdmin
---
Generated:
$(
Get-Date
)
"
@
$reportFile
=
Join-Path
$ReportsDir
"
${
ServerIP
}
_check_
$(
Get-Date
-Format
'yyyyMMdd_HHmmss'
)
.md"
$report
|
Out-File
-FilePath
$reportFile
-Encoding UTF8 -Force
Write
-Log
"Report saved to:
$reportFile
"
"Green"
Write
-Log
"========================================"
"Green"
Write
-Log
"Check completed!"
"Green"
Write
-Log
"========================================"
"Green"
AuxiliaryTool/ScriptTool/RemoteDeploy/full_deploy.ps1
0 → 100644
浏览文件 @
f5495e58
# Complete Remote Deployment Script - New Unified Platform
# Author: Automation Team
# Date: 2026-05-14
[
Console]::OutputEncoding
=
[
System.Text.Encoding]::UTF8
$ScriptDir
=
Split-Path
-Parent
$MyInvocation
.MyCommand.Path
$ReportsDir
=
Join-Path
$ScriptDir
"reports"
$TempDir
=
Join-Path
$ScriptDir
"temp"
# Create directories
if
(
-not
(
Test-Path
$ReportsDir
))
{
New-Item
-ItemType Directory -Path
$ReportsDir
-Force | Out-Null
}
if
(
-not
(
Test-Path
$TempDir
))
{
New-Item
-ItemType Directory -Path
$TempDir
-Force | Out-Null
}
$LogFile
=
Join-Path
$ReportsDir
"deploy_
$(
Get-Date
-Format
'yyyyMMdd_HHmmss'
)
.log"
function
Write
-Log
{
param
([
string
]
$Message
,
[
string
]
$Level
=
"INFO"
)
$Timestamp
=
Get-Date
-Format
"yyyy-MM-dd HH:mm:ss"
$LogMessage
=
"[
$Timestamp
] [
$Level
]
$Message
"
$Color
=
switch
(
$Level
)
{
"INFO"
{
"White"
}
"OK"
{
"Green"
}
"WARN"
{
"Yellow"
}
"ERROR"
{
"Red"
}
"STEP"
{
"Cyan"
}
default
{
"White"
}
}
Write-Host
$LogMessage
-ForegroundColor
$Color
Add-Content
-Path
$LogFile
-Value
$LogMessage
}
function
Invoke-SSHCommand
{
param
([
string
]
$Command
,
[
int
]
$TimeoutMs
=
300000
)
$PlinkPath
=
Join-Path
$ScriptDir
"plink.exe"
$StartInfo
=
New-Object
System.Diagnostics.ProcessStartInfo
$StartInfo
.FileName
=
$PlinkPath
$StartInfo
.Arguments
=
"-pw
$Password
-P
$SSHPort
${
Username
}
@
${
ServerIP
}
$Command
"
$StartInfo
.UseShellExecute
=
$false
$StartInfo
.RedirectStandardOutput
=
$true
$StartInfo
.RedirectStandardError
=
$true
$StartInfo
.CreateNoWindow
=
$true
$Process
=
New-Object
System.Diagnostics.Process
$Process
.StartInfo
=
$StartInfo
try
{
$Process
.Start
()
| Out-Null
$Process
.WaitForExit
(
$TimeoutMs
)
$Output
=
$Process
.StandardOutput.ReadToEnd
()
$StdErr
=
$Process
.StandardError.ReadToEnd
()
return
@
{
Success
=
(
$Process
.ExitCode -eq 0
)
Output
=
$Output
Error
=
$StdErr
ExitCode
=
$Process
.ExitCode
}
}
catch
{
return
@
{
Success
=
$false
Output
=
""
Error
=
$_
.Exception.Message
ExitCode
=
-1
}
}
}
# Configuration
$ServerIP
=
"192.168.5.52"
$Username
=
"root"
$Password
=
"Ubains@123"
$SSHPort
=
22
$DeployResults
=
@
{
Connection
=
""
ServerInfo
=
@
{}
ContainerStatus
=
@
{}
ServiceLogs
=
@
{}
APITests
=
@
{}
}
# Start deployment
Write
-Log
"========================================"
"STEP"
Write
-Log
"New Unified Platform Deployment Script"
"STEP"
Write
-Log
"Target:
${
ServerIP
}
(X86)"
"STEP"
Write
-Log
"Start:
$(
Get-Date
-Format
'yyyy-MM-dd HH:mm:ss'
)
"
"STEP"
Write
-Log
"========================================"
"STEP"
# Step 1: Test SSH connection
Write
-Log
"Step 1: Testing SSH connection"
"STEP"
$TestResult
=
Invoke-SSHCommand -Command
"echo 'connection_ok'"
if
(
$TestResult
.Output -match
"connection_ok"
)
{
Write
-Log
"SSH connection successful"
"OK"
$DeployResults
.Connection
=
"成功"
}
else
{
Write
-Log
"SSH connection failed:
$(
$TestResult
.Error
)
"
"ERROR"
exit
1
}
# Step 2: Get server information
Write
-Log
"
`n
Step 2: Getting server information"
"STEP"
$OSInfo
=
Invoke-SSHCommand -Command
"uname -a"
$DeployResults
.ServerInfo.OS
=
$OSInfo
.Output.Trim
()
Write
-Log
"OS:
$(
$DeployResults
.ServerInfo.OS
)
"
"INFO"
$DiskInfo
=
Invoke-SSHCommand -Command
"df -h /home | awk 'NR==2 {print \
$4
}'"
$DeployResults
.ServerInfo.DiskSpace
=
$DiskInfo
.Output.Trim
()
Write
-Log
"Home disk space:
$(
$DeployResults
.ServerInfo.DiskSpace
)
"
"INFO"
# Check platform type
$PlatformCheck
=
Invoke-SSHCommand -Command
"test -d /data/services && echo 'new' || echo 'old'"
$DeployResults
.ServerInfo.PlatformType
=
$PlatformCheck
.Output.Trim
()
Write
-Log
"Platform type:
$(
$DeployResults
.ServerInfo.PlatformType
)
"
"INFO"
# Step 3: Check Docker status
Write
-Log
"
`n
Step 3: Checking Docker status"
"STEP"
$DockerCheck
=
Invoke-SSHCommand -Command
"docker ps --format 'table {{.Names}}\t{{.Status}}' 2>&1"
if
(
$DockerCheck
.ExitCode -eq 0
)
{
Write
-Log
"Docker is running"
"OK"
Write-Host
"
`n
========== Container Status =========="
-ForegroundColor Cyan
Write-Host
$DockerCheck
.Output
Write-Host
"========== Container Status End ==========
`n
"
-ForegroundColor Cyan
# Parse container status
$Lines
=
$DockerCheck
.Output -split
"
`n
"
foreach
(
$Line
in
$Lines
)
{
if
(
$Line
-match
"(\S+)\s+(\S+)"
)
{
$Name
=
$Matches
[
1]
$Status
=
$Matches
[
2]
if
(
$Name
-ne
"NAMES"
)
{
$DeployResults
.ContainerStatus[
$Name
]
=
$Status
}
}
}
}
else
{
Write
-Log
"Docker is not running or not accessible"
"WARN"
$DeployResults
.ContainerStatus.Error
=
"Docker不可用"
}
# Step 4: Check service logs
Write
-Log
"
`n
Step 4: Checking service logs"
"STEP"
$LogPaths
=
@
{
"ExtAPI"
=
"/data/services/api/java-meeting/java-meeting-extapi/logs/ubains-INFO-AND-ERROR.log"
"InnerAPI"
=
"/data/services/api/java-meeting/java-meeting2.0/logs/ubains-INFO-AND-ERROR.log"
"Monitor"
=
"/data/services/api/python-cmdb/log/uinfo.log"
"Voice"
=
"/data/services/api/python-voice/log/uinfo.log"
}
foreach
(
$LogName
in
$LogPaths
.Keys
)
{
$LogPath
=
$LogPaths
[
$LogName
]
Write
-Log
"Checking
$LogName
log..."
"INFO"
$LogResult
=
Invoke-SSHCommand -Command
"tail -50 '
$LogPath
' 2>/dev/null || echo 'not_found'"
if
(
$LogResult
.Output -match
"not_found"
)
{
Write
-Log
"
$LogName
log file not found"
"WARN"
$DeployResults
.ServiceLogs[
$LogName
]
=
"文件不存在"
}
elseif
(
$LogName
-eq
"ExtAPI"
-and
$LogResult
.Output -match
"SYSTEMVERSION"
)
{
Write
-Log
"
$LogName
log is normal (version detected)"
"OK"
$DeployResults
.ServiceLogs[
$LogName
]
=
"正常"
}
elseif
(
$LogResult
.Output -match
"ERROR|Exception|Failed"
)
{
Write
-Log
"
$LogName
log contains errors"
"WARN"
$DeployResults
.ServiceLogs[
$LogName
]
=
"发现异常"
}
else
{
Write
-Log
"
$LogName
log appears normal"
"OK"
$DeployResults
.ServiceLogs[
$LogName
]
=
"正常"
}
}
# Step 5: Test API endpoints
Write
-Log
"
`n
Step 5: Testing service endpoints"
"STEP"
$APITests
=
@
{
"ExtAPI"
=
@
{
URL
=
"https://
${
ServerIP
}
/exapi/message/getMsgPageList"
; Expected
=
"A0076"
}
"Meeting"
=
@
{
URL
=
"https://
${
ServerIP
}
/meetingV3/api/systemConfiguration/globalConfig?companyNumber=CN-SZ-00-0201"
; Expected
=
"A0078"
}
"Monitor"
=
@
{
URL
=
"https://
${
ServerIP
}
/monitor/api2/api/servermonitor/"
; Expected
=
"40000014"
}
"Voice"
=
@
{
URL
=
"https://
${
ServerIP
}
/voice/api/iflytek/roommaster?company_id=1&user_id=8&company_secret=57d00f9f-020f-5f1f-b788-55fae843bceb&getall=1"
; Expected
=
"40000003"
}
}
foreach
(
$APIName
in
$APITests
.Keys
)
{
$API
=
$APITests
[
$APIName
]
Write
-Log
"Testing
$APIName
endpoint..."
"INFO"
$CurlResult
=
Invoke-SSHCommand -Command
"curl -k '
$(
$API
.URL
)
' 2>/dev/null"
-TimeoutMs 60000
if
(
$CurlResult
.Output -match
$API
.Expected
)
{
Write
-Log
"
$APIName
endpoint is normal"
"OK"
$DeployResults
.APITests[
$APIName
]
=
"正常"
}
elseif
(
$CurlResult
.Output -match
"nginx|Error"
)
{
Write
-Log
"
$APIName
endpoint returns error page"
"WARN"
$DeployResults
.APITests[
$APIName
]
=
"异常"
}
else
{
Write
-Log
"
$APIName
endpoint: unknown response"
"WARN"
$DeployResults
.APITests[
$APIName
]
=
"未知"
}
}
# Step 6: Generate report
Write
-Log
"
`n
Step 6: Generating deployment report"
"STEP"
$ReportContent
=
@
"
# New Unified Platform Deployment Report
## Basic Information
- Server IP:
$ServerIP
- Architecture: X86
- Deployment Time:
$(
Get-Date
-Format
'yyyy-MM-dd HH:mm:ss'
)
## Deployment Results
### 1. SSH Connection
- Status:
$(
$DeployResults
.Connection
)
### 2. Server Information
- OS:
$(
$DeployResults
.ServerInfo.OS
)
- Disk Space:
$(
$DeployResults
.ServerInfo.DiskSpace
)
- Platform:
$(
$DeployResults
.ServerInfo.PlatformType
)
### 3. Container Status
"
@
foreach
(
$Container
in
$DeployResults
.ContainerStatus.Keys
)
{
$ReportContent
+
=
"
`n
-
$Container
:
$(
$DeployResults
.ContainerStatus[
$Container
]
)
"
}
$ReportContent
+
=
@
"
### 4. Service Logs
"
@
foreach
(
$Log
in
$DeployResults
.ServiceLogs.Keys
)
{
$ReportContent
+
=
"
`n
-
$Log
:
$(
$DeployResults
.ServiceLogs[
$Log
]
)
"
}
$ReportContent
+
=
@
"
### 5. API Tests
"
@
foreach
(
$API
in
$DeployResults
.APITests.Keys
)
{
$ReportContent
+
=
"
`n
-
$API
:
$(
$DeployResults
.APITests[
$API
]
)
"
}
$ReportContent
+
=
@
"
## System Access Addresses
- Frontend: https://
${
ServerIP
}
/
- Maintenance: https://
${
ServerIP
}
/#/LoginConfig
- Backend: https://
${
ServerIP
}
/#/LoginAdmin
---
Report Generated:
$(
Get-Date
-Format
'yyyy-MM-dd HH:mm:ss'
)
"
@
$ReportFile
=
Join-Path
$ReportsDir
"
${
ServerIP
}
_deployment_report_
$(
Get-Date
-Format
'yyyyMMdd_HHmmss'
)
.md"
$ReportContent
|
Out-File
-FilePath
$ReportFile
-Encoding UTF8 -Force
Write
-Log
"Deployment report generated:
$ReportFile
"
"OK"
# Completion
Write
-Log
"
`n
========================================"
"OK"
Write
-Log
"Deployment check completed!"
"OK"
Write
-Log
"========================================"
"OK"
AuxiliaryTool/ScriptTool/RemoteDeploy/plink.exe
0 → 100644
浏览文件 @
f5495e58
File added
AuxiliaryTool/ScriptTool/RemoteDeploy/pscp.exe
0 → 100644
浏览文件 @
f5495e58
File added
AuxiliaryTool/ScriptTool/RemoteDeploy/reports/192.168.5.52_check_20260514_182855.md
0 → 100644
浏览文件 @
f5495e58
# Deployment Check Report
## Server: 192.168.5.52
## Results
-
Connection: OK
-
Docker: Not Running
## Services
-
ExtAPI: Not Found
-
InnerAPI: Not Found
-
Monitor: Not Found
-
Voice: Not Found
\n
## APIs
-
ExtAPI: Error
-
Meeting: Error
-
Monitor: Error
-
Voice: Error
## Access URLs
-
Frontend: https://192.168.5.52/
-
Maintenance: https://192.168.5.52/#/LoginConfig
-
Backend: https://192.168.5.52/#/LoginAdmin
---
Generated: 05/14/2026 18:28:55
AuxiliaryTool/ScriptTool/RemoteDeploy/reports/192.168.5.52_deployment_report_20260514_181857.md
0 → 100644
浏览文件 @
f5495e58
# New Unified Platform Deployment Report
## Basic Information
-
Server IP: 192.168.5.52
-
Architecture: X86
-
Deployment Time: 2026-05-14 18:19:05
## System Access Addresses
-
Frontend Address: https://192.168.5.52/
-
Maintenance Address: https://192.168.5.52/#/LoginConfig
-
Backend Address: https://192.168.5.52/#/LoginAdmin
---
Report Generated Time: 2026-05-14 18:19:05
AuxiliaryTool/ScriptTool/RemoteDeploy/reports/192.168.5.52_deployment_report_20260514_182735.md
0 → 100644
浏览文件 @
f5495e58
# New Unified Platform Deployment Report
## Basic Information
-
Server IP: 192.168.5.52
-
Architecture: X86
-
Deployment Time: 2026-05-14 18:27:44
## System Access Addresses
-
Frontend Address: https://192.168.5.52/
-
Maintenance Address: https://192.168.5.52/#/LoginConfig
-
Backend Address: https://192.168.5.52/#/LoginAdmin
---
Report Generated Time: 2026-05-14 18:27:44
AuxiliaryTool/ScriptTool/RemoteDeploy/test_error.txt
0 → 100644
浏览文件 @
f5495e58
AuxiliaryTool/ScriptTool/RemoteDeploy/test_output.txt
0 → 100644
浏览文件 @
f5495e58
AuxiliaryTool/ScriptTool/RemoteDeploy/upload_and_deploy.ps1
0 → 100644
浏览文件 @
f5495e58
# Upload and Deploy Script
# Author: Automation Team
# Date: 2026-05-14
[
Console]::OutputEncoding
=
[
System.Text.Encoding]::UTF8
$ScriptDir
=
Split-Path
-Parent
$MyInvocation
.MyCommand.Path
$PackagesDir
=
Join-Path
$ScriptDir
"packages"
$ReportsDir
=
Join-Path
$ScriptDir
"reports"
# Create directories
if
(
-not
(
Test-Path
$PackagesDir
))
{
New-Item
-ItemType Directory -Path
$PackagesDir
-Force | Out-Null
}
if
(
-not
(
Test-Path
$ReportsDir
))
{
New-Item
-ItemType Directory -Path
$ReportsDir
-Force | Out-Null
}
$LogFile
=
Join-Path
$ReportsDir
"upload_
$(
Get-Date
-Format
'yyyyMMdd_HHmmss'
)
.log"
function
Write
-Log
{
param
([
string
]
$Message
,
[
string
]
$Color
=
"White"
)
$Timestamp
=
Get-Date
-Format
"yyyy-MM-dd HH:mm:ss"
$LogMessage
=
"[
$Timestamp
]
$Message
"
Write-Host
$LogMessage
-ForegroundColor
$Color
Add-Content
-Path
$LogFile
-Value
$LogMessage
}
function
Invoke-SSHCommand
{
param
([
string
]
$Command
)
$PlinkPath
=
Join-Path
$ScriptDir
"plink.exe"
$psi
=
New-Object
System.Diagnostics.ProcessStartInfo
$psi
.FileName
=
$PlinkPath
$psi
.Arguments
=
"-pw
$Password
-P
$SSHPort
${
Username
}
@
${
ServerIP
}
$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
()
}
function
Upload-File
{
param
([
string
]
$LocalPath
,
[
string
]
$RemotePath
)
$PscpPath
=
Join-Path
$ScriptDir
"pscp.exe"
$psi
=
New-Object
System.Diagnostics.ProcessStartInfo
$psi
.FileName
=
$PscpPath
$psi
.Arguments
=
"-pw
$Password
-P
$SSHPort
-batch '
$LocalPath
' '
${
Username
}
@
${
ServerIP
}
:
${
RemotePath
}
'"
$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
(
300000
)
return
$p
.ExitCode -eq 0
}
# Configuration
$ServerIP
=
"192.168.5.52"
$Username
=
"root"
$Password
=
"Ubains@123"
$SSHPort
=
22
# Network share path
$NetworkShare
=
"\\192.168.9.9\发布版本\03服务器部署\临时使用-新统一平台\X86部署包\全量版"
Write
-Log
"========================================"
"Cyan"
Write
-Log
"Upload and Deploy Script"
"Cyan"
Write
-Log
"========================================"
"Cyan"
# Step 1: Copy from network share
Write
-Log
"Step 1: Copying deployment package from network share..."
"Yellow"
Write
-Log
"Source:
$NetworkShare
"
"Gray"
if
(
-not
(
Test-Path
$NetworkShare
))
{
Write
-Log
"Network share path not accessible!"
"Red"
Write
-Log
"Please ensure:"
"Yellow"
Write
-Log
"1. You are connected to the company network"
"Yellow"
Write
-Log
"2. You have permission to access the share"
"Yellow"
Write
-Log
"3. The network path is correct"
"Yellow"
exit
1
}
# Clean local packages directory
if
(
Test-Path
$PackagesDir
)
{
Remove-Item
-Path
"
$PackagesDir
\*"
-Recurse -Force -ErrorAction SilentlyContinue
}
# Copy from network share
Write
-Log
"Copying files from network share (this may take a while)..."
"Yellow"
try
{
$Files
=
Get-ChildItem
-Path
$NetworkShare
-Recurse -File -ErrorAction Stop
$TotalFiles
=
$Files
.Count
$CopiedFiles
=
0
foreach
(
$File
in
$Files
)
{
$RelativePath
=
$File
.FullName.Substring
(
$NetworkShare
.Length + 1
)
$DestPath
=
Join-Path
$PackagesDir
$RelativePath
$DestDir
=
Split-Path
$DestPath
if
(
-not
(
Test-Path
$DestDir
))
{
New-Item
-ItemType Directory -Path
$DestDir
-Force | Out-Null
}
Copy-Item
-Path
$File
.FullName -Destination
$DestPath
-Force
$CopiedFiles
++
if
(
$CopiedFiles
% 10 -eq 0
)
{
Write-Progress
-Activity
"Copying deployment package"
-Status
"
$CopiedFiles
/
$TotalFiles
files"
-PercentComplete
((
$CopiedFiles
/
$TotalFiles
)
*
100
)
}
}
Write-Progress
-Activity
"Copying deployment package"
-Completed
Write
-Log
"Copied
$CopiedFiles
files from network share"
"Green"
$LocalPackageDir
=
$PackagesDir
}
catch
{
Write
-Log
"Failed to copy from network share:
$_
"
"Red"
Write
-Log
"Trying to list top-level directory..."
"Yellow"
try
{
$TopItems
=
Get-ChildItem
-Path
$NetworkShare
-ErrorAction Stop
Write
-Log
"Found items in network share:"
"Gray"
foreach
(
$Item
in
$TopItems
)
{
Write
-Log
" -
$(
$Item
.Name
)
(
$(
$Item
.Length
)
bytes)"
"Gray"
}
}
catch
{
Write
-Log
"Cannot access network share"
"Red"
}
exit
1
}
# Step 2: Create deploy directory on server
Write
-Log
"
`n
Step 2: Creating deploy directory on server..."
"Yellow"
Invoke-SSHCommand -Command
"mkdir -p /home/deploy"
Write
-Log
"Deploy directory created"
"Green"
# Step 3: Upload deployment package
Write
-Log
"
`n
Step 3: Uploading deployment package to server..."
"Yellow"
$UploadFiles
=
Get-ChildItem
-Path
$LocalPackageDir
-Recurse -File
$TotalUpload
=
$UploadFiles
.Count
$UploadedCount
=
0
$FailedUploads
=
@
()
foreach
(
$File
in
$UploadFiles
)
{
$RelativePath
=
$File
.FullName.Substring
(
$LocalPackageDir
.Length + 1
)
$RemotePath
=
"/home/deploy/
$RelativePath
"
$RemoteDir
=
"/home/deploy/"
+
(
Split-Path
$RelativePath
-Parent
)
# Create remote directory
Invoke-SSHCommand -Command
"mkdir -p '
$RemoteDir
'"
# Upload file
$Success
=
Upload-File -LocalPath
$File
.FullName -RemotePath
$RemotePath
if
(
$Success
)
{
$UploadedCount
++
}
else
{
$FailedUploads
+
=
$RelativePath
}
if
(
$UploadedCount
% 10 -eq 0
)
{
Write-Progress
-Activity
"Uploading to server"
-Status
"
$UploadedCount
/
$TotalUpload
files"
-PercentComplete
((
$UploadedCount
/
$TotalUpload
)
*
100
)
}
}
Write-Progress
-Activity
"Uploading to server"
-Completed
Write
-Log
"Uploaded
$UploadedCount
files to server"
"Green"
if
(
$FailedUploads
.Count -gt 0
)
{
Write
-Log
"Failed to upload
$(
$FailedUploads
.Count
)
files:"
"Yellow"
foreach
(
$Failed
in
$FailedUploads
)
{
Write
-Log
" -
$Failed
"
"Gray"
}
}
# Step 4: Check uploaded files
Write
-Log
"
`n
Step 4: Verifying uploaded files..."
"Yellow"
$ServerFiles
=
Invoke-SSHCommand -Command
"find /home/deploy -type f | wc -l"
Write
-Log
"Files on server:
$ServerFiles
"
"Green"
# Step 5: Find deployment script
Write
-Log
"
`n
Step 5: Looking for deployment script..."
"Yellow"
$DeployScripts
=
Invoke-SSHCommand -Command
"find /home/deploy -name '*.sh' -type f 2>/dev/null | head -10"
Write
-Log
"Found deployment scripts:"
"Gray"
Write-Host
$DeployScripts
.Output
Write
-Log
"
`n
========================================"
"Green"
Write
-Log
"Upload completed!"
"Green"
Write
-Log
"========================================"
"Green"
Write
-Log
"Next steps:"
"Yellow"
Write
-Log
"1. SSH to server: ssh root@
${
ServerIP
}
"
"Gray"
Write
-Log
"2. Go to deploy directory: cd /home/deploy"
"Gray"
Write
-Log
"3. Run deployment script"
"Gray"
Write
-Log
"========================================"
"Green"
AuxiliaryTool/ScriptTool/RemoteDeploy/upload_deploy.bat
0 → 100644
浏览文件 @
f5495e58
@echo off
setlocal enabledelayedexpansion
REM ========================================
REM Upload and Deploy Script
REM ========================================
set SCRIPT_DIR=%~dp0
set PACKAGES_DIR=%SCRIPT_DIR%packages
set REPORTS_DIR=%SCRIPT_DIR%reports
set SERVER_IP=192.168.5.52
set USERNAME=root
set PASSWORD=Ubains@123
set SSH_PORT=22
set NETWORK_SHARE=\\192.168.9.9\发布版本\03服务器部署\临时使用-新统一平台\X86部署包\全量版
echo ========================================
echo Upload and Deploy Script
echo ========================================
echo.
REM Create directories
if not exist "%PACKAGES_DIR%" mkdir "%PACKAGES_DIR%"
if not exist "%REPORTS_DIR%" mkdir "%REPORTS_DIR%"
REM Step 1: Check network share
echo Step 1: Checking network share...
echo Source: %NETWORK_SHARE%
if not exist "%NETWORK_SHARE%" (
echo ERROR: Network share not accessible!
echo.
echo Possible reasons:
echo 1. Not connected to company network
echo 2. No permission to access share
echo 3. Network path is incorrect
pause
exit /b 1
)
echo OK: Network share is accessible
echo.
REM Step 2: List files
echo Step 2: Listing files in network share...
dir "%NETWORK_SHARE%" /b
echo.
REM Step 3: Copy files locally
echo Step 3: Copying files locally...
echo This may take a while...
robocopy "%NETWORK_SHARE%" "%PACKAGES_DIR%" /E /NFL /NDL /NJH /NJS
if %ERRORLEVEL% LSS 8 (
echo OK: Files copied locally
) else (
echo WARNING: Robocopy reported some issues
)
echo.
REM Step 4: Create deploy directory on server
echo Step 4: Creating deploy directory on server...
plink.exe -pw %PASSWORD% -P %SSH_PORT% %USERNAME%@%SERVER_IP% "mkdir -p /home/deploy && echo 'OK'"
echo.
echo.
REM Step 5: Upload files to server
echo Step 5: Uploading files to server...
echo This may take a long time depending on file size...
echo.
echo Using pscp to upload files...
pscp.exe -pw %PASSWORD% -P %SSH_PORT% -batch -r "%PACKAGES_DIR%\*" %USERNAME%@%SERVER_IP%:/home/deploy/
echo.
echo Upload completed
echo.
REM Step 6: Verify upload
echo Step 6: Verifying upload...
plink.exe -pw %PASSWORD% -P %SSH_PORT% %USERNAME%@%SERVER_IP% "find /home/deploy -type f | wc -l"
echo.
REM Step 7: Find deployment scripts
echo Step 7: Looking for deployment scripts...
plink.exe -pw %PASSWORD% -P %SSH_PORT% %USERNAME%@%SERVER_IP% "find /home/deploy -name '*.sh' -type f 2>/dev/null | head -10"
echo.
echo ========================================
echo Upload completed!
echo ========================================
echo.
echo Next steps to complete deployment:
echo 1. SSH to server: ssh root@%SERVER_IP%
echo 2. Go to deploy directory: cd /home/deploy
echo 3. Find and run the deployment script
echo 4. Follow the deployment prompts
echo.
echo After deployment completes:
echo 1. Access maintenance platform: https://%SERVER_IP%/#/LoginConfig
echo 2. Enter verification code: csba
echo 3. Upload license file from network share
echo ========================================
echo.
pause
AuxiliaryTool/ScriptTool/RemoteDeploy/upload_deploy.ps1
0 → 100644
浏览文件 @
f5495e58
# Upload and Deploy Script - Simplified
# Author: Automation Team
[
Console]::OutputEncoding
=
[
System.Text.Encoding]::UTF8
$ScriptDir
=
Split-Path
-Parent
$MyInvocation
.MyCommand.Path
$PackagesDir
=
Join-Path
$ScriptDir
"packages"
$ReportsDir
=
Join-Path
$ScriptDir
"reports"
if
(
-not
(
Test-Path
$PackagesDir
))
{
New-Item
-ItemType Directory -Path
$PackagesDir
-Force | Out-Null
}
if
(
-not
(
Test-Path
$ReportsDir
))
{
New-Item
-ItemType Directory -Path
$ReportsDir
-Force | Out-Null
}
function
Write
-Log
{
param
([
string
]
$Message
,
[
string
]
$Color
=
"White"
)
$Timestamp
=
Get-Date
-Format
"yyyy-MM-dd HH:mm:ss"
Write-Host
"[
$Timestamp
]
$Message
"
-ForegroundColor
$Color
}
function
Invoke-SSHCommand
{
param
([
string
]
$Command
)
$PlinkPath
=
Join-Path
$ScriptDir
"plink.exe"
$Password
=
"Ubains@123"
$SSHPort
=
22
$ServerIP
=
"192.168.5.52"
$Username
=
"root"
$psi
=
New-Object
System.Diagnostics.ProcessStartInfo
$psi
.FileName
=
$PlinkPath
$psi
.Arguments
=
"-pw
$Password
-P
$SSHPort
${
Username
}
@
${
ServerIP
}
$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
()
}
function
Upload-File
{
param
([
string
]
$LocalPath
,
[
string
]
$RemotePath
)
$PscpPath
=
Join-Path
$ScriptDir
"pscp.exe"
$Password
=
"Ubains@123"
$SSHPort
=
22
$ServerIP
=
"192.168.5.52"
$Username
=
"root"
$psi
=
New-Object
System.Diagnostics.ProcessStartInfo
$psi
.FileName
=
$PscpPath
$psi
.Arguments
=
"-pw
$Password
-P
$SSHPort
-batch '
$LocalPath
' '
${
Username
}
@
${
ServerIP
}
:
${
RemotePath
}
'"
$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
(
300000
)
return
$p
.ExitCode -eq 0
}
# Network share path (using single quotes to avoid encoding issues)
$NetworkShare
=
'\\192.168.9.9\发布版本\03服务器部署\临时使用-新统一平台\X86部署包\全量版'
Write
-Log
"========================================"
"Cyan"
Write
-Log
"Upload and Deploy Script"
"Cyan"
Write
-Log
"========================================"
"Cyan"
# Step 1: Check network share
Write
-Log
"Step 1: Checking network share..."
"Yellow"
Write
-Log
"Source:
$NetworkShare
"
"Gray"
if
(
-not
(
Test-Path
$NetworkShare
))
{
Write
-Log
"ERROR: Network share not accessible!"
"Red"
Write
-Log
""
"Yellow"
Write
-Log
"Possible reasons:"
"Yellow"
Write
-Log
"1. Not connected to company network"
"Gray"
Write
-Log
"2. No permission to access share"
"Gray"
Write
-Log
"3. Network path is incorrect"
"Gray"
Write
-Log
""
"Yellow"
Write
-Log
"Please check the path and try again."
"Yellow"
Read-Host
"Press Enter to exit"
exit
1
}
Write
-Log
"Network share is accessible"
"Green"
# Step 2: List files in network share
Write
-Log
""
"Yellow"
Write
-Log
"Step 2: Listing files in network share..."
"Yellow"
try
{
$Items
=
Get-ChildItem
-Path
$NetworkShare
-ErrorAction Stop
Write
-Log
"Found
$(
$Items
.Count
)
items:"
"Gray"
foreach
(
$Item
in
$Items
)
{
if
(
$Item
.PSIsContainer
)
{
Write
-Log
" [DIR]
$(
$Item
.Name
)
"
"Gray"
}
else
{
$Size
=
[
math]::Round
(
$Item
.Length / 1MB, 2
)
Write
-Log
" [FILE]
$(
$Item
.Name
)
(
$Size
MB)"
"Gray"
}
}
}
catch
{
Write
-Log
"ERROR: Failed to list files:
$_
"
"Red"
Read-Host
"Press Enter to exit"
exit
1
}
# Step 3: Create deploy directory on server
Write
-Log
""
"Yellow"
Write
-Log
"Step 3: Creating deploy directory on server..."
"Yellow"
$Result
=
Invoke-SSHCommand -Command
"mkdir -p /home/deploy && echo 'OK'"
if
(
$Result
-match
"OK"
)
{
Write
-Log
"Deploy directory created successfully"
"Green"
}
else
{
Write
-Log
"ERROR: Failed to create deploy directory"
"Red"
Read-Host
"Press Enter to exit"
exit
1
}
# Step 4: Upload deployment package
Write
-Log
""
"Yellow"
Write
-Log
"Step 4: Uploading deployment package..."
"Yellow"
Write
-Log
"This may take a while depending on file size..."
"Gray"
# Clean local packages directory
if
(
Test-Path
$PackagesDir
)
{
Remove-Item
-Path
"
$PackagesDir
\*"
-Recurse -Force -ErrorAction SilentlyContinue
}
# Copy files locally first (for faster processing)
Write
-Log
"Copying files locally first..."
"Gray"
try
{
robocopy
$NetworkShare
$PackagesDir
/E /NFL /NDL /NJH /NJS | Out-Null
Write
-Log
"Files copied locally"
"Green"
}
catch
{
Write
-Log
"Warning: Robocopy had issues, trying alternative..."
"Yellow"
Copy-Item
-Path
"
$NetworkShare
\*"
-Destination
$PackagesDir
-Recurse -Force -ErrorAction SilentlyContinue
}
# Get files to upload
$UploadFiles
=
Get-ChildItem
-Path
$PackagesDir
-Recurse -File
$TotalFiles
=
$UploadFiles
.Count
$UploadedCount
=
0
Write
-Log
"Total files to upload:
$TotalFiles
"
"Gray"
# Upload files
foreach
(
$File
in
$UploadFiles
)
{
$RelativePath
=
$File
.FullName.Substring
(
$PackagesDir
.Length + 1
)
$RemotePath
=
"/home/deploy/
$RelativePath
"
$RemoteDir
=
Split-Path
$RemotePath
-Parent
# Create remote directory
Invoke-SSHCommand -Command
"mkdir -p '
$RemoteDir
'"
| Out-Null
# Upload file
$Success
=
Upload-File -LocalPath
$File
.FullName -RemotePath
$RemotePath
if
(
$Success
)
{
$UploadedCount
++
}
if
(
$UploadedCount
% 50 -eq 0
)
{
$Percent
=
[
math]::Round
((
$UploadedCount
/
$TotalFiles
)
*
100
)
Write
-Log
"Progress:
$UploadedCount
/
$TotalFiles
(
$Percent
%)"
"Gray"
}
}
Write
-Log
"Uploaded
$UploadedCount
files to server"
"Green"
# Step 5: Verify upload
Write
-Log
""
"Yellow"
Write
-Log
"Step 5: Verifying upload..."
"Yellow"
$ServerFiles
=
Invoke-SSHCommand -Command
"find /home/deploy -type f | wc -l"
Write
-Log
"Files on server:
$ServerFiles
"
"Green"
# Step 6: Find deployment scripts
Write
-Log
""
"Yellow"
Write
-Log
"Step 6: Looking for deployment scripts..."
"Yellow"
$DeployScripts
=
Invoke-SSHCommand -Command
"find /home/deploy -name '*.sh' -type f 2>/dev/null | head -10"
if
(
$DeployScripts
)
{
Write
-Log
"Found deployment scripts:"
"Gray"
$DeployScripts
-split
"
`n
"
|
Where
-Object
{
$_
-ne
""
}
|
ForEach
-Object
{
Write
-Log
"
$_
"
"Gray"
}
}
else
{
Write
-Log
"No deployment scripts found"
"Yellow"
}
Write
-Log
""
"Green"
Write
-Log
"========================================"
"Green"
Write
-Log
"Upload completed successfully!"
"Green"
Write
-Log
"========================================"
"Green"
Write
-Log
""
"Yellow"
Write
-Log
"Next steps to complete deployment:"
"Yellow"
Write
-Log
"1. SSH to server: ssh root@192.168.5.52"
"Gray"
Write
-Log
"2. Go to deploy directory: cd /home/deploy"
"Gray"
Write
-Log
"3. Find and run the deployment script"
"Gray"
Write
-Log
"4. Follow the deployment prompts"
"Gray"
Write
-Log
""
"Gray"
Write
-Log
"After deployment completes:"
"Yellow"
Write
-Log
"1. Access maintenance platform: https://192.168.5.52/#/LoginConfig"
"Gray"
Write
-Log
"2. Enter verification code: csba"
"Gray"
Write
-Log
"3. Upload license file from network share"
"Gray"
Write
-Log
"========================================"
"Green"
Read-Host
"Press Enter to exit"
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论