fix(release): restart m.tkmind.cn portal tunnel after Portal deploy

Bundle memind-portal-tunnel.sh into the runtime artifact and kickstart
cn.tkmind.memind-portal-tunnel on 103 after Portal health checks so 105
nginx can reach 127.0.0.1:19081 following runtime releases.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-06-29 10:22:19 +08:00
parent d7cbf3cc96
commit b7af5b00dc
2 changed files with 86 additions and 4 deletions
+14 -1
View File
@@ -201,8 +201,18 @@ async function writeMetadata() {
dependencies: runtimeDependencies,
};
await writeFile(path.join(runtimeRoot, 'package.json'), `${JSON.stringify(runtimePackageJson, null, 2)}\n`);
const tunnelScript = path.join(root, 'scripts', 'memind-portal-tunnel.sh');
const runtimeScriptsDir = path.join(runtimeRoot, 'scripts');
await fs.mkdir(runtimeScriptsDir, { recursive: true });
if (await exists(tunnelScript)) {
await fs.copyFile(tunnelScript, path.join(runtimeScriptsDir, 'memind-portal-tunnel.sh'));
await fs.chmod(path.join(runtimeScriptsDir, 'memind-portal-tunnel.sh'), 0o755);
} else {
throw new Error(`缺少隧道脚本: ${tunnelScript}`);
}
await writeFile(
path.join(runtimeRoot, 'scripts', 'run-memind-portal-prod.sh'),
path.join(runtimeScriptsDir, 'run-memind-portal-prod.sh'),
[
'#!/usr/bin/env bash',
'set -euo pipefail',
@@ -276,6 +286,8 @@ async function writeMetadata() {
'Deployment and operations transport:',
' 105 fixed IP: 120.26.184.105',
' 103 / Studio fixed IP: 58.38.22.103',
' m.tkmind.cn: 105 nginx -> 127.0.0.1:19081 -> reverse SSH tunnel -> Portal :8081',
' scripts/memind-portal-tunnel.sh must stay in runtime; release restarts cn.tkmind.memind-portal-tunnel',
' Do not switch back to 10.10.* LAN paths unless explicitly required.',
'',
].join('\n'),
@@ -293,6 +305,7 @@ async function main() {
await writeMetadata();
await fs.chmod(path.join(runtimeRoot, 'scripts', 'run-memind-portal-prod.sh'), 0o755);
await fs.chmod(path.join(runtimeRoot, 'scripts', 'wechat-mp-menu.mjs'), 0o755);
await fs.chmod(path.join(runtimeRoot, 'scripts', 'memind-portal-tunnel.sh'), 0o755);
console.log('');
console.log(`Portal runtime 已生成: ${runtimeRoot}`);
}