feat: 将 7682 纳入 Webterm YAML 部署

This commit is contained in:
Codex
2026-07-11 06:57:30 +02:00
parent 444ddf13fd
commit 43993c8eb2
2 changed files with 84 additions and 7 deletions
+80
View File
@@ -33,6 +33,86 @@ defaults:
targetId: local-7683
targets:
- id: local-7682
enabled: true
runtime:
mode: host-docker
workDir: /root/webterm
composePath: /root/webterm/build/docker-compose.7682.yaml
composeProject: webterm-7682
serviceName: web-terminal
containerName: web-terminal-7682
image: webterm-web-terminal-7682:latest
envFile: /root/webterm/.env
hostPort: 7682
containerPort: 7681
privileged: true
pid: host
sourceMounts:
- source: /root/webterm/src
target: /app/src
readOnly: true
- source: /root/webterm/public
target: /app/public
readOnly: true
- source: /root/webterm/scripts/host-shell.sh
target: /usr/local/bin/host-shell
readOnly: true
- source: /root/user_uploads
target: /root/user_uploads
readOnly: false
autoStartSessions:
- title: TERM
cwd: /root/unidesk
command: mycx resume 019f4eeb-bbb3-7e32-bb98-d10753561516
cols: 100
rows: 30
resumePrompt: true
environment:
HOST: 0.0.0.0
PORT: "7681"
SESSION_COOKIE_NAME: webterm_session_7682
SESSION_MAX_AGE_SECONDS: "604800"
SERVER_PROVIDER_ID: remote-server
SERVER_PROVIDER_NAME: Remote Server 7682
TERMINAL_SHELL: /usr/local/bin/host-shell
TERMINAL_CWD: /root
TERMINAL_REMOTE_CWD: /root/unidesk
TERMINAL_START_COMMAND: ""
TERMINAL_HISTORY_BYTES: "2097152"
TERMINAL_SNAPSHOT_BYTES: "131072"
TERMINAL_SNAPSHOT_POLICY: tail
BROWSER_SNAPSHOT_WRITE_CHUNK_BYTES: "8192"
BROWSER_MANUAL_REDRAW_MODE: double
BROWSER_MANUAL_REDRAW_DELAY_MS: "60"
OUTPUT_BATCH_MS: "8"
OUTPUT_BATCH_BYTES: "32768"
BROWSER_KEEPALIVE_ENABLED: "true"
BROWSER_RESUME_PROBE_ENABLED: "false"
BROWSER_KEEPALIVE_INTERVAL_MS: "15000"
BROWSER_STALE_TIMEOUT_MS: "180000"
BROWSER_SESSION_OUTPUT_IDLE_MS: "3000"
BROWSER_OUTPUT_PULSE_MIN_INTERVAL_MS: "250"
PROTOCOL_METRICS_ENABLED: "true"
PROTOCOL_METRICS_WINDOW: "400"
FILE_UPLOAD_DIR: /root/user_uploads
FILE_UPLOAD_MAX_BYTES: "104857600"
publicExposure:
enabled: false
publicBaseUrl: https://term.pikapython.com
dns:
hostname: term.pikapython.com
expectedA: 82.156.23.220
resolvers: [1.1.1.1, 8.8.8.8, 223.5.5.5, 114.114.114.114]
upstream:
host: 152.53.229.148
port: 7682
pk01:
route: PK01
caddyConfigPath: /etc/caddy/Caddyfile
caddyServiceName: caddy
responseHeaderTimeoutSeconds: 600
- id: local-7683
enabled: true
runtime:
+4 -7
View File
@@ -115,7 +115,7 @@ export function webtermHelp(): Record<string, unknown> {
"bun scripts/cli.ts platform-infra webterm validate",
],
configPath,
description: "Deploy the host-Docker Web Terminal from YAML and expose it through PK01 Caddy HTTPS without touching the existing 7682 service.",
description: "Deploy target-scoped host-Docker Web Terminal instances from YAML and optionally expose them through PK01 Caddy HTTPS.",
};
}
@@ -317,8 +317,6 @@ function parseTarget(record: Record<string, unknown>, path: string, sessionStart
},
},
};
if (target.runtime.hostPort === 7682) throw new Error(`${path}.runtime.hostPort must not reuse existing 7682`);
if (target.runtime.containerName === "web-terminal-7682") throw new Error(`${path}.runtime.containerName must not reuse web-terminal-7682`);
if (!target.publicExposure.publicBaseUrl.startsWith("https://")) throw new Error(`${path}.publicExposure.publicBaseUrl must be https`);
return target;
}
@@ -386,11 +384,10 @@ function quoteShellArg(value: string): string {
function policyChecks(target: WebtermTarget, compose: string): Array<Record<string, unknown> & { ok: boolean }> {
return [
{ name: "enabled", ok: target.enabled, detail: "target must be enabled" },
{ name: "no-7682-host-port", ok: target.runtime.hostPort !== 7682, detail: "existing 7682 service must not be reused" },
{ name: "no-7682-container", ok: target.runtime.containerName !== "web-terminal-7682", detail: "existing 7682 container must not be reused" },
{ name: "compose-path-7683", ok: target.runtime.composePath.includes("7683"), detail: target.runtime.composePath },
{ name: "compose-path", ok: target.runtime.composePath.endsWith(".yaml"), detail: target.runtime.composePath },
{ name: "container-name", ok: compose.includes(`container_name: ${target.runtime.containerName}`), detail: target.runtime.containerName },
{ name: "public-https", ok: target.publicExposure.publicBaseUrl.startsWith("https://"), detail: target.publicExposure.publicBaseUrl },
{ name: "compose-renders-7683", ok: compose.includes(`"${target.runtime.hostPort}:${target.runtime.containerPort}"`), detail: `${target.runtime.hostPort}:${target.runtime.containerPort}` },
{ name: "compose-port", ok: compose.includes(`"${target.runtime.hostPort}:${target.runtime.containerPort}"`), detail: `${target.runtime.hostPort}:${target.runtime.containerPort}` },
{ name: "source-mounts-present", ok: target.runtime.sourceMounts.length >= 3, detail: `mounts=${target.runtime.sourceMounts.length}` },
];
}