落地并存测服全端:智能体 Graph/路由、后台切 8180、主账与部署脚本齐备,便于线上重发与验收。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
linmianxun
2026-09-13 21:15:58 +08:00
co-authored by Cursor
parent 0eb1adecc8
commit 8103b3b651
143 changed files with 8968 additions and 277 deletions
+58
View File
@@ -0,0 +1,58 @@
# 本地一键:同步源码 → 构建最新 dist → 上传 → 切后台到 8180
# 用法:在仓库根目录 .\deploy\Deploy-YtdAdminLatest.ps1
# 要求:SSH 密钥 ~/.ssh/id_ed25519_ytd;服务器 8180/8910/8080 已在听。
# 副作用:更新 E:\wwwroot\admin\current;改 Nginx /jeecgboot -> 8180;不碰 C:\yutongda。
$ErrorActionPreference = 'Stop'
$RepoRoot = Split-Path -Parent $PSScriptRoot
$SrcBackend = Join-Path $RepoRoot 'inquiry-backend'
$BuildRoot = 'C:\ytd\inquiry-backend'
$Key = Join-Path $env:USERPROFILE '.ssh\id_ed25519_ytd'
$Remote = 'ytd_extdev_0903@129.211.181.80'
$Incoming = 'C:/Users/ytd_extdev_0903/incoming'
if (-not (Test-Path $Key)) { throw "missing SSH key $Key" }
if (-not (Test-Path $SrcBackend)) { throw "missing $SrcBackend" }
Write-Host '=== 1) sync source to english build path ==='
New-Item -ItemType Directory -Force -Path (Split-Path $BuildRoot) | Out-Null
# 排除 node_modules / dist / .git,再单独保证依赖
robocopy $SrcBackend $BuildRoot /MIR /XD node_modules dist .git .vite .husky /XF *.log /NFL /NDL /NJH /NJS /nc /ns /np | Out-Null
# robocopy exit 0-7 ok
if ($LASTEXITCODE -ge 8) { throw "robocopy failed code=$LASTEXITCODE" }
Copy-Item (Join-Path $SrcBackend '.env.production') (Join-Path $BuildRoot '.env.production') -Force
if (-not (Test-Path (Join-Path $BuildRoot 'node_modules'))) {
Write-Host '=== pnpm install ==='
Push-Location $BuildRoot
try { pnpm install --frozen-lockfile } catch { pnpm install }
Pop-Location
}
Write-Host '=== 2) build production dist ==='
Push-Location $BuildRoot
if (Test-Path 'dist') { Remove-Item 'dist' -Recurse -Force }
pnpm run build
if ($LASTEXITCODE -ne 0) { Pop-Location; throw "build failed $LASTEXITCODE" }
if (-not (Test-Path 'dist\index.html')) { Pop-Location; throw 'dist/index.html missing' }
Pop-Location
$zip = Join-Path $env:TEMP 'admin-dist.zip'
if (Test-Path $zip) { Remove-Item $zip -Force }
Compress-Archive -Path (Join-Path $BuildRoot 'dist\*') -DestinationPath $zip -Force
Write-Host ("zip bytes=" + (Get-Item $zip).Length)
Write-Host '=== 3) upload ==='
scp -o BatchMode=yes -i $Key `
$zip `
(Join-Path $RepoRoot 'deploy\ai.conf.cutover-8180') `
(Join-Path $RepoRoot 'deploy\_remote_cutover_admin_8180.ps1') `
"${Remote}:${Incoming}/"
if ($LASTEXITCODE -ne 0) { throw "scp failed $LASTEXITCODE" }
Write-Host '=== 4) remote cutover ==='
ssh -o BatchMode=yes -i $Key $Remote "powershell -NoProfile -ExecutionPolicy Bypass -File C:\Users\ytd_extdev_0903\incoming\_remote_cutover_admin_8180.ps1"
if ($LASTEXITCODE -ne 0) { throw "remote cutover failed $LASTEXITCODE" }
Write-Host 'DONE: admin latest published; /jeecgboot -> 8180'
Write-Host '请强刷 https://ai.ytd-scm.com/ (Ctrl+F5),用 Jeecg 账号登录'