fix(terminal): clean Clusev-host shell prompt — node@clusev:~ not node@<hash>:/workspace
The host terminal is a shell in the sidecar container; it opened in the read-only repo mount (/workspace) with the prompt showing the random container id, so it read like a stray container rather than "the Clusev host". - give the sidecar a stable `hostname: clusev` (dev + prod) → prompt host is `clusev` - land the host PTY in /home/node (a real, writable home) and set HOME to it, so the shell opens at ~ like a normal terminal instead of /workspace Server (SSH) terminals are unchanged. Verified in-browser: prompt reads node@clusev, pwd is /home/node, HOME=/home/node, no container hash / no /workspace; server terminal still connects and runs; zero console errors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>feat/v1-foundation
parent
07fe404ce9
commit
05042c3582
|
|
@ -88,10 +88,13 @@ services:
|
|||
context: ./docker/terminal
|
||||
image: "${CLUSEV_TERMINAL_IMAGE:-clusev-terminal:prod}"
|
||||
restart: unless-stopped
|
||||
# Clean hostname so the "Clusev host" terminal prompt reads node@clusev, not the container hash.
|
||||
hostname: clusev
|
||||
environment:
|
||||
TERMINAL_SIDECAR_SECRET: "${TERMINAL_SIDECAR_SECRET:-}"
|
||||
APP_INTERNAL_URL: "http://app:80"
|
||||
TERMINAL_HOST_CWD: "/workspace"
|
||||
# Land the host shell in a real, writable home (~) — not the read-only repo mount.
|
||||
TERMINAL_HOST_CWD: "/home/node"
|
||||
volumes:
|
||||
- .:/workspace:ro
|
||||
expose:
|
||||
|
|
|
|||
|
|
@ -103,10 +103,13 @@ services:
|
|||
context: ./docker/terminal
|
||||
image: clusev-terminal:dev
|
||||
restart: unless-stopped
|
||||
# Clean hostname so the "Clusev host" terminal prompt reads node@clusev, not the container hash.
|
||||
hostname: clusev
|
||||
environment:
|
||||
TERMINAL_SIDECAR_SECRET: "${TERMINAL_SIDECAR_SECRET:-}"
|
||||
APP_INTERNAL_URL: "http://app:80"
|
||||
TERMINAL_HOST_CWD: "/workspace"
|
||||
# Land the host shell in a real, writable home (~) — not the read-only repo mount.
|
||||
TERMINAL_HOST_CWD: "/home/node"
|
||||
volumes:
|
||||
- .:/workspace:ro
|
||||
# Dev: bind the sidecar source over the baked copy so edits need only `restart terminal`
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ const PORT = parseInt(process.env.TERMINAL_PORT || '3000', 10);
|
|||
const APP_URL = (process.env.APP_INTERNAL_URL || 'http://app:80').replace(/\/$/, '');
|
||||
const SECRET = process.env.TERMINAL_SIDECAR_SECRET || '';
|
||||
const HOST_SHELL = process.env.TERMINAL_HOST_SHELL || 'bash';
|
||||
const HOST_CWD = process.env.TERMINAL_HOST_CWD || '/workspace';
|
||||
const HOST_CWD = process.env.TERMINAL_HOST_CWD || '/home/node';
|
||||
|
||||
const server = http.createServer((req, res) => {
|
||||
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
||||
|
|
@ -71,7 +71,9 @@ function startHost(ws) {
|
|||
try {
|
||||
p = pty.spawn(HOST_SHELL, ['-l'], {
|
||||
name: 'xterm-256color', cwd: HOST_CWD, cols: 80, rows: 24,
|
||||
env: { ...process.env, TERM: 'xterm-256color' },
|
||||
// HOME = the landing dir so the shell opens at ~ (not a bare absolute path) and the prompt
|
||||
// reads cleanly; the container's `hostname: clusev` makes \h show "clusev", not the hash.
|
||||
env: { ...process.env, TERM: 'xterm-256color', HOME: HOST_CWD },
|
||||
});
|
||||
} catch (e) {
|
||||
send(ws, { type: 'error', data: 'Shell konnte nicht gestartet werden.' });
|
||||
|
|
|
|||
Loading…
Reference in New Issue