落地并存测服全端:智能体 Graph/路由、后台切 8180、主账与部署脚本齐备,便于线上重发与验收。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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 账号登录'
|
||||
+17
-7
@@ -1,10 +1,20 @@
|
||||
# 部署占位(仅测试机)
|
||||
# 部署占位(仅测试机 / 切流后 wwwroot)
|
||||
|
||||
新系统与现网同机并存时:
|
||||
新系统运行根:`E:\wwwroot`(`admin\current` / `agent\current`)。
|
||||
|
||||
- 运行根只允许 `C:\ytd-test\`(或本机开发目录)。
|
||||
- **禁止**改 `C:\yutongda\ops\active-release*.json`,禁止占现网 8080 / 8810 / 8813。
|
||||
- **禁止**改 Nginx `ai.conf` 回调 / H5 反代(切流前公网仍进现网)。
|
||||
- 并存期 **禁止**让测试 AIBOT 桥再连现网 Bot 长连接。
|
||||
## 每次发最新后台(正式 Jeecg Vue)
|
||||
|
||||
脚本见 `Start-YtdTestScaffold.ps1`:仅用于本机/测试机起骨架进程做健康检查,不是正式发布器。
|
||||
在仓库根执行:
|
||||
|
||||
```powershell
|
||||
.\deploy\Deploy-YtdAdminLatest.ps1
|
||||
```
|
||||
|
||||
会:同步 `inquiry-backend` → 英文路径构建 → 上传 `admin-dist.zip` → 切 `admin\current` → Nginx `/jeecgboot` 指到 **8180**。
|
||||
禁止改 `C:\yutongda`。现网旧路径 `/jeecg-boot` 仍可指 8080 作兼容。
|
||||
|
||||
## 其他
|
||||
|
||||
- 智能体安全发布:`_remote_safe_deploy_agent.ps1`(不改 Nginx)
|
||||
- 主账 WMI 拉起:`_remote_wmi_start_ledger.ps1`
|
||||
- 并存期勿双连 AIBOT(8913)
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
# 只读:拉服务器新系统 8910 智能体日志中的企微相关行与错误行。
|
||||
# 用法(仓库根或任意目录):
|
||||
# .\deploy\Watch-Agent8910.ps1 # 持续监听(Ctrl+C 结束)
|
||||
# .\deploy\Watch-Agent8910.ps1 -Once # 只看最近一段
|
||||
# .\deploy\Watch-Agent8910.ps1 -All # 不过滤关键字,整行刷出
|
||||
#
|
||||
# 说明:
|
||||
# - 盯的是 E:\wwwroot\logs\agent-http.*.log(新系统 8910),不碰现网 8810/8811。
|
||||
# - 切流前公网 /wecom/callback 仍进现网;本脚本主要看到 inject、出站、本机调 8910 的错误。
|
||||
# - 依赖本机 SSH 密钥 ~/.ssh/id_ed25519_ytd。
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[switch]$Once,
|
||||
[switch]$All,
|
||||
[int]$Tail = 80
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$Key = Join-Path $env:USERPROFILE '.ssh\id_ed25519_ytd'
|
||||
$Remote = 'ytd_extdev_0903@129.211.181.80'
|
||||
$LogOut = 'E:\wwwroot\logs\agent-http.out.log'
|
||||
$LogErr = 'E:\wwwroot\logs\agent-http.err.log'
|
||||
|
||||
# 企微回调 / 出站 / 注入 / 常见失败码;-All 时不使用
|
||||
$Pattern = 'wecom|callback|inject|outbox|inbox|errcode|errmsg|60020|ERROR|WARNING|Traceback|Exception|health|sender|touser|crypto'
|
||||
|
||||
if (-not (Test-Path $Key)) {
|
||||
throw "缺少 SSH 密钥: $Key"
|
||||
}
|
||||
|
||||
Write-Host "目标: ${Remote}"
|
||||
Write-Host "日志: $LogOut"
|
||||
Write-Host " $LogErr"
|
||||
if ($All) {
|
||||
Write-Host '过滤: 关闭(全部输出)'
|
||||
} else {
|
||||
Write-Host "过滤: $Pattern"
|
||||
}
|
||||
Write-Host '---'
|
||||
|
||||
# 远程脚本:先打 health,再 Tail;-Wait 仅在非 Once 时启用
|
||||
$waitLiteral = if ($Once) { '$false' } else { '$true' }
|
||||
$allLiteral = if ($All) { '$true' } else { '$false' }
|
||||
|
||||
$remote = @"
|
||||
`$ErrorActionPreference = 'Continue'
|
||||
`$out = '$LogOut'
|
||||
`$err = '$LogErr'
|
||||
`$tail = $Tail
|
||||
`$wait = $waitLiteral
|
||||
`$all = $allLiteral
|
||||
`$pat = '$Pattern'
|
||||
|
||||
Write-Output '=== remote health 8910 ==='
|
||||
try {
|
||||
`$h = Invoke-WebRequest -Uri 'http://127.0.0.1:8910/health' -UseBasicParsing -TimeoutSec 5
|
||||
Write-Output `$h.Content
|
||||
} catch {
|
||||
Write-Output ('health_fail: ' + `$_.Exception.Message)
|
||||
}
|
||||
Write-Output '=== log tail ==='
|
||||
|
||||
`$files = @()
|
||||
if (Test-Path `$out) { `$files += `$out } else { Write-Output ('MISSING ' + `$out) }
|
||||
if (Test-Path `$err) { `$files += `$err } else { Write-Output ('MISSING ' + `$err) }
|
||||
if (`$files.Count -eq 0) { throw 'no agent-http log files' }
|
||||
|
||||
function Show-Line([string]`$line) {
|
||||
if (`$all) {
|
||||
Write-Output `$line
|
||||
return
|
||||
}
|
||||
if (`$line -match `$pat) {
|
||||
Write-Output `$line
|
||||
}
|
||||
}
|
||||
|
||||
if (-not `$wait) {
|
||||
foreach (`$f in `$files) {
|
||||
Write-Output ('--- ' + `$f + ' ---')
|
||||
Get-Content -Path `$f -Tail `$tail -ErrorAction SilentlyContinue | ForEach-Object { Show-Line `$_ }
|
||||
}
|
||||
exit 0
|
||||
}
|
||||
|
||||
Write-Output 'following... (Ctrl+C to stop)'
|
||||
Get-Content -Path `$files -Tail `$tail -Wait -ErrorAction SilentlyContinue | ForEach-Object { Show-Line `$_ }
|
||||
"@
|
||||
|
||||
$remoteFile = Join-Path $env:TEMP 'ytd-watch-agent8910-remote.ps1'
|
||||
Set-Content -Path $remoteFile -Value $remote -Encoding UTF8
|
||||
|
||||
$incoming = 'C:/Users/ytd_extdev_0903/incoming/_watch_agent8910.ps1'
|
||||
& scp -o BatchMode=yes -o ConnectTimeout=12 -i $Key $remoteFile "${Remote}:${incoming}"
|
||||
if ($LASTEXITCODE -ne 0) { throw "scp failed: $LASTEXITCODE" }
|
||||
|
||||
& ssh -o BatchMode=yes -o ConnectTimeout=12 -i $Key $Remote `
|
||||
"powershell -NoProfile -ExecutionPolicy Bypass -File C:\Users\ytd_extdev_0903\incoming\_watch_agent8910.ps1"
|
||||
if ($LASTEXITCODE -ne 0 -and -not $Once) {
|
||||
# Ctrl+C 常非 0,不当作部署失败
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
# 发布后验收:端口、健康、现网未误停
|
||||
$ErrorActionPreference = 'Continue'
|
||||
Write-Output '=== ports ==='
|
||||
foreach ($x in 8080, 8810, 8813, 8180, 8910, 8913) {
|
||||
$c = Get-NetTCPConnection -LocalPort $x -State Listen -EA SilentlyContinue | Select-Object -First 1
|
||||
if ($c) { Write-Output "$x LISTEN pid=$($c.OwningProcess)" } else { Write-Output "$x down" }
|
||||
}
|
||||
|
||||
Write-Output '=== health ==='
|
||||
foreach ($u in @(
|
||||
'http://127.0.0.1:8910/health',
|
||||
'http://127.0.0.1:8180/jeecgboot/',
|
||||
'http://127.0.0.1:8180/jeecgboot/sys/randomImage/deploycheck',
|
||||
'http://127.0.0.1:8080/jeecg-boot/'
|
||||
)) {
|
||||
try {
|
||||
$r = Invoke-WebRequest -Uri $u -UseBasicParsing -TimeoutSec 8
|
||||
Write-Output ("OK " + $r.StatusCode + " " + $u)
|
||||
} catch {
|
||||
$code = $null
|
||||
try { $code = $_.Exception.Response.StatusCode.value__ } catch {}
|
||||
Write-Output ("FAIL " + $u + " code=" + $code)
|
||||
}
|
||||
}
|
||||
|
||||
Write-Output '=== worker ==='
|
||||
$found = $false
|
||||
Get-CimInstance Win32_Process | ForEach-Object {
|
||||
if ($_.CommandLine -and $_.CommandLine -like '*worker_app*' -and $_.CommandLine -like '*wwwroot*agent*') {
|
||||
Write-Output ("worker pid=" + $_.ProcessId)
|
||||
$found = $true
|
||||
}
|
||||
}
|
||||
if (-not $found) { Write-Output 'worker NOT found' }
|
||||
|
||||
Write-Output '=== pointer ==='
|
||||
Get-Content 'E:\wwwroot\ops\active-release.json' -Raw
|
||||
|
||||
Write-Output '=== yutongda pointer untouched ==='
|
||||
if (Test-Path 'C:\yutongda\ops\active-release.json') {
|
||||
Write-Output 'C:\yutongda\ops\active-release.json still exists (not deleted)'
|
||||
}
|
||||
|
||||
Write-Output 'ACCEPT_DONE'
|
||||
@@ -0,0 +1,13 @@
|
||||
# 检查 config overlay 是否含 redis username,以及最近失败原因
|
||||
$ErrorActionPreference = 'Continue'
|
||||
$cfg = 'E:\wwwroot\inquiry-new\config\application-inquiry.yml'
|
||||
Write-Output '=== config exists ==='
|
||||
Test-Path $cfg
|
||||
if (Test-Path $cfg) {
|
||||
Get-Content $cfg | Select-Object -First 25
|
||||
}
|
||||
Write-Output '=== log markers ==='
|
||||
Select-String -Path 'E:\wwwroot\inquiry-new\logs\stdout.log' -Pattern 'WRONGPASS|redisContainer|Started Jeecg|Application run failed' |
|
||||
Select-Object -Last 12 |
|
||||
ForEach-Object { $_.Line.Substring(0, [Math]::Min(220, $_.Line.Length)) }
|
||||
Write-Output 'CFG_CHECK_DONE'
|
||||
@@ -0,0 +1,9 @@
|
||||
$ErrorActionPreference = 'Continue'
|
||||
$hits = Select-String -Path 'E:\wwwroot\admin\current\assets\*.js' -Pattern '数据进入主账' -SimpleMatch -ErrorAction SilentlyContinue
|
||||
if ($hits) {
|
||||
Write-Output 'HINT_STILL_PRESENT'
|
||||
$hits | Select-Object -First 3 | ForEach-Object { $_.Filename }
|
||||
} else {
|
||||
Write-Output 'HINT_GONE'
|
||||
}
|
||||
Write-Output 'CHECK_DONE'
|
||||
@@ -0,0 +1,77 @@
|
||||
# After redeploy: remove all releases except current junction targets
|
||||
$ErrorActionPreference = 'Continue'
|
||||
$Root = 'E:\wwwroot'
|
||||
|
||||
function Resolve-Link([string]$p) {
|
||||
if (-not (Test-Path $p)) { return $null }
|
||||
$i = Get-Item $p -Force
|
||||
if ($i.Target -and $i.Target.Count -gt 0) { return [string]$i.Target[0] }
|
||||
return $null
|
||||
}
|
||||
|
||||
$keepAgent = Resolve-Link (Join-Path $Root 'agent\current')
|
||||
$keepAdmin = Resolve-Link (Join-Path $Root 'admin\current')
|
||||
Write-Output ('keepAgent=' + $keepAgent)
|
||||
Write-Output ('keepAdmin=' + $keepAdmin)
|
||||
|
||||
function Try-Remove([string]$path) {
|
||||
try {
|
||||
Remove-Item $path -Recurse -Force -ErrorAction Stop
|
||||
Write-Output ('REMOVED ' + $path)
|
||||
return $true
|
||||
} catch {
|
||||
Write-Output ('LOCK ' + $path + ' :: ' + $_.Exception.Message)
|
||||
return $false
|
||||
}
|
||||
}
|
||||
|
||||
# Stop python/java only if commandline clearly points at OLD release paths we will delete
|
||||
$keepAgentRoot = $null
|
||||
if ($keepAgent) {
|
||||
# .../releases/<id>/agent -> releases/<id>
|
||||
$keepAgentRoot = Split-Path $keepAgent -Parent
|
||||
}
|
||||
|
||||
Get-CimInstance Win32_Process | ForEach-Object {
|
||||
$cl = $_.CommandLine
|
||||
if (-not $cl) { return }
|
||||
if ($cl -like '*\agent\releases\*' -and $keepAgentRoot -and $cl -notlike ('*' + $keepAgentRoot + '*')) {
|
||||
if ($cl -like '*python*' -or $cl -like '*http_app*' -or $cl -like '*worker_app*') {
|
||||
Write-Output ('stop stale pid=' + $_.ProcessId)
|
||||
Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
}
|
||||
Start-Sleep -Seconds 2
|
||||
|
||||
if (Test-Path (Join-Path $Root 'agent\releases')) {
|
||||
Get-ChildItem (Join-Path $Root 'agent\releases') | Where-Object { $_.PSIsContainer } | ForEach-Object {
|
||||
$rel = $_.FullName
|
||||
$agentHomePath = Join-Path $rel 'agent'
|
||||
if ($keepAgent -and ($keepAgent -eq $agentHomePath -or $keepAgent.StartsWith($rel + '\'))) {
|
||||
Write-Output ('KEEP ' + $rel)
|
||||
} else {
|
||||
Try-Remove $rel | Out-Null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Test-Path (Join-Path $Root 'admin\releases')) {
|
||||
Get-ChildItem (Join-Path $Root 'admin\releases') | Where-Object { $_.PSIsContainer } | ForEach-Object {
|
||||
$rel = $_.FullName
|
||||
$dist = Join-Path $rel 'dist'
|
||||
if ($keepAdmin -and ($keepAdmin -eq $dist -or $keepAdmin.StartsWith($rel + '\'))) {
|
||||
Write-Output ('KEEP ' + $rel)
|
||||
} else {
|
||||
Try-Remove $rel | Out-Null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# trim env bak keep 2 newest
|
||||
Get-ChildItem $Root -Filter '.env.bak*' -ErrorAction SilentlyContinue |
|
||||
Sort-Object LastWriteTime -Descending |
|
||||
Select-Object -Skip 2 |
|
||||
ForEach-Object { Try-Remove $_.FullName | Out-Null }
|
||||
|
||||
Write-Output 'CLEANUP_AFTER_OK'
|
||||
@@ -0,0 +1,119 @@
|
||||
# Cleanup old releases under E:\wwwroot; keep current targets only
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$Root = 'E:\wwwroot'
|
||||
|
||||
function Get-JunctionTarget([string]$link) {
|
||||
if (-not (Test-Path $link)) { return $null }
|
||||
$item = Get-Item $link -Force
|
||||
if ($item.Attributes -band [IO.FileAttributes]::ReparsePoint) {
|
||||
cmd /c ("dir /AL `"$link`"") | Out-Null
|
||||
# Resolve via Get-Item Target if available
|
||||
try {
|
||||
if ($item.Target -and $item.Target.Count -gt 0) { return [string]$item.Target[0] }
|
||||
} catch {}
|
||||
}
|
||||
# Fallback: read active-release.json
|
||||
return $null
|
||||
}
|
||||
|
||||
$ptrPath = Join-Path $Root 'ops\active-release.json'
|
||||
$keepAgent = $null
|
||||
$keepAdmin = $null
|
||||
if (Test-Path $ptrPath) {
|
||||
$ptr = Get-Content $ptrPath -Raw | ConvertFrom-Json
|
||||
if ($ptr.agentHome) { $keepAgent = [string]$ptr.agentHome }
|
||||
if ($ptr.adminRelease) { $keepAdmin = [string]$ptr.adminRelease }
|
||||
}
|
||||
|
||||
$agentCurrent = Join-Path $Root 'agent\current'
|
||||
$adminCurrent = Join-Path $Root 'admin\current'
|
||||
$t1 = Get-JunctionTarget $agentCurrent
|
||||
$t2 = Get-JunctionTarget $adminCurrent
|
||||
if ($t1) { $keepAgent = $t1 }
|
||||
if ($t2) { $keepAdmin = $t2 }
|
||||
|
||||
# Resolve junction via fsutil / dir listing
|
||||
function Resolve-Link([string]$p) {
|
||||
if (-not (Test-Path $p)) { return $null }
|
||||
$out = cmd /c ("fsutil reparsepoint query `"$p`"") 2>$null
|
||||
# Alternative: (Get-Item).Target
|
||||
$i = Get-Item $p -Force
|
||||
if ($i.LinkType -eq 'Junction' -or ($i.Attributes -band [IO.FileAttributes]::ReparsePoint)) {
|
||||
if ($i.Target) { return ([string]$i.Target[0]) }
|
||||
}
|
||||
return $null
|
||||
}
|
||||
$ka = Resolve-Link $agentCurrent
|
||||
$kb = Resolve-Link $adminCurrent
|
||||
if ($ka) { $keepAgent = $ka }
|
||||
if ($kb) { $keepAdmin = $kb }
|
||||
|
||||
Write-Output ('keepAgent=' + $keepAgent)
|
||||
Write-Output ('keepAdmin=' + $keepAdmin)
|
||||
|
||||
$removed = @()
|
||||
# agent releases: E:\wwwroot\agent\releases\<id>\agent or <id>
|
||||
$agentRelRoot = Join-Path $Root 'agent\releases'
|
||||
if (Test-Path $agentRelRoot) {
|
||||
Get-ChildItem $agentRelRoot -ErrorAction SilentlyContinue | Where-Object { $_.PSIsContainer } | ForEach-Object {
|
||||
$rel = $_.FullName
|
||||
$agentHome = Join-Path $rel 'agent'
|
||||
$isKeep = $false
|
||||
if ($keepAgent) {
|
||||
if ($keepAgent -eq $agentHome -or $keepAgent -eq $rel -or $keepAgent.StartsWith($rel + '\')) { $isKeep = $true }
|
||||
}
|
||||
if (-not $isKeep) {
|
||||
Write-Output ('REMOVE agent ' + $rel)
|
||||
Remove-Item $rel -Recurse -Force
|
||||
$removed += $rel
|
||||
} else {
|
||||
Write-Output ('KEEP agent ' + $rel)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$adminRelRoot = Join-Path $Root 'admin\releases'
|
||||
if (Test-Path $adminRelRoot) {
|
||||
Get-ChildItem $adminRelRoot -ErrorAction SilentlyContinue | Where-Object { $_.PSIsContainer } | ForEach-Object {
|
||||
$rel = $_.FullName
|
||||
$dist = Join-Path $rel 'dist'
|
||||
$isKeep = $false
|
||||
if ($keepAdmin) {
|
||||
if ($keepAdmin -eq $dist -or $keepAdmin -eq $rel -or $keepAdmin.StartsWith($rel + '\')) { $isKeep = $true }
|
||||
}
|
||||
if (-not $isKeep) {
|
||||
Write-Output ('REMOVE admin ' + $rel)
|
||||
Remove-Item $rel -Recurse -Force
|
||||
$removed += $rel
|
||||
} else {
|
||||
Write-Output ('KEEP admin ' + $rel)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# old env backups older than keep recent 2
|
||||
Get-ChildItem $Root -Filter '.env.bak*' -ErrorAction SilentlyContinue | Sort-Object LastWriteTime -Descending | Select-Object -Skip 2 | ForEach-Object {
|
||||
Write-Output ('REMOVE bak ' + $_.Name)
|
||||
Remove-Item $_.FullName -Force
|
||||
$removed += $_.FullName
|
||||
}
|
||||
|
||||
# incoming zips older
|
||||
$incoming = 'C:\Users\ytd_extdev_0903\incoming'
|
||||
if (Test-Path $incoming) {
|
||||
Get-ChildItem $incoming -Include '*.zip','jeecg-system-start*.jar' -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-1) } |
|
||||
ForEach-Object {
|
||||
Write-Output ('REMOVE incoming ' + $_.Name)
|
||||
Remove-Item $_.FullName -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
Write-Output ('removed_count=' + $removed.Count)
|
||||
Write-Output 'CLEANUP_OK'
|
||||
|
||||
# ports sanity: must not touch yutongda
|
||||
foreach ($x in 8080,8180,8910) {
|
||||
$c = Get-NetTCPConnection -LocalPort $x -State Listen -EA SilentlyContinue | Select-Object -First 1
|
||||
if ($c) { Write-Output ("port $x LISTEN") } else { Write-Output ("port $x down") }
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
# Remote: publish latest admin dist + switch Nginx /jeecgboot -> 8180
|
||||
# Do not touch C:\yutongda. On nginx -t failure, restore backup.
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$IncomingZip = 'C:\Users\ytd_extdev_0903\incoming\admin-dist.zip'
|
||||
$IncomingConf = 'C:\Users\ytd_extdev_0903\incoming\ai.conf.cutover-8180'
|
||||
$Root = 'E:\wwwroot'
|
||||
$Nginx = 'C:\nginx-1.18.0'
|
||||
$NginxConf = Join-Path $Nginx 'myconf\ai.conf'
|
||||
$Stamp = Get-Date -Format 'yyyyMMdd-HHmmss'
|
||||
$RelId = 'admin-' + $Stamp
|
||||
$RelDist = Join-Path $Root ('admin\releases\' + $RelId + '\dist')
|
||||
$Current = Join-Path $Root 'admin\current'
|
||||
$PtrPath = Join-Path $Root 'ops\active-release.json'
|
||||
|
||||
if (-not (Test-Path $IncomingZip)) { throw 'missing admin-dist.zip' }
|
||||
if (-not (Test-Path $IncomingConf)) { throw 'missing ai.conf.cutover-8180' }
|
||||
|
||||
$ledger = Get-NetTCPConnection -LocalPort 8180 -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1
|
||||
if (-not $ledger) { throw 'CRITICAL: 8180 not listening' }
|
||||
$agent = Get-NetTCPConnection -LocalPort 8910 -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1
|
||||
if (-not $agent) { throw 'CRITICAL: 8910 not listening' }
|
||||
$prod = Get-NetTCPConnection -LocalPort 8080 -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1
|
||||
if (-not $prod) { throw 'CRITICAL: prod 8080 down' }
|
||||
|
||||
Write-Output '=== backup nginx ==='
|
||||
$bak = $NginxConf + '.bak-before-admin-8180-' + $Stamp
|
||||
Copy-Item $NginxConf $bak -Force
|
||||
Write-Output ('bak=' + $bak)
|
||||
|
||||
Write-Output '=== install release dist ==='
|
||||
New-Item -ItemType Directory -Force -Path $RelDist | Out-Null
|
||||
Expand-Archive -Path $IncomingZip -DestinationPath $RelDist -Force
|
||||
if (-not (Test-Path (Join-Path $RelDist 'index.html'))) {
|
||||
$inner = Get-ChildItem $RelDist -Directory | Select-Object -First 1
|
||||
if ($inner -and (Test-Path (Join-Path $inner.FullName 'index.html'))) {
|
||||
$RelDist = $inner.FullName
|
||||
}
|
||||
}
|
||||
if (-not (Test-Path (Join-Path $RelDist 'index.html'))) { throw 'index.html missing' }
|
||||
|
||||
Write-Output '=== switch admin current junction ==='
|
||||
if (Test-Path $Current) {
|
||||
cmd /c ('rmdir "' + $Current + '"') | Out-Null
|
||||
if (Test-Path $Current) { Remove-Item $Current -Recurse -Force }
|
||||
}
|
||||
cmd /c ('mklink /J "' + $Current + '" "' + $RelDist + '"')
|
||||
if (-not (Test-Path (Join-Path $Current 'index.html'))) { throw 'current index missing' }
|
||||
Write-Output ('CURRENT_OK=' + $Current + ' -> ' + $RelDist)
|
||||
|
||||
Write-Output '=== nginx conf no BOM ==='
|
||||
$bytes = [System.IO.File]::ReadAllBytes($IncomingConf)
|
||||
if ($bytes.Length -ge 3 -and $bytes[0] -eq 239 -and $bytes[1] -eq 187 -and $bytes[2] -eq 191) {
|
||||
$list = New-Object System.Collections.Generic.List[byte]
|
||||
for ($i = 3; $i -lt $bytes.Length; $i++) { [void]$list.Add($bytes[$i]) }
|
||||
$bytes = $list.ToArray()
|
||||
}
|
||||
[System.IO.File]::WriteAllBytes($NginxConf, $bytes)
|
||||
|
||||
Set-Location $Nginx
|
||||
& .\nginx.exe -t
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Copy-Item $bak $NginxConf -Force
|
||||
throw 'nginx -t failed, restored'
|
||||
}
|
||||
Get-Process nginx -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
|
||||
Start-Sleep -Seconds 1
|
||||
try {
|
||||
Start-Service Nginx1.18 -ErrorAction Stop
|
||||
Write-Output 'SERVICE_STARTED'
|
||||
} catch {
|
||||
Start-Process -FilePath (Join-Path $Nginx 'nginx.exe') -WorkingDirectory $Nginx -WindowStyle Hidden
|
||||
Write-Output 'EXE_STARTED'
|
||||
}
|
||||
Start-Sleep -Seconds 2
|
||||
|
||||
New-Item -ItemType Directory -Force -Path (Join-Path $Root 'ops') | Out-Null
|
||||
$prevAgentCurrent = Join-Path $Root 'agent\current'
|
||||
$prevAgentHome = $null
|
||||
if (Test-Path $PtrPath) {
|
||||
try {
|
||||
$old = Get-Content $PtrPath -Raw | ConvertFrom-Json
|
||||
if ($old.agentCurrent) { $prevAgentCurrent = [string]$old.agentCurrent }
|
||||
if ($old.agentHome) { $prevAgentHome = [string]$old.agentHome }
|
||||
} catch {}
|
||||
}
|
||||
$ptr = @{
|
||||
root = $Root
|
||||
releaseId = $RelId
|
||||
adminRelease = $RelDist
|
||||
adminCurrent = $Current
|
||||
agentCurrent = $prevAgentCurrent
|
||||
agentHome = $prevAgentHome
|
||||
nginxBak = $bak
|
||||
jeecgbootProxy = 'http://127.0.0.1:8180/jeecgboot/'
|
||||
updatedAt = (Get-Date).ToString('o')
|
||||
note = 'admin cutover to Jeecg Vue + ledger 8180'
|
||||
}
|
||||
($ptr | ConvertTo-Json) | Out-File -FilePath $PtrPath -Encoding utf8
|
||||
|
||||
Write-Output '=== smoke ==='
|
||||
try {
|
||||
$h = Invoke-WebRequest -Uri 'http://127.0.0.1:8180/jeecgboot/sys/randomImage/cutover' -UseBasicParsing -TimeoutSec 8
|
||||
Write-Output ('ledger=' + $h.StatusCode)
|
||||
} catch {
|
||||
Write-Output ('ledger_fail=' + $_.Exception.Message)
|
||||
}
|
||||
Write-Output 'ADMIN_CUTOVER_OK'
|
||||
@@ -0,0 +1,52 @@
|
||||
# Diagnose E:\wwwroot\.env encoding without printing secret values
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$path = 'E:\wwwroot\.env'
|
||||
$bytes = [System.IO.File]::ReadAllBytes($path)
|
||||
Write-Output ("bytes=" + $bytes.Length)
|
||||
Write-Output ("bom_utf8=" + ($bytes.Length -ge 3 -and $bytes[0] -eq 239 -and $bytes[1] -eq 187 -and $bytes[2] -eq 191))
|
||||
Write-Output ("bom_utf16le=" + ($bytes.Length -ge 2 -and $bytes[0] -eq 255 -and $bytes[1] -eq 254))
|
||||
|
||||
function Show-Head([string]$label, [string]$text) {
|
||||
$lines = $text -split "`r?`n" | Select-Object -First 8
|
||||
Write-Output ("=== " + $label + " ===")
|
||||
foreach ($line in $lines) {
|
||||
if ($line -match '^(#|YTD_ENV=|PUBLIC_BASE_URL=|WECOM_CALLBACK_REPLY_TEXT=)') {
|
||||
if ($line -match '^WECOM_CALLBACK_REPLY_TEXT=') {
|
||||
$v = $line.Substring($line.IndexOf('=') + 1)
|
||||
Write-Output ("WECOM_CALLBACK_REPLY_TEXT len=" + $v.Length + " sample=" + $v.Substring(0, [Math]::Min(24, $v.Length)))
|
||||
} else {
|
||||
Write-Output $line
|
||||
}
|
||||
} elseif ($line -match '^[A-Z0-9_]+=') {
|
||||
$k = $line.Substring(0, $line.IndexOf('='))
|
||||
Write-Output ($k + "=***")
|
||||
} else {
|
||||
Write-Output $line
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$utf8 = [System.Text.Encoding]::UTF8.GetString($bytes)
|
||||
Show-Head 'as_utf8' $utf8
|
||||
|
||||
$gbk = [System.Text.Encoding]::GetEncoding(936).GetString($bytes)
|
||||
Show-Head 'as_gbk' $gbk
|
||||
|
||||
# try: utf8 mis-decoded as gbk then saved as utf8 -> recover by encode gbk getbytes then utf8 getstring
|
||||
try {
|
||||
$rec1 = [System.Text.Encoding]::UTF8.GetString([System.Text.Encoding]::GetEncoding(936).GetBytes($utf8))
|
||||
Show-Head 'recover_utf8_via_gbk_bytes' $rec1
|
||||
} catch {
|
||||
Write-Output 'recover1_fail'
|
||||
}
|
||||
|
||||
# try: latin1/cp1252 roundtrip
|
||||
try {
|
||||
$latin = [System.Text.Encoding]::GetEncoding(1252).GetString($bytes)
|
||||
$rec2 = [System.Text.Encoding]::UTF8.GetString([System.Text.Encoding]::GetEncoding(1252).GetBytes($latin))
|
||||
Show-Head 'recover_cp1252_to_utf8' $rec2
|
||||
} catch {
|
||||
Write-Output 'recover2_fail'
|
||||
}
|
||||
|
||||
Write-Output 'ENV_DIAG_DONE'
|
||||
@@ -0,0 +1,18 @@
|
||||
# Find who locks old agent release dirs
|
||||
$ErrorActionPreference = 'Continue'
|
||||
Write-Output '=== processes mentioning releases ==='
|
||||
Get-CimInstance Win32_Process | ForEach-Object {
|
||||
$cl = $_.CommandLine
|
||||
if ($cl -and ($cl -like '*agent\\releases*' -or $cl -like '*agent/releases*' -or $cl -like '*wwwroot*agent*')) {
|
||||
Write-Output ("pid=$($_.ProcessId) name=$($_.Name)")
|
||||
Write-Output (" " + $cl.Substring(0, [Math]::Min(300, $cl.Length)))
|
||||
}
|
||||
}
|
||||
Write-Output '=== netstat 8910 owner tree ==='
|
||||
$p = (Get-NetTCPConnection -LocalPort 8910 -State Listen -EA SilentlyContinue | Select-Object -First 1).OwningProcess
|
||||
if ($p) {
|
||||
$proc = Get-CimInstance Win32_Process -Filter "ProcessId=$p"
|
||||
Write-Output ("listen_pid=$p parent=$($proc.ParentProcessId)")
|
||||
Write-Output ($proc.CommandLine)
|
||||
}
|
||||
Write-Output 'LOCKERS_DONE'
|
||||
@@ -0,0 +1,85 @@
|
||||
# ASCII-only script: rewrite .env as UTF-8 BOM; Chinese via unicode escapes
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$path = 'E:\wwwroot\.env'
|
||||
$bak = 'E:\wwwroot\.env.bak-encoding-' + (Get-Date -Format 'yyyyMMdd-HHmmss')
|
||||
Copy-Item $path $bak -Force
|
||||
Write-Output ('backup=' + $bak)
|
||||
|
||||
function U([string]$escaped) {
|
||||
return [System.Text.RegularExpressions.Regex]::Unescape($escaped)
|
||||
}
|
||||
|
||||
$utf8BomEnc = New-Object System.Text.UTF8Encoding $true
|
||||
$raw = [System.IO.File]::ReadAllText($path, $utf8BomEnc)
|
||||
|
||||
$map = [ordered]@{}
|
||||
foreach ($line in ($raw -split "`r?`n")) {
|
||||
$t = $line.Trim()
|
||||
if (-not $t -or $t.StartsWith('#')) { continue }
|
||||
$i = $t.IndexOf('=')
|
||||
if ($i -lt 1) { continue }
|
||||
$k = $t.Substring(0, $i).Trim()
|
||||
$v = $t.Substring($i + 1)
|
||||
if (-not $map.Contains($k)) { $map[$k] = $v }
|
||||
}
|
||||
|
||||
# "询价智能体接通成功。已收到:{content}"
|
||||
$goodReply = U '\u8be2\u4ef7\u667a\u80fd\u4f53\u63a5\u901a\u6210\u529f\u3002\u5df2\u6536\u5230\uff1a{content}'
|
||||
$needFix = $true
|
||||
if ($map.Contains('WECOM_CALLBACK_REPLY_TEXT')) {
|
||||
$rt = [string]$map['WECOM_CALLBACK_REPLY_TEXT']
|
||||
if ($rt -match '\{content\}' -and $rt.Contains([char]0x8BE2) -and $rt.Contains([char]0x4EF7)) {
|
||||
$needFix = $false
|
||||
}
|
||||
}
|
||||
if ($needFix) {
|
||||
$map['WECOM_CALLBACK_REPLY_TEXT'] = $goodReply
|
||||
Write-Output 'fixed_reply_text'
|
||||
}
|
||||
|
||||
function V([string]$k, [string]$default = '') {
|
||||
if ($map.Contains($k)) { return [string]$map[$k] }
|
||||
return $default
|
||||
}
|
||||
|
||||
$lines = New-Object System.Collections.Generic.List[string]
|
||||
$lines.Add((U '# \u53cb\u901a\u8fbe\u8be2\u4ef7\u667a\u80fd\u4f53 \u00b7 \u73af\u5883\u53d8\u91cf\uff08\u670d\u52a1\u5668 E:\\wwwroot\\.env\uff09'))
|
||||
$lines.Add((U '# \u7f16\u7801\uff1aUTF-8\uff08\u5e26 BOM\uff0c\u4fbf\u4e8e\u8bb0\u4e8b\u672c\u6b63\u786e\u6253\u5f00\uff09\u3002\u7981\u6b62\u63d0\u4ea4 Git\u3002'))
|
||||
$lines.Add((U '# \u5bf9\u7167\uff1aprompt/13-\u73af\u5883\u5bf9\u7167.md'))
|
||||
$lines.Add('')
|
||||
$lines.Add('YTD_ENV=' + (V 'YTD_ENV' 'test'))
|
||||
$lines.Add('')
|
||||
$lines.Add((U '# \u516c\u7f51\u4e0e\u4f01\u5fae\uff08\u57df\u540d\u4e0e\u6b63\u5f0f\u76f8\u540c\uff09'))
|
||||
$lines.Add('PUBLIC_BASE_URL=' + (V 'PUBLIC_BASE_URL'))
|
||||
$lines.Add('WECOM_CALLBACK_URL=' + (V 'WECOM_CALLBACK_URL'))
|
||||
$lines.Add('INQUIRY_FORM_PUBLIC_BASE_URL=' + (V 'INQUIRY_FORM_PUBLIC_BASE_URL'))
|
||||
$lines.Add('WECOM_CORP_ID=' + (V 'WECOM_CORP_ID'))
|
||||
$lines.Add('WECOM_AGENT_ID=' + (V 'WECOM_AGENT_ID'))
|
||||
$lines.Add('WECOM_SECRET=' + (V 'WECOM_SECRET'))
|
||||
$lines.Add('WECOM_CALLBACK_TOKEN=' + (V 'WECOM_CALLBACK_TOKEN'))
|
||||
$lines.Add('WECOM_ENCODING_AES_KEY=' + (V 'WECOM_ENCODING_AES_KEY'))
|
||||
$lines.Add('WECOM_CALLBACK_REPLY_TEXT=' + (V 'WECOM_CALLBACK_REPLY_TEXT' $goodReply))
|
||||
$lines.Add('WECOM_OPS_AGENT_ID=' + (V 'WECOM_OPS_AGENT_ID'))
|
||||
$lines.Add('DEV_INJECT_ENABLED=' + (V 'DEV_INJECT_ENABLED' 'false'))
|
||||
$lines.Add('')
|
||||
$lines.Add((U '# \u5176\u4f59\u914d\u7f6e\uff08\u7aef\u53e3 / \u5e93 / Redis / \u6a21\u578b\u7b49\uff09'))
|
||||
|
||||
$written = @(
|
||||
'YTD_ENV','PUBLIC_BASE_URL','WECOM_CALLBACK_URL','INQUIRY_FORM_PUBLIC_BASE_URL',
|
||||
'WECOM_CORP_ID','WECOM_AGENT_ID','WECOM_SECRET','WECOM_CALLBACK_TOKEN',
|
||||
'WECOM_ENCODING_AES_KEY','WECOM_CALLBACK_REPLY_TEXT','WECOM_OPS_AGENT_ID','DEV_INJECT_ENABLED'
|
||||
)
|
||||
foreach ($k in $map.Keys) {
|
||||
if ($written -contains $k) { continue }
|
||||
$lines.Add($k + '=' + $map[$k])
|
||||
}
|
||||
|
||||
$text = [string]::Join("`r`n", $lines.ToArray()) + "`r`n"
|
||||
[System.IO.File]::WriteAllText($path, $text, $utf8BomEnc)
|
||||
|
||||
$check = [System.IO.File]::ReadAllText($path, $utf8BomEnc)
|
||||
$first = ($check -split "`r?`n")[0]
|
||||
Write-Output ('first_line=' + $first)
|
||||
Write-Output ('keys=' + $map.Count)
|
||||
Write-Output ('reply_has_cn=' + ($check.Contains([char]0x8BE2) -and $check.Contains('{content}')))
|
||||
Write-Output 'ENV_REWRITE_OK'
|
||||
@@ -0,0 +1,17 @@
|
||||
# Fix active-release pointer after admin cutover (ASCII only)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
New-Item -ItemType Directory -Force -Path 'E:\wwwroot\ops' | Out-Null
|
||||
$obj = [ordered]@{
|
||||
root = 'E:\wwwroot'
|
||||
releaseId = 'admin-20260913-154002'
|
||||
adminCurrent = 'E:\wwwroot\admin\current'
|
||||
adminRelease = 'E:\wwwroot\admin\releases\admin-20260913-154002\dist'
|
||||
agentCurrent = 'E:\wwwroot\agent\current'
|
||||
agentHome = 'E:\wwwroot\agent\releases\agent-20260913-143916\agent'
|
||||
jeecgbootProxy = 'http://127.0.0.1:8180/jeecgboot/'
|
||||
updatedAt = (Get-Date).ToString('o')
|
||||
note = 'admin cutover Jeecg Vue + ledger 8180'
|
||||
}
|
||||
($obj | ConvertTo-Json) | Out-File -FilePath 'E:\wwwroot\ops\active-release.json' -Encoding utf8
|
||||
Get-Content 'E:\wwwroot\ops\active-release.json'
|
||||
Write-Output 'POINTER_OK'
|
||||
@@ -0,0 +1,34 @@
|
||||
# Force remove stale agent releases (not current)
|
||||
$ErrorActionPreference = 'Continue'
|
||||
$keepName = 'agent-20260913-210940'
|
||||
Get-ChildItem 'E:\wwwroot\agent\releases' | Where-Object { $_.PSIsContainer } | ForEach-Object {
|
||||
$name = $_.Name
|
||||
$full = $_.FullName
|
||||
if ($name -eq $keepName) {
|
||||
Write-Output ('KEEP ' + $name)
|
||||
return
|
||||
}
|
||||
Write-Output ('CLEAN ' + $name)
|
||||
Get-CimInstance Win32_Process | ForEach-Object {
|
||||
$cl = $_.CommandLine
|
||||
if ($cl -and $cl.Contains($full)) {
|
||||
Write-Output ('kill pid=' + $_.ProcessId)
|
||||
Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
Start-Sleep -Seconds 1
|
||||
cmd /c ("rmdir /s /q `"$full`"") | Out-Null
|
||||
if (Test-Path $full) {
|
||||
try {
|
||||
Remove-Item $full -Recurse -Force -ErrorAction Stop
|
||||
Write-Output ('REMOVED_PS ' + $name)
|
||||
} catch {
|
||||
Write-Output ('FAIL ' + $name + ' ' + $_.Exception.Message)
|
||||
}
|
||||
} else {
|
||||
Write-Output ('REMOVED ' + $name)
|
||||
}
|
||||
}
|
||||
Write-Output '=== left ==='
|
||||
Get-ChildItem 'E:\wwwroot\agent\releases' | ForEach-Object { $_.Name }
|
||||
Write-Output 'FORCE_CLEAN_OK'
|
||||
@@ -0,0 +1,104 @@
|
||||
# Force true UTF-8 body (not GBK) with BOM; ASCII-only script
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$path = 'E:\wwwroot\.env'
|
||||
$bak = 'E:\wwwroot\.env.bak-encoding2-' + (Get-Date -Format 'yyyyMMdd-HHmmss')
|
||||
Copy-Item $path $bak -Force
|
||||
|
||||
function U([string]$escaped) {
|
||||
return [System.Text.RegularExpressions.Regex]::Unescape($escaped)
|
||||
}
|
||||
|
||||
# Read previous values using BOTH encodings; prefer lines that parse as KEY=VALUE ascii
|
||||
function Load-Map([byte[]]$bytes) {
|
||||
$map = [ordered]@{}
|
||||
foreach ($encName in @('utf-8', 'gbk')) {
|
||||
$enc = if ($encName -eq 'utf-8') { New-Object System.Text.UTF8Encoding $false } else { [System.Text.Encoding]::GetEncoding(936) }
|
||||
$start = 0
|
||||
if ($bytes.Length -ge 3 -and $bytes[0] -eq 239 -and $bytes[1] -eq 187 -and $bytes[2] -eq 191) { $start = 3 }
|
||||
$text = $enc.GetString($bytes, $start, $bytes.Length - $start)
|
||||
foreach ($line in ($text -split "`r?`n")) {
|
||||
$t = $line.Trim()
|
||||
if (-not $t -or $t.StartsWith('#')) { continue }
|
||||
$i = $t.IndexOf('=')
|
||||
if ($i -lt 1) { continue }
|
||||
$k = $t.Substring(0, $i).Trim()
|
||||
$v = $t.Substring($i + 1)
|
||||
if ($k -notmatch '^[A-Z0-9_]+$') { continue }
|
||||
if (-not $map.Contains($k)) { $map[$k] = $v }
|
||||
}
|
||||
}
|
||||
return $map
|
||||
}
|
||||
|
||||
$bytes = [System.IO.File]::ReadAllBytes($path)
|
||||
$map = Load-Map $bytes
|
||||
Write-Output ('keys=' + $map.Count)
|
||||
|
||||
$goodReply = U '\u8be2\u4ef7\u667a\u80fd\u4f53\u63a5\u901a\u6210\u529f\u3002\u5df2\u6536\u5230\uff1a{content}'
|
||||
$map['WECOM_CALLBACK_REPLY_TEXT'] = $goodReply
|
||||
|
||||
function V([string]$k, [string]$d = '') {
|
||||
if ($map.Contains($k)) { return [string]$map[$k] }
|
||||
return $d
|
||||
}
|
||||
|
||||
$lines = New-Object System.Collections.Generic.List[string]
|
||||
$lines.Add((U '# \u53cb\u901a\u8fbe\u8be2\u4ef7\u667a\u80fd\u4f53 \u00b7 \u73af\u5883\u53d8\u91cf\uff08E:\\wwwroot\\.env\uff09'))
|
||||
$lines.Add((U '# \u7f16\u7801 UTF-8 BOM\uff1b\u8bb0\u4e8b\u672c\u8bf7\u9009 UTF-8\u3002\u7981\u6b62\u63d0\u4ea4 Git\u3002'))
|
||||
$lines.Add((U '# \u5bf9\u7167 prompt/13'))
|
||||
$lines.Add('')
|
||||
$lines.Add('YTD_ENV=' + (V 'YTD_ENV' 'test'))
|
||||
$lines.Add('')
|
||||
$lines.Add((U '# \u516c\u7f51\u4e0e\u4f01\u5fae'))
|
||||
$lines.Add('PUBLIC_BASE_URL=' + (V 'PUBLIC_BASE_URL'))
|
||||
$lines.Add('WECOM_CALLBACK_URL=' + (V 'WECOM_CALLBACK_URL'))
|
||||
$lines.Add('INQUIRY_FORM_PUBLIC_BASE_URL=' + (V 'INQUIRY_FORM_PUBLIC_BASE_URL'))
|
||||
$lines.Add('WECOM_CORP_ID=' + (V 'WECOM_CORP_ID'))
|
||||
$lines.Add('WECOM_AGENT_ID=' + (V 'WECOM_AGENT_ID'))
|
||||
$lines.Add('WECOM_SECRET=' + (V 'WECOM_SECRET'))
|
||||
$lines.Add('WECOM_CALLBACK_TOKEN=' + (V 'WECOM_CALLBACK_TOKEN'))
|
||||
$lines.Add('WECOM_ENCODING_AES_KEY=' + (V 'WECOM_ENCODING_AES_KEY'))
|
||||
$lines.Add('WECOM_CALLBACK_REPLY_TEXT=' + $goodReply)
|
||||
$lines.Add('WECOM_OPS_AGENT_ID=' + (V 'WECOM_OPS_AGENT_ID'))
|
||||
$lines.Add('DEV_INJECT_ENABLED=' + (V 'DEV_INJECT_ENABLED' 'false'))
|
||||
$lines.Add('')
|
||||
$lines.Add((U '# \u5176\u4f59\u914d\u7f6e'))
|
||||
$skip = @('YTD_ENV','PUBLIC_BASE_URL','WECOM_CALLBACK_URL','INQUIRY_FORM_PUBLIC_BASE_URL','WECOM_CORP_ID','WECOM_AGENT_ID','WECOM_SECRET','WECOM_CALLBACK_TOKEN','WECOM_ENCODING_AES_KEY','WECOM_CALLBACK_REPLY_TEXT','WECOM_OPS_AGENT_ID','DEV_INJECT_ENABLED')
|
||||
foreach ($k in $map.Keys) {
|
||||
if ($skip -contains $k) { continue }
|
||||
$lines.Add($k + '=' + $map[$k])
|
||||
}
|
||||
|
||||
$text = [string]::Join("`r`n", $lines.ToArray()) + "`r`n"
|
||||
|
||||
# Write UTF-8 BOM explicitly via bytes
|
||||
$utf8 = New-Object System.Text.UTF8Encoding $false
|
||||
$body = $utf8.GetBytes($text)
|
||||
$bom = [byte[]](0xEF, 0xBB, 0xBF)
|
||||
$all = New-Object byte[] ($bom.Length + $body.Length)
|
||||
[Array]::Copy($bom, 0, $all, 0, 3)
|
||||
[Array]::Copy($body, 0, $all, 3, $body.Length)
|
||||
[System.IO.File]::WriteAllBytes($path, $all)
|
||||
|
||||
# Prove first Chinese char "友" is UTF-8 E5 8F 8B not GBK D3 D1
|
||||
$nb = [System.IO.File]::ReadAllBytes($path)
|
||||
# find first non-ascii after BOM
|
||||
$i = 3
|
||||
while ($i -lt $nb.Length -and $nb[$i] -lt 128) { $i++ }
|
||||
$hex = ($nb[$i..([Math]::Min($i+2, $nb.Length-1))] | ForEach-Object { $_.ToString('X2') }) -join ' '
|
||||
Write-Output ('first_non_ascii_hex=' + $hex)
|
||||
Write-Output ('expect_utf8_you=E5 8F 8B')
|
||||
Write-Output ('is_utf8_you=' + ($hex -eq 'E5 8F 8B'))
|
||||
|
||||
# decode check without console encoding issues: look for UTF-8 sequence of 询
|
||||
$needle = $utf8.GetBytes((U '\u8be2\u4ef7'))
|
||||
$found = $false
|
||||
for ($p = 0; $p -le $nb.Length - $needle.Length; $p++) {
|
||||
$ok = $true
|
||||
for ($j = 0; $j -lt $needle.Length; $j++) {
|
||||
if ($nb[$p + $j] -ne $needle[$j]) { $ok = $false; break }
|
||||
}
|
||||
if ($ok) { $found = $true; break }
|
||||
}
|
||||
Write-Output ('has_utf8_xunjia=' + $found)
|
||||
Write-Output 'ENV_UTF8_OK'
|
||||
@@ -0,0 +1,34 @@
|
||||
# 读取主账启动失败原因(不打印密钥)
|
||||
$ErrorActionPreference = 'Continue'
|
||||
$Err = 'E:\wwwroot\inquiry-new\logs\stderr.log'
|
||||
$Out = 'E:\wwwroot\inquiry-new\logs\stdout.log'
|
||||
Write-Output '=== process ==='
|
||||
Get-CimInstance Win32_Process -Filter "Name='java.exe'" | ForEach-Object {
|
||||
if ($_.CommandLine -like '*inquiry-new*') {
|
||||
"pid=$($_.ProcessId) alive"
|
||||
}
|
||||
}
|
||||
Write-Output '=== port 8180 ==='
|
||||
$c = Get-NetTCPConnection -LocalPort 8180 -State Listen -EA SilentlyContinue | Select-Object -First 1
|
||||
if ($c) { "LISTEN pid=$($c.OwningProcess)" } else { 'down' }
|
||||
|
||||
Write-Output '=== stderr tail ==='
|
||||
if (Test-Path $Err) { Get-Content $Err -Tail 80 } else { 'no stderr' }
|
||||
Write-Output '=== stdout tail ==='
|
||||
if (Test-Path $Out) { Get-Content $Out -Tail 80 } else { 'no stdout' }
|
||||
|
||||
Write-Output '=== try health variants ==='
|
||||
foreach ($u in @(
|
||||
'http://127.0.0.1:8180/jeecgboot/',
|
||||
'http://127.0.0.1:8180/jeecg-boot/',
|
||||
'http://127.0.0.1:8180/actuator/health',
|
||||
'http://127.0.0.1:8180/'
|
||||
)) {
|
||||
try {
|
||||
$r = Invoke-WebRequest -Uri $u -UseBasicParsing -TimeoutSec 5
|
||||
"OK $($r.StatusCode) $u"
|
||||
} catch {
|
||||
"FAIL $u"
|
||||
}
|
||||
}
|
||||
Write-Output 'LEDGER_DIAG_DONE'
|
||||
@@ -0,0 +1,16 @@
|
||||
# 主账 8180 掉线诊断
|
||||
$ErrorActionPreference = 'Continue'
|
||||
Write-Output '=== java inquiry-new ==='
|
||||
Get-CimInstance Win32_Process -Filter "Name='java.exe'" | ForEach-Object {
|
||||
if ($_.CommandLine -like '*inquiry-new*' -or $_.CommandLine -like '*8180*') {
|
||||
"pid=$($_.ProcessId) $($_.CommandLine.Substring(0, [Math]::Min(180, $_.CommandLine.Length)))"
|
||||
}
|
||||
}
|
||||
Write-Output '=== recent stdout error lines ==='
|
||||
Select-String -Path 'E:\wwwroot\inquiry-new\logs\stdout.log' -Pattern 'ERROR|Exception|Started Jeecg|Tomcat started|APPLICATION FAILED' |
|
||||
Select-Object -Last 20 |
|
||||
ForEach-Object { $_.Line.Substring(0, [Math]::Min(220, $_.Line.Length)) }
|
||||
Write-Output '=== file times ==='
|
||||
Get-Item 'E:\wwwroot\inquiry-new\logs\stdout.log','E:\wwwroot\inquiry-new\logs\stderr.log' |
|
||||
ForEach-Object { "$($_.Name) len=$($_.Length) mtime=$($_.LastWriteTime)" }
|
||||
Write-Output 'DIAG2_DONE'
|
||||
@@ -0,0 +1,6 @@
|
||||
# 抓主账 stdout 里最后一次失败的根因
|
||||
$ErrorActionPreference = 'Continue'
|
||||
$log = 'E:\wwwroot\inquiry-new\logs\stdout.log'
|
||||
Write-Output '=== last 80 ==='
|
||||
Get-Content $log -Tail 80
|
||||
Write-Output 'TAIL_DONE'
|
||||
@@ -0,0 +1,40 @@
|
||||
# List wwwroot layout for cleanup decision
|
||||
$ErrorActionPreference = 'Continue'
|
||||
Write-Output '=== tree tops ==='
|
||||
@(
|
||||
'E:\wwwroot',
|
||||
'E:\wwwroot\agent',
|
||||
'E:\wwwroot\admin',
|
||||
'E:\wwwroot\inquiry-new',
|
||||
'E:\wwwroot\ops',
|
||||
'E:\wwwroot\agent\current',
|
||||
'E:\wwwroot\admin\current'
|
||||
) | ForEach-Object { "$_ => $(Test-Path $_)" }
|
||||
|
||||
Write-Output '=== agent releases ==='
|
||||
if (Test-Path 'E:\wwwroot\agent\releases') {
|
||||
Get-ChildItem 'E:\wwwroot\agent\releases' | ForEach-Object { $_.Name + ' ' + $_.LastWriteTime }
|
||||
} else { 'missing agent/releases' }
|
||||
|
||||
Write-Output '=== admin releases ==='
|
||||
if (Test-Path 'E:\wwwroot\admin\releases') {
|
||||
Get-ChildItem 'E:\wwwroot\admin\releases' | ForEach-Object { $_.Name + ' ' + $_.LastWriteTime }
|
||||
} else { 'missing admin/releases' }
|
||||
|
||||
Write-Output '=== current targets ==='
|
||||
foreach ($p in @('E:\wwwroot\agent\current','E:\wwwroot\admin\current')) {
|
||||
if (Test-Path $p) {
|
||||
$i = Get-Item $p -Force
|
||||
"link=$p type=$($i.LinkType) target=$($i.Target)"
|
||||
} else { "missing $p" }
|
||||
}
|
||||
|
||||
Write-Output '=== pointer ==='
|
||||
if (Test-Path 'E:\wwwroot\ops\active-release.json') { Get-Content 'E:\wwwroot\ops\active-release.json' -Raw }
|
||||
|
||||
Write-Output '=== ports ==='
|
||||
foreach ($x in 8080,8810,8813,8180,8910,8913) {
|
||||
$c = Get-NetTCPConnection -LocalPort $x -State Listen -EA SilentlyContinue | Select-Object -First 1
|
||||
if ($c) { "$x LISTEN pid=$($c.OwningProcess)" } else { "$x down" }
|
||||
}
|
||||
Write-Output 'LIST_DONE'
|
||||
@@ -0,0 +1,26 @@
|
||||
# Check captcha flag on running ledger + try login without captcha
|
||||
$ErrorActionPreference = 'Continue'
|
||||
Write-Output '=== overlay jeecg.loginCaptcha ==='
|
||||
Select-String -Path 'E:\wwwroot\inquiry-new\config\application-inquiry.yml' -Pattern 'loginCaptcha|cas:' | ForEach-Object { $_.Line }
|
||||
Write-Output '=== process cmdline ==='
|
||||
Get-CimInstance Win32_Process -Filter "Name='java.exe'" | ForEach-Object {
|
||||
if ($_.CommandLine -like '*inquiry-new*') {
|
||||
$_.CommandLine.Substring(0, [Math]::Min(300, $_.CommandLine.Length))
|
||||
}
|
||||
}
|
||||
Write-Output '=== login attempt ==='
|
||||
$body = '{"username":"admin","password":"123456","captcha":"","checkKey":""}'
|
||||
try {
|
||||
$r = Invoke-WebRequest -Uri 'http://127.0.0.1:8180/jeecgboot/sys/login' -Method POST -Body $body -ContentType 'application/json;charset=UTF-8' -UseBasicParsing -TimeoutSec 15
|
||||
"status=$($r.StatusCode) body=$($r.Content.Substring(0,[Math]::Min(300,$r.Content.Length)))"
|
||||
} catch {
|
||||
$resp = $_.Exception.Response
|
||||
if ($resp) {
|
||||
$reader = New-Object System.IO.StreamReader($resp.GetResponseStream())
|
||||
$txt = $reader.ReadToEnd()
|
||||
"http_err status=$([int]$resp.StatusCode) body=$txt"
|
||||
} else {
|
||||
"err=$($_.Exception.Message)"
|
||||
}
|
||||
}
|
||||
Write-Output 'CAPTCHA_CHECK_DONE'
|
||||
@@ -0,0 +1,27 @@
|
||||
# 切后台后验收:静态是否为 Jeecg、API 是否走 8180
|
||||
$ErrorActionPreference = 'Continue'
|
||||
Write-Output '=== admin index sniff ==='
|
||||
$idx = 'E:\wwwroot\admin\current\index.html'
|
||||
if (Test-Path $idx) {
|
||||
Get-Content $idx -TotalCount 30
|
||||
}
|
||||
Write-Output '=== app config ==='
|
||||
$cfg = Get-ChildItem 'E:\wwwroot\admin\current' -Filter '_app.config.js' -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1
|
||||
if ($cfg) {
|
||||
Select-String -Path $cfg.FullName -Pattern 'VITE_GLOB|jeecgboot|8080|8180|ai.ytd' | ForEach-Object { $_.Line.Substring(0, [Math]::Min(200, $_.Line.Length)) }
|
||||
}
|
||||
Write-Output '=== nginx targets ==='
|
||||
Select-String -Path 'C:\nginx-1.18.0\myconf\ai.conf' -Pattern 'proxy_pass|root ' | ForEach-Object { $_.Line.Trim() }
|
||||
Write-Output '=== ports ==='
|
||||
foreach ($x in 8080,8180,8910) {
|
||||
$c = Get-NetTCPConnection -LocalPort $x -State Listen -EA SilentlyContinue | Select-Object -First 1
|
||||
if ($c) { "$x LISTEN" } else { "$x down" }
|
||||
}
|
||||
Write-Output '=== local proxy smoke ==='
|
||||
try {
|
||||
$r = Invoke-WebRequest -Uri 'http://127.0.0.1:8180/jeecgboot/sys/randomImage/aftercut' -UseBasicParsing -TimeoutSec 8
|
||||
"8180 ok $($r.StatusCode)"
|
||||
} catch { "8180 fail" }
|
||||
Write-Output '=== pointer ==='
|
||||
Get-Content 'E:\wwwroot\ops\active-release.json' -Raw
|
||||
Write-Output 'POST_CUT_OK'
|
||||
@@ -0,0 +1,45 @@
|
||||
# 探测新系统智能体 8910 日志落点(只读,不改现网)
|
||||
$ErrorActionPreference = 'Continue'
|
||||
Write-Output '=== 8910 listen ==='
|
||||
$c = Get-NetTCPConnection -LocalPort 8910 -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1
|
||||
if ($c) {
|
||||
Write-Output ("LISTEN pid=" + $c.OwningProcess)
|
||||
} else {
|
||||
Write-Output '8910 not listening'
|
||||
}
|
||||
|
||||
Write-Output '=== health ==='
|
||||
try {
|
||||
$h = Invoke-WebRequest -Uri 'http://127.0.0.1:8910/health' -UseBasicParsing -TimeoutSec 5
|
||||
Write-Output $h.Content
|
||||
} catch {
|
||||
Write-Output ('health_fail: ' + $_.Exception.Message)
|
||||
}
|
||||
|
||||
Write-Output '=== candidate log dirs ==='
|
||||
$dirs = @(
|
||||
'E:\wwwroot\logs',
|
||||
'E:\wwwroot\agent\logs',
|
||||
'E:\wwwroot\agent\current',
|
||||
'C:\ytd-test\logs'
|
||||
)
|
||||
foreach ($d in $dirs) {
|
||||
if (Test-Path $d) {
|
||||
Write-Output ("DIR_OK " + $d)
|
||||
Get-ChildItem $d -File -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.Name -match 'agent|wecom|http|worker' } |
|
||||
Sort-Object LastWriteTime -Descending |
|
||||
Select-Object -First 20 |
|
||||
ForEach-Object { Write-Output (" " + $_.FullName + " bytes=" + $_.Length + " mtime=" + $_.LastWriteTime.ToString('s')) }
|
||||
} else {
|
||||
Write-Output ("DIR_MISSING " + $d)
|
||||
}
|
||||
}
|
||||
|
||||
Write-Output '=== python cmdlines matching wwwroot/agent ==='
|
||||
Get-CimInstance Win32_Process -Filter "Name='python.exe'" -ErrorAction SilentlyContinue | ForEach-Object {
|
||||
$cl = $_.CommandLine
|
||||
if ($null -ne $cl -and ($cl -match 'wwwroot|agent\.http_app|8910')) {
|
||||
Write-Output ("pid=" + $_.ProcessId + " " + $cl)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
# 快速看 8180 是否还活着
|
||||
$ErrorActionPreference = 'Continue'
|
||||
$c = Get-NetTCPConnection -LocalPort 8180 -State Listen -EA SilentlyContinue | Select-Object -First 1
|
||||
if ($c) { "8180 LISTEN pid=$($c.OwningProcess)" } else { '8180 down' }
|
||||
$p8080 = Get-NetTCPConnection -LocalPort 8080 -State Listen -EA SilentlyContinue | Select-Object -First 1
|
||||
if ($p8080) { "8080 LISTEN pid=$($p8080.OwningProcess)" } else { '8080 down' }
|
||||
$p8910 = Get-NetTCPConnection -LocalPort 8910 -State Listen -EA SilentlyContinue | Select-Object -First 1
|
||||
if ($p8910) { "8910 LISTEN pid=$($p8910.OwningProcess)" } else { '8910 down' }
|
||||
try {
|
||||
$r = Invoke-WebRequest -Uri 'http://127.0.0.1:8180/jeecgboot/sys/randomImage/deploycheck' -UseBasicParsing -TimeoutSec 8
|
||||
"8180_randomImage=$($r.StatusCode) bytes=$($r.RawContentLength)"
|
||||
} catch {
|
||||
$code = $null
|
||||
try { $code = $_.Exception.Response.StatusCode.value__ } catch {}
|
||||
"8180_randomImage FAIL code=$code msg=$($_.Exception.Message)"
|
||||
}
|
||||
Get-CimInstance Win32_Process -Filter "Name='java.exe'" | ForEach-Object {
|
||||
if ($_.CommandLine -like '*inquiry-new*') { "java pid=$($_.ProcessId) alive" }
|
||||
}
|
||||
Write-Output 'QUICK_DONE'
|
||||
@@ -0,0 +1,62 @@
|
||||
# 用本机 Python 测 Redis AUTH(只打印 PONG/错误类型,不打印口令)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
Get-Content 'E:\wwwroot\.env' | ForEach-Object {
|
||||
$line = $_.Trim()
|
||||
if (-not $line -or $line.StartsWith('#')) { return }
|
||||
$i = $line.IndexOf('=')
|
||||
if ($i -lt 1) { return }
|
||||
Set-Item -Path ("Env:" + $line.Substring(0,$i).Trim()) -Value $line.Substring($i+1).Trim().Trim('"')
|
||||
}
|
||||
$py = 'C:\yutongda\tools\Python312\python.exe'
|
||||
$code = @'
|
||||
import os, socket, sys
|
||||
url = os.environ.get("REDIS_URL","")
|
||||
host = os.environ.get("YTD_REDIS_HOST","10.206.0.14")
|
||||
port = int(os.environ.get("YTD_REDIS_PORT","6379"))
|
||||
user = os.environ.get("YTD_REDIS_USERNAME","")
|
||||
pwd = os.environ.get("YTD_REDIS_PASSWORD","")
|
||||
# parse url if needed
|
||||
if url.startswith("redis://"):
|
||||
rest = url[len("redis://"):]
|
||||
if "@" in rest:
|
||||
cred, hp = rest.split("@",1)
|
||||
if ":" in cred:
|
||||
u,p = cred.split(":",1)
|
||||
if u: user = u
|
||||
pwd = p
|
||||
else:
|
||||
pwd = cred
|
||||
host = hp.split("/")[0].split(":")[0]
|
||||
if ":" in hp.split("/")[0]:
|
||||
port = int(hp.split("/")[0].split(":")[1])
|
||||
|
||||
def send(auth_cmd):
|
||||
s = socket.create_connection((host, port), 5)
|
||||
s.sendall(auth_cmd)
|
||||
data = s.recv(256)
|
||||
s.close()
|
||||
return data
|
||||
|
||||
# RESP AUTH
|
||||
def resp_auth_password(p):
|
||||
p = p.encode()
|
||||
return b"*2\r\n$4\r\nAUTH\r\n$%d\r\n%s\r\n" % (len(p), p)
|
||||
|
||||
def resp_auth_user(u, p):
|
||||
u=u.encode(); p=p.encode()
|
||||
return b"*3\r\n$4\r\nAUTH\r\n$%d\r\n%s\r\n$%d\r\n%s\r\n" % (len(u), u, len(p), p)
|
||||
|
||||
print("host=%s port=%s user_len=%s pwd_len=%s" % (host, port, len(user or ""), len(pwd or "")))
|
||||
try:
|
||||
r1 = send(resp_auth_password(pwd or ""))
|
||||
print("auth_password:", r1[:80])
|
||||
except Exception as e:
|
||||
print("auth_password_err", type(e).__name__, str(e)[:80])
|
||||
if user:
|
||||
try:
|
||||
r2 = send(resp_auth_user(user, pwd or ""))
|
||||
print("auth_user:", r2[:80])
|
||||
except Exception as e:
|
||||
print("auth_user_err", type(e).__name__, str(e)[:80])
|
||||
'@
|
||||
$code | & $py -
|
||||
@@ -0,0 +1,45 @@
|
||||
# Redis connectivity probe (no secrets printed)
|
||||
$ErrorActionPreference = 'Continue'
|
||||
Get-Content 'E:\wwwroot\.env' | ForEach-Object {
|
||||
$line = $_.Trim()
|
||||
if (-not $line -or $line.StartsWith('#')) { return }
|
||||
$i = $line.IndexOf('=')
|
||||
if ($i -lt 1) { return }
|
||||
$k = $line.Substring(0, $i).Trim()
|
||||
$v = $line.Substring($i + 1).Trim().Trim('"')
|
||||
if ($k -match 'REDIS|YTD_REDIS') {
|
||||
if ($k -match 'PASSWORD|URL') {
|
||||
Write-Output ("$k len=" + $v.Length + " has_at=" + ($v -match '@'))
|
||||
} else {
|
||||
Write-Output ("$k=$v")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Output '=== local 6379 ==='
|
||||
$c = Get-NetTCPConnection -LocalPort 6379 -State Listen -EA SilentlyContinue | Select-Object -First 1
|
||||
if ($c) { "127.0.0.1:6379 LISTEN pid=$($c.OwningProcess)" } else { 'local 6379 down' }
|
||||
|
||||
$redisCli = @(
|
||||
'C:\yutongda\tools\Redis\redis-cli.exe',
|
||||
'C:\Program Files\Redis\redis-cli.exe',
|
||||
'E:\wwwroot\tools\redis-cli.exe'
|
||||
) | Where-Object { Test-Path $_ } | Select-Object -First 1
|
||||
|
||||
Write-Output ("redis-cli=" + $redisCli)
|
||||
|
||||
# try ping local without auth
|
||||
if ($redisCli) {
|
||||
& $redisCli -h 127.0.0.1 -p 6379 PING 2>&1 | ForEach-Object { "local_nopass: $_" }
|
||||
}
|
||||
|
||||
# try data host from env if present
|
||||
$hostLine = (Get-Content 'E:\wwwroot\.env' | Where-Object { $_ -match '^YTD_REDIS_HOST=' } | Select-Object -First 1)
|
||||
if ($hostLine) {
|
||||
$rh = $hostLine.Split('=',2)[1].Trim().Trim('"')
|
||||
Write-Output ("env_host=$rh")
|
||||
if ($redisCli -and $rh -and $rh -ne '127.0.0.1') {
|
||||
& $redisCli -h $rh -p 6379 PING 2>&1 | ForEach-Object { "remote_nopass: $_" }
|
||||
}
|
||||
}
|
||||
Write-Output 'REDIS_PROBE_DONE'
|
||||
@@ -0,0 +1,29 @@
|
||||
# TCP 探测 Redis,不打印口令
|
||||
$ErrorActionPreference = 'Continue'
|
||||
function Test-Port($h, $p) {
|
||||
try {
|
||||
$tcp = New-Object System.Net.Sockets.TcpClient
|
||||
$iar = $tcp.BeginConnect($h, [int]$p, $null, $null)
|
||||
$ok = $iar.AsyncWaitHandle.WaitOne(3000, $false)
|
||||
if (-not $ok) { $tcp.Close(); return "TIMEOUT $h`:$p" }
|
||||
$tcp.EndConnect($iar)
|
||||
$tcp.Close()
|
||||
return "OPEN $h`:$p"
|
||||
} catch {
|
||||
return "FAIL $h`:$p $($_.Exception.Message)"
|
||||
}
|
||||
}
|
||||
Write-Output (Test-Port '127.0.0.1' 6379)
|
||||
Write-Output (Test-Port '10.206.0.14' 6379)
|
||||
Write-Output (Test-Port '10.206.0.15' 6379)
|
||||
Write-Output (Test-Port '10.206.0.14' 3306)
|
||||
|
||||
# 从 REDIS_URL 解析 host
|
||||
$raw = (Get-Content 'E:\wwwroot\.env' | Where-Object { $_ -match '^REDIS_URL=' } | Select-Object -First 1)
|
||||
if ($raw) {
|
||||
if ($raw -match '@([^:/]+):(\d+)/(\d+)') {
|
||||
Write-Output ("url_host=" + $Matches[1] + " port=" + $Matches[2] + " db=" + $Matches[3])
|
||||
Write-Output (Test-Port $Matches[1] $Matches[2])
|
||||
}
|
||||
}
|
||||
Write-Output 'TCP_DONE'
|
||||
@@ -0,0 +1,90 @@
|
||||
# Kill duplicate agent wrappers; keep newest; then remove stale release dirs
|
||||
$ErrorActionPreference = 'Continue'
|
||||
$Root = 'E:\wwwroot'
|
||||
$keepRel = 'agent-20260913-210940'
|
||||
$keepHome = Join-Path $Root ("agent\releases\" + $keepRel + "\agent")
|
||||
|
||||
Write-Output '=== stop ALL agent cmd/python under wwwroot ==='
|
||||
Get-CimInstance Win32_Process | ForEach-Object {
|
||||
$cl = $_.CommandLine
|
||||
if (-not $cl) { return }
|
||||
$hit = $false
|
||||
if ($cl -like '*run-agent-http.cmd*' -or $cl -like '*run-agent-worker.cmd*') { $hit = $true }
|
||||
if ($cl -like '*agent.http_app*' -or $cl -like '*agent.worker_app*') { $hit = $true }
|
||||
if ($cl -like '*wwwroot\agent*') { $hit = $true }
|
||||
if ($hit) {
|
||||
Write-Output ("stop pid=$($_.ProcessId) $($_.Name)")
|
||||
Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
# also free 8910
|
||||
Get-NetTCPConnection -LocalPort 8910 -ErrorAction SilentlyContinue |
|
||||
Select-Object -ExpandProperty OwningProcess -Unique |
|
||||
ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue }
|
||||
Start-Sleep -Seconds 3
|
||||
|
||||
Write-Output '=== delete stale releases ==='
|
||||
Get-ChildItem (Join-Path $Root 'agent\releases') | Where-Object { $_.PSIsContainer } | ForEach-Object {
|
||||
if ($_.Name -eq $keepRel) {
|
||||
Write-Output ('KEEP ' + $_.Name)
|
||||
} else {
|
||||
$full = $_.FullName
|
||||
cmd /c ("rmdir /s /q `"$full`"") | Out-Null
|
||||
if (Test-Path $full) {
|
||||
Write-Output ('STILL ' + $_.Name)
|
||||
} else {
|
||||
Write-Output ('GONE ' + $_.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Output '=== rewrite run scripts to keepHome ==='
|
||||
$venvPy = Join-Path $keepHome '.venv\Scripts\python.exe'
|
||||
$runHttp = @(
|
||||
'@echo off',
|
||||
('cd /d "' + $keepHome + '"'),
|
||||
'set YTD_ENV=test',
|
||||
'set AGENT_HTTP_PORT=8910',
|
||||
'set PYTHONUTF8=1',
|
||||
':loop',
|
||||
('"' + $venvPy + '" -m agent.http_app >> "' + $Root + '\logs\agent-http.out.log" 2>> "' + $Root + '\logs\agent-http.err.log"'),
|
||||
('echo agent exited >> "' + $Root + '\logs\agent-http.err.log"'),
|
||||
'timeout /t 3 /nobreak >nul',
|
||||
'goto loop'
|
||||
) -join "`r`n"
|
||||
Set-Content -Path (Join-Path $Root 'ops\run-agent-http.cmd') -Value $runHttp -Encoding ASCII
|
||||
|
||||
$runWorker = @(
|
||||
'@echo off',
|
||||
('cd /d "' + $keepHome + '"'),
|
||||
'set YTD_ENV=test',
|
||||
'set PYTHONUTF8=1',
|
||||
':loop',
|
||||
('"' + $venvPy + '" -m agent.worker_app >> "' + $Root + '\logs\agent-worker.out.log" 2>> "' + $Root + '\logs\agent-worker.err.log"'),
|
||||
('echo worker exited >> "' + $Root + '\logs\agent-worker.err.log"'),
|
||||
'timeout /t 3 /nobreak >nul',
|
||||
'goto loop'
|
||||
) -join "`r`n"
|
||||
Set-Content -Path (Join-Path $Root 'ops\run-agent-worker.cmd') -Value $runWorker -Encoding ASCII
|
||||
|
||||
# ensure junction
|
||||
$current = Join-Path $Root 'agent\current'
|
||||
if (Test-Path $current) { cmd /c ("rmdir `"$current`"") | Out-Null }
|
||||
cmd /c ("mklink /J `"$current`" `"$keepHome`"") | Out-Null
|
||||
|
||||
Write-Output '=== start one http + one worker ==='
|
||||
$w1 = Invoke-CimMethod -ClassName Win32_Process -MethodName Create -Arguments @{ CommandLine = ('cmd.exe /c "' + (Join-Path $Root 'ops\run-agent-http.cmd') + '"') }
|
||||
$w2 = Invoke-CimMethod -ClassName Win32_Process -MethodName Create -Arguments @{ CommandLine = ('cmd.exe /c "' + (Join-Path $Root 'ops\run-agent-worker.cmd') + '"') }
|
||||
Write-Output ("http_wmi=" + $w1.ReturnValue + " worker_wmi=" + $w2.ReturnValue)
|
||||
Start-Sleep -Seconds 6
|
||||
try {
|
||||
$h = Invoke-WebRequest -Uri 'http://127.0.0.1:8910/health' -UseBasicParsing -TimeoutSec 8
|
||||
Write-Output ('HEALTH=' + $h.StatusCode + ' ' + $h.Content)
|
||||
} catch {
|
||||
Write-Output ('health_fail ' + $_)
|
||||
Get-Content (Join-Path $Root 'logs\agent-http.err.log') -Tail 30 -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
Write-Output '=== left releases ==='
|
||||
Get-ChildItem (Join-Path $Root 'agent\releases') | ForEach-Object { $_.Name }
|
||||
Write-Output 'REPAIR_OK'
|
||||
@@ -1,33 +1,28 @@
|
||||
# 安全发布:新 release + 切 agent\current,重启 8910;禁止改 Nginx / C:\yutongda
|
||||
# 入参:incoming\agent-release.zip 已就位;可选 env.file 覆盖 E:\wwwroot\.env
|
||||
# Safe agent deploy: new release, switch junction, restart 8910+worker. No nginx / no C:\yutongda.
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$ReleaseId = 'agent-' + (Get-Date -Format 'yyyyMMdd-HHmmss')
|
||||
$Root = 'E:\wwwroot'
|
||||
$Release = Join-Path $Root "agent\releases\$ReleaseId"
|
||||
$Release = Join-Path $Root ("agent\releases\" + $ReleaseId)
|
||||
$AgentCurrent = Join-Path $Root 'agent\current'
|
||||
$Python = 'C:\yutongda\tools\Python312\python.exe'
|
||||
$Zip = 'C:\Users\ytd_extdev_0903\incoming\agent-release.zip'
|
||||
$EnvSrc = 'C:\Users\ytd_extdev_0903\incoming\env.file'
|
||||
|
||||
Write-Output "=== create dirs release=$ReleaseId ==="
|
||||
New-Item -ItemType Directory -Force -Path $Release, "$Root\logs", "$Root\ops", "$Root\agent\releases" | Out-Null
|
||||
if (-not (Test-Path $Zip)) { throw "missing $Zip" }
|
||||
if (-not (Test-Path $Python)) { throw "missing $Python" }
|
||||
Write-Output ("=== create dirs release=" + $ReleaseId + " ===")
|
||||
New-Item -ItemType Directory -Force -Path $Release, (Join-Path $Root 'logs'), (Join-Path $Root 'ops'), (Join-Path $Root 'agent\releases') | Out-Null
|
||||
if (-not (Test-Path $Zip)) { throw 'missing agent-release.zip' }
|
||||
if (-not (Test-Path $Python)) { throw 'missing python' }
|
||||
|
||||
Write-Output '=== expand ==='
|
||||
Expand-Archive -Path $Zip -DestinationPath $Release -Force
|
||||
$AgentHome = Join-Path $Release 'agent'
|
||||
if (-not (Test-Path (Join-Path $AgentHome 'agent\http_app.py'))) {
|
||||
throw "http_app.py not found under $AgentHome"
|
||||
}
|
||||
$HttpApp = Join-Path $AgentHome 'agent\http_app.py'
|
||||
if (-not (Test-Path $HttpApp)) { throw 'http_app.py not found' }
|
||||
|
||||
Write-Output '=== env ==='
|
||||
if (Test-Path $EnvSrc) {
|
||||
Copy-Item $EnvSrc (Join-Path $Root '.env') -Force
|
||||
}
|
||||
if (-not (Test-Path (Join-Path $Root '.env'))) { throw 'missing E:\wwwroot\.env' }
|
||||
Copy-Item (Join-Path $Root '.env') (Join-Path $Release '.env') -Force
|
||||
Copy-Item (Join-Path $Root '.env') (Join-Path $AgentHome '.env') -Force
|
||||
$EnvFile = Join-Path $Root '.env'
|
||||
if (-not (Test-Path $EnvFile)) { throw 'missing E:\wwwroot\.env' }
|
||||
Copy-Item $EnvFile (Join-Path $Release '.env') -Force
|
||||
Copy-Item $EnvFile (Join-Path $AgentHome '.env') -Force
|
||||
|
||||
Write-Output '=== venv + pip ==='
|
||||
$venvDir = Join-Path $AgentHome '.venv'
|
||||
@@ -37,93 +32,111 @@ if (-not (Test-Path $venvPy)) {
|
||||
& $Python -m venv $venvDir
|
||||
if ($LASTEXITCODE -ne 0) { throw 'venv failed' }
|
||||
}
|
||||
& $venvPip install --default-timeout=180 -i https://pypi.tuna.tsinghua.edu.cn/simple -r (Join-Path $AgentHome 'requirements.txt')
|
||||
# Windows Chinese locale: force UTF-8 so requirements.txt comments decode
|
||||
$env:PYTHONUTF8 = '1'
|
||||
$env:PYTHONIOENCODING = 'utf-8'
|
||||
$Req = Join-Path $AgentHome 'requirements.txt'
|
||||
& $venvPip install --default-timeout=180 -i https://pypi.tuna.tsinghua.edu.cn/simple -r $Req
|
||||
if ($LASTEXITCODE -ne 0) { throw 'pip install failed' }
|
||||
|
||||
Write-Output '=== switch junction ==='
|
||||
if (Test-Path $AgentCurrent) {
|
||||
cmd /c "rmdir `"$AgentCurrent`"" | Out-Null
|
||||
cmd /c ("rmdir `"" + $AgentCurrent + "`"") | Out-Null
|
||||
if (Test-Path $AgentCurrent) { Remove-Item $AgentCurrent -Recurse -Force }
|
||||
}
|
||||
cmd /c "mklink /J `"$AgentCurrent`" `"$AgentHome`""
|
||||
cmd /c ("mklink /J `"" + $AgentCurrent + "`" `"" + $AgentHome + "`"")
|
||||
if (-not (Test-Path (Join-Path $AgentCurrent 'agent\http_app.py'))) { throw 'agent current missing http_app' }
|
||||
|
||||
Write-Output '=== stop old 8910 only ==='
|
||||
Get-NetTCPConnection -LocalPort 8910 -ErrorAction SilentlyContinue |
|
||||
Select-Object -ExpandProperty OwningProcess -Unique |
|
||||
ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue }
|
||||
# 停旧 worker(仅匹配 wwwroot agent)
|
||||
|
||||
Get-CimInstance Win32_Process -Filter "Name='python.exe'" | ForEach-Object {
|
||||
if ($_.CommandLine -and $_.CommandLine -like '*E:\wwwroot\agent*' -and $_.CommandLine -like '*worker_app*') {
|
||||
Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue
|
||||
$cl = $_.CommandLine
|
||||
if ($null -ne $cl) {
|
||||
if (($cl -like '*wwwroot*agent*') -and ($cl -like '*worker_app*')) {
|
||||
Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
}
|
||||
Start-Sleep -Seconds 2
|
||||
|
||||
Write-Output '=== write run scripts ==='
|
||||
$runHttp = @"
|
||||
@echo off
|
||||
cd /d "$AgentCurrent"
|
||||
set YTD_ENV=test
|
||||
set AGENT_HTTP_PORT=8910
|
||||
:loop
|
||||
"$AgentCurrent\.venv\Scripts\python.exe" -m agent.http_app >> "$Root\logs\agent-http.out.log" 2>> "$Root\logs\agent-http.err.log"
|
||||
echo agent exited, restart in 3s >> "$Root\logs\agent-http.err.log"
|
||||
timeout /t 3 /nobreak >nul
|
||||
goto loop
|
||||
"@
|
||||
Set-Content -Path (Join-Path $Root 'ops\run-agent-http.cmd') -Value $runHttp -Encoding ASCII
|
||||
$runHttpPath = Join-Path $Root 'ops\run-agent-http.cmd'
|
||||
$runWorkerPath = Join-Path $Root 'ops\run-agent-worker.cmd'
|
||||
$logHttpOut = Join-Path $Root 'logs\agent-http.out.log'
|
||||
$logHttpErr = Join-Path $Root 'logs\agent-http.err.log'
|
||||
$logWorkerOut = Join-Path $Root 'logs\agent-worker.out.log'
|
||||
$logWorkerErr = Join-Path $Root 'logs\agent-worker.err.log'
|
||||
|
||||
$runWorker = @"
|
||||
@echo off
|
||||
cd /d "$AgentCurrent"
|
||||
set YTD_ENV=test
|
||||
:loop
|
||||
"$AgentCurrent\.venv\Scripts\python.exe" -m agent.worker_app >> "$Root\logs\agent-worker.out.log" 2>> "$Root\logs\agent-worker.err.log"
|
||||
echo worker exited, restart in 3s >> "$Root\logs\agent-worker.err.log"
|
||||
timeout /t 3 /nobreak >nul
|
||||
goto loop
|
||||
"@
|
||||
Set-Content -Path (Join-Path $Root 'ops\run-agent-worker.cmd') -Value $runWorker -Encoding ASCII
|
||||
$runHttp = @(
|
||||
'@echo off',
|
||||
('cd /d "' + $AgentCurrent + '"'),
|
||||
'set YTD_ENV=test',
|
||||
'set AGENT_HTTP_PORT=8910',
|
||||
':loop',
|
||||
('"' + $venvPy + '" -m agent.http_app >> "' + $logHttpOut + '" 2>> "' + $logHttpErr + '"'),
|
||||
('echo agent exited, restart in 3s >> "' + $logHttpErr + '"'),
|
||||
'timeout /t 3 /nobreak >nul',
|
||||
'goto loop'
|
||||
) -join "`r`n"
|
||||
Set-Content -Path $runHttpPath -Value $runHttp -Encoding ASCII
|
||||
|
||||
$runWorker = @(
|
||||
'@echo off',
|
||||
('cd /d "' + $AgentCurrent + '"'),
|
||||
'set YTD_ENV=test',
|
||||
':loop',
|
||||
('"' + $venvPy + '" -m agent.worker_app >> "' + $logWorkerOut + '" 2>> "' + $logWorkerErr + '"'),
|
||||
('echo worker exited, restart in 3s >> "' + $logWorkerErr + '"'),
|
||||
'timeout /t 3 /nobreak >nul',
|
||||
'goto loop'
|
||||
) -join "`r`n"
|
||||
Set-Content -Path $runWorkerPath -Value $runWorker -Encoding ASCII
|
||||
|
||||
Write-Output '=== start http + worker via WMI ==='
|
||||
$w1 = Invoke-CimMethod -ClassName Win32_Process -MethodName Create -Arguments @{
|
||||
CommandLine = "cmd.exe /c `"$(Join-Path $Root 'ops\run-agent-http.cmd')`""
|
||||
CommandLine = ('cmd.exe /c "' + $runHttpPath + '"')
|
||||
}
|
||||
Write-Output "HTTP_WMI=$($w1.ReturnValue) pid=$($w1.ProcessId)"
|
||||
Write-Output ("HTTP_WMI=" + $w1.ReturnValue + " pid=" + $w1.ProcessId)
|
||||
$w2 = Invoke-CimMethod -ClassName Win32_Process -MethodName Create -Arguments @{
|
||||
CommandLine = "cmd.exe /c `"$(Join-Path $Root 'ops\run-agent-worker.cmd')`""
|
||||
CommandLine = ('cmd.exe /c "' + $runWorkerPath + '"')
|
||||
}
|
||||
Write-Output "WORKER_WMI=$($w2.ReturnValue) pid=$($w2.ProcessId)"
|
||||
Write-Output ("WORKER_WMI=" + $w2.ReturnValue + " pid=" + $w2.ProcessId)
|
||||
Start-Sleep -Seconds 8
|
||||
|
||||
try {
|
||||
$h = Invoke-WebRequest -Uri 'http://127.0.0.1:8910/health' -UseBasicParsing -TimeoutSec 8
|
||||
Write-Output "HEALTH=$($h.StatusCode) $($h.Content)"
|
||||
Write-Output ("HEALTH=" + $h.StatusCode + " " + $h.Content)
|
||||
} catch {
|
||||
Get-Content (Join-Path $Root 'logs\agent-http.err.log') -Tail 40 -ErrorAction SilentlyContinue
|
||||
throw "agent health failed: $_"
|
||||
if (Test-Path $logHttpErr) { Get-Content $logHttpErr -Tail 40 }
|
||||
throw ('agent health failed: ' + $_)
|
||||
}
|
||||
|
||||
$listenPid = 0
|
||||
$listen = Get-NetTCPConnection -LocalPort 8910 -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1
|
||||
if ($listen) { $listenPid = $listen.OwningProcess }
|
||||
|
||||
$prevAdmin = $null
|
||||
if (Test-Path (Join-Path $Root 'ops\active-release.json')) {
|
||||
try { $prevAdmin = (Get-Content (Join-Path $Root 'ops\active-release.json') -Raw | ConvertFrom-Json).adminCurrent } catch {}
|
||||
$prevAdmin = Join-Path $Root 'admin\current'
|
||||
$ptrPath = Join-Path $Root 'ops\active-release.json'
|
||||
if (Test-Path $ptrPath) {
|
||||
try {
|
||||
$old = Get-Content $ptrPath -Raw | ConvertFrom-Json
|
||||
if ($old.adminCurrent) { $prevAdmin = $old.adminCurrent }
|
||||
} catch {}
|
||||
}
|
||||
|
||||
@{
|
||||
$ptr = @{
|
||||
root = $Root
|
||||
releaseId = $ReleaseId
|
||||
releaseRoot = $Release
|
||||
agentHome = $AgentHome
|
||||
agentCurrent = $AgentCurrent
|
||||
adminCurrent = $(if ($prevAdmin) { $prevAdmin } else { Join-Path $Root 'admin\current' })
|
||||
adminCurrent = $prevAdmin
|
||||
pid = $listenPid
|
||||
updatedAt = (Get-Date).ToString('o')
|
||||
note = 'safe deploy: no nginx change, no C:\yutongda touch'
|
||||
} | ConvertTo-Json | Set-Content (Join-Path $Root 'ops\active-release.json') -Encoding UTF8
|
||||
|
||||
note = 'safe deploy: no nginx change'
|
||||
}
|
||||
$ptr | ConvertTo-Json | Set-Content $ptrPath -Encoding UTF8
|
||||
Write-Output 'AGENT_SAFE_DEPLOY_OK'
|
||||
|
||||
@@ -1,96 +1,87 @@
|
||||
# 发布并启动新主账 8180(仅 E:\wwwroot\inquiry-new);禁止动现网 8080 / C:\yutongda
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$Root = 'E:\wwwroot\inquiry-new'
|
||||
$Jar = Join-Path $Root 'jeecg-system-start-3.5.3.jar'
|
||||
$LogDir = Join-Path $Root 'logs'
|
||||
$IncomingJar = 'C:\Users\ytd_extdev_0903\incoming\jeecg-system-start-3.5.3.jar'
|
||||
New-Item -ItemType Directory -Force -Path $Root, $LogDir | Out-Null
|
||||
# Start ledger 8180 with config overlay; never touch prod 8080 / C:\yutongda
|
||||
$ErrorActionPreference = "Stop"
|
||||
$Root = "E:\wwwroot\inquiry-new"
|
||||
$Jar = Join-Path $Root "jeecg-system-start-3.5.3.jar"
|
||||
$LogDir = Join-Path $Root "logs"
|
||||
$CfgDir = Join-Path $Root "config"
|
||||
$IncomingJar = "C:\Users\ytd_extdev_0903\incoming\jeecg-system-start-3.5.3.jar"
|
||||
$IncomingCfg = "C:\Users\ytd_extdev_0903\incoming\ledger-config.zip"
|
||||
New-Item -ItemType Directory -Force -Path $Root, $LogDir, $CfgDir | Out-Null
|
||||
|
||||
if (Test-Path $IncomingJar) {
|
||||
Write-Output "=== replace jar from incoming ==="
|
||||
Copy-Item $IncomingJar $Jar -Force
|
||||
if (Test-Path $IncomingJar) { Copy-Item $IncomingJar $Jar -Force }
|
||||
if (-not (Test-Path $Jar)) { throw "jar missing" }
|
||||
if (Test-Path $IncomingCfg) {
|
||||
Expand-Archive -Path $IncomingCfg -DestinationPath $CfgDir -Force
|
||||
}
|
||||
if (-not (Test-Path (Join-Path $CfgDir "application-inquiry.yml"))) {
|
||||
@"
|
||||
cas:
|
||||
prefixUrl: http://127.0.0.1/cas-disabled
|
||||
justauth:
|
||||
enabled: true
|
||||
"@ | Set-Content (Join-Path $CfgDir "application-inquiry.yml") -Encoding UTF8
|
||||
}
|
||||
if (-not (Test-Path $Jar)) { throw "jar missing: $Jar" }
|
||||
$ji = Get-Item $Jar
|
||||
Write-Output "jar bytes=$($ji.Length) mtime=$($ji.LastWriteTime)"
|
||||
|
||||
# 加载 E:\wwwroot\.env
|
||||
Get-Content 'E:\wwwroot\.env' | ForEach-Object {
|
||||
Get-Content "E:\wwwroot\.env" | ForEach-Object {
|
||||
$line = $_.Trim()
|
||||
if (-not $line -or $line.StartsWith('#')) { return }
|
||||
$i = $line.IndexOf('=')
|
||||
if (-not $line -or $line.StartsWith("#")) { return }
|
||||
$i = $line.IndexOf("=")
|
||||
if ($i -lt 1) { return }
|
||||
$k = $line.Substring(0, $i).Trim()
|
||||
$v = $line.Substring($i + 1).Trim()
|
||||
if ($v.StartsWith('"') -and $v.EndsWith('"')) { $v = $v.Substring(1, $v.Length - 2) }
|
||||
[Environment]::SetEnvironmentVariable($k, $v, 'Process')
|
||||
Set-Item -Path "Env:$k" -Value $v
|
||||
$v = $line.Substring($i + 1).Trim().Trim('"')
|
||||
Set-Item -Path ("Env:" + $k) -Value $v
|
||||
}
|
||||
|
||||
if (-not $env:YTD_REDIS_PASSWORD -and $env:REDIS_URL) {
|
||||
if ($env:REDIS_URL -match 'redis://:([^@]+)@') {
|
||||
$env:YTD_REDIS_PASSWORD = $Matches[1]
|
||||
} elseif ($env:REDIS_URL -match 'redis://[^:]+:([^@]+)@') {
|
||||
$env:YTD_REDIS_PASSWORD = $Matches[1]
|
||||
}
|
||||
if ($env:REDIS_URL -match "redis://:([^@]+)@") { $env:YTD_REDIS_PASSWORD = $Matches[1] }
|
||||
elseif ($env:REDIS_URL -match "redis://[^:]+:([^@]+)@") { $env:YTD_REDIS_PASSWORD = $Matches[1] }
|
||||
}
|
||||
if (-not $env:YTD_REDIS_HOST) { $env:YTD_REDIS_HOST = '127.0.0.1' }
|
||||
$env:YTD_REDIS_HOST = '127.0.0.1'
|
||||
$env:LEDGER_PORT = '8180'
|
||||
if (-not $env:YTD_REDIS_HOST) { $env:YTD_REDIS_HOST = "10.206.0.14" }
|
||||
if (-not $env:YTD_REDIS_PORT) { $env:YTD_REDIS_PORT = "6379" }
|
||||
if (-not $env:YTD_REDIS_DB) { $env:YTD_REDIS_DB = "1" }
|
||||
$env:LEDGER_PORT = "8180"
|
||||
Write-Host ("MYSQL_DB=" + $env:MYSQL_DB + " MYSQL_HOST=" + $env:MYSQL_HOST + " REDIS_HOST=" + $env:YTD_REDIS_HOST + " REDIS_DB=" + $env:YTD_REDIS_DB)
|
||||
|
||||
Write-Host "MYSQL_DB=$env:MYSQL_DB MYSQL_HOST=$env:MYSQL_HOST LEDGER_PORT=$env:LEDGER_PORT"
|
||||
|
||||
# 只停 inquiry-new 的 8180,绝不碰 yutongda 8080
|
||||
Get-CimInstance Win32_Process -Filter "Name='java.exe'" | ForEach-Object {
|
||||
if ($_.CommandLine -and $_.CommandLine -like '*inquiry-new*jeecg-system-start*') {
|
||||
Write-Host "stop pid=$($_.ProcessId)"
|
||||
if ($_.CommandLine -and $_.CommandLine -like "*inquiry-new*jeecg-system-start*") {
|
||||
Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
Get-NetTCPConnection -LocalPort 8180 -ErrorAction SilentlyContinue |
|
||||
Select-Object -ExpandProperty OwningProcess -Unique |
|
||||
ForEach-Object {
|
||||
$p = Get-CimInstance Win32_Process -Filter "ProcessId=$_"
|
||||
if ($p -and $p.CommandLine -like '*inquiry-new*') {
|
||||
Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
Start-Sleep -Seconds 2
|
||||
|
||||
$Java = 'C:\yutongda\tools\jdk8\bin\java.exe'
|
||||
if (-not (Test-Path $Java)) { throw "java missing $Java" }
|
||||
$Out = Join-Path $LogDir 'stdout.log'
|
||||
$Err = Join-Path $LogDir 'stderr.log'
|
||||
$Java = "C:\yutongda\tools\jdk8\bin\java.exe"
|
||||
$Out = Join-Path $LogDir "stdout.log"
|
||||
$Err = Join-Path $LogDir "stderr.log"
|
||||
# truncate logs
|
||||
Set-Content $Out -Value "" -Encoding UTF8
|
||||
Set-Content $Err -Value "" -Encoding UTF8
|
||||
$arg = @(
|
||||
'-jar', $Jar,
|
||||
'--spring.profiles.active=inquiry',
|
||||
"--server.port=$env:LEDGER_PORT"
|
||||
"-jar", $Jar,
|
||||
"--spring.profiles.active=inquiry",
|
||||
"--server.port=8180",
|
||||
"--spring.config.additional-location=optional:file:./config/",
|
||||
"--cas.prefixUrl=http://127.0.0.1/cas-disabled"
|
||||
)
|
||||
Write-Host "starting $Java $($arg -join ' ')"
|
||||
Write-Host ("starting java jar inquiry profile redis=" + $env:YTD_REDIS_HOST + ":" + $env:YTD_REDIS_PORT + "/" + $env:YTD_REDIS_DB)
|
||||
$p = Start-Process -FilePath $Java -ArgumentList $arg -WorkingDirectory $Root -RedirectStandardOutput $Out -RedirectStandardError $Err -PassThru -WindowStyle Hidden
|
||||
Write-Host "started pid=$($p.Id)"
|
||||
Write-Host ("started pid=" + $p.Id)
|
||||
|
||||
# 等启动(最长约 90s)
|
||||
$ok = $false
|
||||
for ($i = 1; $i -le 18; $i++) {
|
||||
for ($i = 1; $i -le 24; $i++) {
|
||||
Start-Sleep -Seconds 5
|
||||
try {
|
||||
$r = Invoke-WebRequest -Uri 'http://127.0.0.1:8180/jeecgboot/' -UseBasicParsing -TimeoutSec 5
|
||||
Write-Host "health try=$i status=$($r.StatusCode)"
|
||||
$r = Invoke-WebRequest -Uri "http://127.0.0.1:8180/jeecgboot/" -UseBasicParsing -TimeoutSec 5
|
||||
Write-Host ("health try=" + $i + " status=" + $r.StatusCode)
|
||||
$ok = $true
|
||||
break
|
||||
} catch {
|
||||
Write-Host "health try=$i pending"
|
||||
Write-Host ("health try=" + $i + " pending")
|
||||
}
|
||||
}
|
||||
if (-not $ok) {
|
||||
Write-Host '--- stderr tail ---'
|
||||
if (Test-Path $Err) { Get-Content $Err -Tail 50 }
|
||||
throw 'ledger 8180 health failed'
|
||||
if (Test-Path $Err) { Get-Content $Err -Tail 60 }
|
||||
throw "ledger 8180 health failed"
|
||||
}
|
||||
|
||||
# 确认现网 8080 仍在
|
||||
$prod = Get-NetTCPConnection -LocalPort 8080 -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1
|
||||
if (-not $prod) { throw 'CRITICAL: prod 8080 down after start' }
|
||||
Write-Output 'LEDGER_8180_OK'
|
||||
Write-Output "PROD_8080_OK pid=$($prod.OwningProcess)"
|
||||
if (-not $prod) { throw "CRITICAL: prod 8080 down" }
|
||||
Write-Output "LEDGER_8180_OK"
|
||||
Write-Output ("PROD_8080_OK pid=" + $prod.OwningProcess)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
$ErrorActionPreference = 'Continue'
|
||||
Copy-Item 'E:\wwwroot\.env' 'E:\wwwroot\agent\current\.env' -Force -ErrorAction SilentlyContinue
|
||||
Get-ChildItem 'E:\wwwroot\agent\releases' -ErrorAction SilentlyContinue | Where-Object { $_.PSIsContainer } | ForEach-Object {
|
||||
$p1 = Join-Path $_.FullName 'agent\.env'
|
||||
$p2 = Join-Path $_.FullName '.env'
|
||||
if (Test-Path (Split-Path $p1)) { Copy-Item 'E:\wwwroot\.env' $p1 -Force -ErrorAction SilentlyContinue }
|
||||
Copy-Item 'E:\wwwroot\.env' $p2 -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
Write-Output 'SYNC_OK'
|
||||
@@ -0,0 +1,16 @@
|
||||
# 只读:公网后台到底是哪套静态
|
||||
$ErrorActionPreference = 'Continue'
|
||||
Write-Output '=== admin current ==='
|
||||
cmd /c 'dir E:\wwwroot\admin\current'
|
||||
if (Test-Path 'E:\wwwroot\ops\active-release.json') {
|
||||
Get-Content 'E:\wwwroot\ops\active-release.json' -Raw
|
||||
}
|
||||
Write-Output '=== index title sniff ==='
|
||||
$idx = 'E:\wwwroot\admin\current\index.html'
|
||||
if (Test-Path $idx) {
|
||||
Select-String -Path $idx -Pattern 'title|询价|jeecg|vite' | Select-Object -First 8 | ForEach-Object { $_.Line.Trim() }
|
||||
}
|
||||
Write-Output '=== nginx jeecgboot / root ==='
|
||||
Select-String -Path 'C:\nginx-1.18.0\myconf\ai.conf' -Pattern 'root |jeecgboot|proxy_pass|8180|8080' |
|
||||
ForEach-Object { $_.Line.Trim() }
|
||||
Write-Output 'ADMIN_WHY_DONE'
|
||||
@@ -0,0 +1,108 @@
|
||||
# 持久拉起主账:由 WMI 启动 cmd 循环,SSH 断开后仍存活。禁止动现网 8080。
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$Root = 'E:\wwwroot\inquiry-new'
|
||||
$Www = 'E:\wwwroot'
|
||||
$Jar = Join-Path $Root 'jeecg-system-start-3.5.3.jar'
|
||||
$LogDir = Join-Path $Root 'logs'
|
||||
$CfgDir = Join-Path $Root 'config'
|
||||
$IncomingJar = 'C:\Users\ytd_extdev_0903\incoming\jeecg-system-start-3.5.3.jar'
|
||||
$IncomingCfg = 'C:\Users\ytd_extdev_0903\incoming\ledger-config.zip'
|
||||
$Java = 'C:\yutongda\tools\jdk8\bin\java.exe'
|
||||
New-Item -ItemType Directory -Force -Path $Root, $LogDir, $CfgDir, (Join-Path $Www 'ops') | Out-Null
|
||||
|
||||
if (Test-Path $IncomingJar) { Copy-Item $IncomingJar $Jar -Force }
|
||||
if (-not (Test-Path $Jar)) { throw 'jar missing' }
|
||||
if (-not (Test-Path $Java)) { throw 'java missing' }
|
||||
if (Test-Path $IncomingCfg) {
|
||||
Expand-Archive -Path $IncomingCfg -DestinationPath $CfgDir -Force
|
||||
}
|
||||
|
||||
$inner = @'
|
||||
$ErrorActionPreference = "Stop"
|
||||
Get-Content "E:\wwwroot\.env" | ForEach-Object {
|
||||
$line = $_.Trim()
|
||||
if (-not $line -or $line.StartsWith("#")) { return }
|
||||
$i = $line.IndexOf("=")
|
||||
if ($i -lt 1) { return }
|
||||
Set-Item -Path ("Env:" + $line.Substring(0, $i).Trim()) -Value $line.Substring($i + 1).Trim().Trim('"')
|
||||
}
|
||||
if (-not $env:YTD_REDIS_PASSWORD -and $env:REDIS_URL) {
|
||||
if ($env:REDIS_URL -match "redis://:([^@]+)@") { $env:YTD_REDIS_PASSWORD = $Matches[1] }
|
||||
elseif ($env:REDIS_URL -match "redis://[^:]+:([^@]+)@") { $env:YTD_REDIS_PASSWORD = $Matches[1] }
|
||||
}
|
||||
if (-not $env:YTD_REDIS_HOST) { $env:YTD_REDIS_HOST = "10.206.0.14" }
|
||||
if (-not $env:YTD_REDIS_PORT) { $env:YTD_REDIS_PORT = "6379" }
|
||||
if (-not $env:YTD_REDIS_DB) { $env:YTD_REDIS_DB = "1" }
|
||||
$env:LEDGER_PORT = "8180"
|
||||
$Java = "C:\yutongda\tools\jdk8\bin\java.exe"
|
||||
$Jar = "E:\wwwroot\inquiry-new\jeecg-system-start-3.5.3.jar"
|
||||
Set-Location "E:\wwwroot\inquiry-new"
|
||||
$arg = @(
|
||||
"-jar", $Jar,
|
||||
"--spring.profiles.active=inquiry",
|
||||
"--server.port=8180",
|
||||
"--spring.config.additional-location=optional:file:./config/",
|
||||
"--cas.prefixUrl=http://127.0.0.1/cas-disabled",
|
||||
"--jeecg.loginCaptchaEnabled=false"
|
||||
)
|
||||
if ($env:YTD_REDIS_USERNAME) { $arg += ("--spring.redis.username=" + $env:YTD_REDIS_USERNAME) }
|
||||
& $Java @arg
|
||||
'@
|
||||
$innerPath = Join-Path $Www 'ops\run-ledger-inner.ps1'
|
||||
Set-Content -Path $innerPath -Value $inner -Encoding UTF8
|
||||
|
||||
$cmd = @"
|
||||
@echo off
|
||||
cd /d E:\wwwroot\inquiry-new
|
||||
:loop
|
||||
powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:\wwwroot\ops\run-ledger-inner.ps1 >> E:\wwwroot\inquiry-new\logs\stdout.log 2>> E:\wwwroot\inquiry-new\logs\stderr.log
|
||||
echo ledger exited, restart in 5s >> E:\wwwroot\inquiry-new\logs\stderr.log
|
||||
timeout /t 5 /nobreak >nul
|
||||
goto loop
|
||||
"@
|
||||
$cmdPath = Join-Path $Www 'ops\run-ledger.cmd'
|
||||
Set-Content -Path $cmdPath -Value $cmd -Encoding ASCII
|
||||
|
||||
# 只停 inquiry-new 的 java
|
||||
Get-CimInstance Win32_Process -Filter "Name='java.exe'" | ForEach-Object {
|
||||
if ($_.CommandLine -and $_.CommandLine -like '*inquiry-new*jeecg-system-start*') {
|
||||
Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
Get-CimInstance Win32_Process | ForEach-Object {
|
||||
if ($_.CommandLine -and $_.CommandLine -like '*run-ledger.cmd*') {
|
||||
Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
Start-Sleep -Seconds 2
|
||||
|
||||
$w = Invoke-CimMethod -ClassName Win32_Process -MethodName Create -Arguments @{
|
||||
CommandLine = ('cmd.exe /c "' + $cmdPath + '"')
|
||||
}
|
||||
Write-Output ("LEDGER_WMI=" + $w.ReturnValue + " pid=" + $w.ProcessId)
|
||||
|
||||
$ok = $false
|
||||
for ($i = 1; $i -le 30; $i++) {
|
||||
Start-Sleep -Seconds 5
|
||||
$listen = Get-NetTCPConnection -LocalPort 8180 -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1
|
||||
if (-not $listen) { Write-Output ("try=" + $i + " not listen"); continue }
|
||||
try {
|
||||
$r = Invoke-WebRequest -Uri 'http://127.0.0.1:8180/jeecgboot/sys/randomImage/wmi' -UseBasicParsing -TimeoutSec 5
|
||||
Write-Output ("try=" + $i + " listen pid=" + $listen.OwningProcess + " http=" + $r.StatusCode)
|
||||
$ok = $true
|
||||
break
|
||||
} catch {
|
||||
$code = $null
|
||||
try { $code = $_.Exception.Response.StatusCode.value__ } catch {}
|
||||
Write-Output ("try=" + $i + " listen pid=" + $listen.OwningProcess + " http_code=" + $code)
|
||||
if ($code) { $ok = $true; break }
|
||||
}
|
||||
}
|
||||
if (-not $ok) {
|
||||
Get-Content (Join-Path $LogDir 'stdout.log') -Tail 40 -ErrorAction SilentlyContinue
|
||||
throw 'ledger 8180 failed to stay up'
|
||||
}
|
||||
$prod = Get-NetTCPConnection -LocalPort 8080 -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1
|
||||
if (-not $prod) { throw 'CRITICAL: prod 8080 down' }
|
||||
Write-Output 'LEDGER_WMI_OK'
|
||||
Write-Output ("PROD_8080_OK pid=" + $prod.OwningProcess)
|
||||
@@ -0,0 +1,74 @@
|
||||
# ai.ytd-scm.com cutover: Jeecg admin static + ledger 8180 + agent 8910
|
||||
# /jeecgboot -> 新主账 8180(context-path /jeecgboot)
|
||||
# /jeecg-boot -> 仍指现网 8080(旧路径兼容,正式前端不用)
|
||||
# wecom / inquiry-form -> 8910
|
||||
server {
|
||||
listen 80;
|
||||
server_name ai.ytd-scm.com;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name ai.ytd-scm.com;
|
||||
ssl_certificate C:/nginx-1.18.0/cert/ai.ytd-scm.com.crt;
|
||||
ssl_certificate_key C:/nginx-1.18.0/cert/ai.ytd-scm.com.key;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
root E:/wwwroot/admin/current;
|
||||
index index.html;
|
||||
location = / { add_header Cache-Control "no-store" always; try_files /index.html =404; }
|
||||
location = /index.html { add_header Cache-Control "no-store" always; }
|
||||
location / { try_files $uri $uri/ /index.html; }
|
||||
location /jeecg-boot/ {
|
||||
proxy_pass http://127.0.0.1:8080/jeecg-boot/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_read_timeout 120s;
|
||||
}
|
||||
location /jeecgboot/ {
|
||||
proxy_pass http://127.0.0.1:8180/jeecgboot/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_read_timeout 120s;
|
||||
}
|
||||
location = /wecom/callback {
|
||||
proxy_pass http://127.0.0.1:8910/wecom/callback;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
client_max_body_size 20m;
|
||||
}
|
||||
location = /wecom/robot/callback {
|
||||
proxy_pass http://127.0.0.1:8812/wecom/robot/callback;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
client_max_body_size 100m;
|
||||
}
|
||||
location ^~ /inquiry-form/upload/ {
|
||||
proxy_pass http://127.0.0.1:8910/inquiry-form/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
add_header Cache-Control "no-store" always;
|
||||
client_max_body_size 21m;
|
||||
}
|
||||
location ^~ /inquiry-form/ {
|
||||
proxy_pass http://127.0.0.1:8910/inquiry-form/;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
add_header Cache-Control "no-store" always;
|
||||
client_max_body_size 256k;
|
||||
}
|
||||
location = /wecom/callback/health { proxy_pass http://127.0.0.1:8910/health; }
|
||||
location = /agent/health { proxy_pass http://127.0.0.1:8910/health; }
|
||||
location = /ledger/health { proxy_pass http://127.0.0.1:8180/jeecgboot/; }
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
# 覆盖配置:明确关闭登录图形验证码(与无验证码登录页对齐)
|
||||
cas:
|
||||
prefixUrl: http://127.0.0.1/cas-disabled
|
||||
|
||||
spring:
|
||||
redis:
|
||||
host: ${YTD_REDIS_HOST:10.206.0.14}
|
||||
port: ${YTD_REDIS_PORT:6379}
|
||||
database: ${YTD_REDIS_DB:1}
|
||||
username: ${YTD_REDIS_USERNAME:}
|
||||
password: ${YTD_REDIS_PASSWORD:}
|
||||
|
||||
jeecg:
|
||||
loginCaptchaEnabled: false
|
||||
swagger:
|
||||
title: 友通达询价系统 API
|
||||
description: 询价主账与后台关联接口
|
||||
base-packages: org.jeecg.modules.inquiry
|
||||
extra-controller-names: LoginController,SysUserController,SysRoleController,SysPermissionController,SysDictController,SysDictItemController,CommonController
|
||||
file-view-domain: http://127.0.0.1
|
||||
elasticsearch:
|
||||
cluster-name: jeecg-ES
|
||||
cluster-nodes: 127.0.0.1:9200
|
||||
check-enabled: false
|
||||
redisson:
|
||||
enabled: false
|
||||
xxljob:
|
||||
enabled: false
|
||||
|
||||
knife4j:
|
||||
enable: true
|
||||
production: false
|
||||
|
||||
justauth:
|
||||
enabled: true
|
||||
type:
|
||||
GITHUB:
|
||||
client-id: local
|
||||
client-secret: local
|
||||
redirect-uri: http://127.0.0.1:8180/jeecgboot/sys/thirdLogin/github/callback
|
||||
WECHAT_ENTERPRISE:
|
||||
client-id: local
|
||||
client-secret: local
|
||||
redirect-uri: http://127.0.0.1:8180/jeecgboot/sys/thirdLogin/wechat_enterprise/callback
|
||||
agent-id: "0"
|
||||
DINGTALK:
|
||||
client-id: local
|
||||
client-secret: local
|
||||
redirect-uri: http://127.0.0.1:8180/jeecgboot/sys/thirdLogin/dingtalk/callback
|
||||
WECHAT_OPEN:
|
||||
client-id: local
|
||||
client-secret: local
|
||||
redirect-uri: http://127.0.0.1:8180/jeecgboot/sys/thirdLogin/wechat_open/callback
|
||||
cache:
|
||||
type: default
|
||||
prefix: 'demo::'
|
||||
timeout: 1h
|
||||
|
||||
third-app:
|
||||
enabled: false
|
||||
@@ -0,0 +1,24 @@
|
||||
# NSSM / Windows 服务单元清单(框架壳)
|
||||
|
||||
新系统只注册下列自研服务(另加 Nginx/LibreOffice/库,不计入本表)。
|
||||
**禁止**五个 Worker、四个 uvicorn、Redis `wecom:worker:singleton`。
|
||||
|
||||
并存期端口:主账 8180、智能体 HTTP 8910、AIBOT 8913;勿占现网 8080/8810/8813。
|
||||
|
||||
| 服务名(建议) | 进程 | 工作目录(示例) | 启动命令(示例) | 备注 |
|
||||
|---|---|---|---|---|
|
||||
| `YtdInquiryLedger` | 主账 Jeecg | `E:\wwwroot\inquiry-new` | `java -jar …`(以发布脚本为准) | 端口 8180;库 `inquiry_robot` |
|
||||
| `YtdInquiryAgentHttp` | 智能体 HTTP | `E:\wwwroot\agent\current` | `python -m agent.http_app` | 端口 8910;只验签入队 |
|
||||
| `YtdInquiryAgentWorker` | 智能体 Worker | 同上 | `python -m agent.worker_app` | 无对外端口;LibreOffice 1 槽 |
|
||||
| `YtdInquiryAibotBridge` | AIBOT 桥 | `E:\wwwroot\aibot-bridge` | `node server.cjs` | 绑定 127.0.0.1:8913;默认不连 Bot |
|
||||
| `YtdInquiryAdmin` | 可选静态托管 | `E:\wwwroot\admin\current` | 通常由 Nginx 托管,可不注册 NSSM | 经 `/jeecgboot` 打 8180 |
|
||||
|
||||
## 环境
|
||||
|
||||
- 活动配置真相:`E:\wwwroot\.env`(勿改 `C:\yutongda` 活动 `.env`)
|
||||
- `YTD_ENV=test|prod`;测试告警正文加 `[test]`
|
||||
- AIBOT:`WECOM_AIBOT_ENABLED=false` 直至切流
|
||||
|
||||
## 本文件范围
|
||||
|
||||
只列服务名与进程边界;不含切流 Nginx、不含业务开关。具体安装命令见 `deploy/` 下远程脚本。
|
||||
Reference in New Issue
Block a user