diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 538b994..3c33b90 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -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: diff --git a/docker-compose.yml b/docker-compose.yml index 4e0c664..a102bc7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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` diff --git a/docker/terminal/server.js b/docker/terminal/server.js index fcb30b8..42fd62b 100644 --- a/docker/terminal/server.js +++ b/docker/terminal/server.js @@ -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.' });