chore: add runtime observability ops

This commit is contained in:
John
2026-07-02 07:04:50 +08:00
parent 04e308e582
commit 4420cca340
11 changed files with 556 additions and 44 deletions
+20 -5
View File
@@ -267,6 +267,14 @@ async function writeMetadata() {
path.join(root, 'scripts', 'wechat-mp-menu.mjs'),
path.join(runtimeRoot, 'scripts', 'wechat-mp-menu.mjs'),
);
await fs.copyFile(
path.join(root, 'scripts', 'check-stream-runtime.mjs'),
path.join(runtimeRoot, 'scripts', 'check-stream-runtime.mjs'),
);
await fs.copyFile(
path.join(root, 'scripts', 'runtime-worker-drain.mjs'),
path.join(runtimeRoot, 'scripts', 'runtime-worker-drain.mjs'),
);
await writeFile(
path.join(runtimeRoot, 'RUNBOOK.txt'),
[
@@ -300,11 +308,16 @@ async function writeMetadata() {
' H5_USERS_ROOT / MINDSPACE_STORAGE_ROOT / MEMIND_SHARED_PUBLISH_ROOT',
'',
'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.',
' H5 public domain: mm.tkmind.cn',
' Current public path: mm.tkmind.cn -> local nginx -> Portal :8081',
' Legacy rollback-only path: m.tkmind.cn -> 105 nginx -> reverse SSH tunnel -> Portal :8081',
' Future H5 traffic must not depend on 105 forwarding unless explicitly rolling back.',
'',
'Streaming runtime operations:',
' node scripts/check-stream-runtime.mjs',
' node scripts/runtime-worker-drain.mjs status',
' node scripts/runtime-worker-drain.mjs drain goosed-3',
' node scripts/runtime-worker-drain.mjs undrain goosed-3',
'',
].join('\n'),
);
@@ -322,6 +335,8 @@ 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', 'check-stream-runtime.mjs'), 0o755);
await fs.chmod(path.join(runtimeRoot, 'scripts', 'runtime-worker-drain.mjs'), 0o755);
await fs.chmod(path.join(runtimeRoot, 'scripts', 'memind-portal-tunnel.sh'), 0o755);
console.log('');
console.log(`Portal runtime 已生成: ${runtimeRoot}`);