fix sidecar issue, node 22

This commit is contained in:
2026-02-25 04:50:16 +00:00
parent abefb26e5c
commit 084dd22d57
4 changed files with 30 additions and 2 deletions
+25
View File
@@ -31,5 +31,30 @@ if [ ! -d /home/$USERNAME/.config/nvim ]; then
chown -R "$USER_UID:$USER_GID" /home/$USERNAME/.config
fi
# Seed shell config files from templates if not present
if [ ! -f /home/$USERNAME/.zshrc ]; then
cp /opt/terminal-templates/.zshrc /home/$USERNAME/.zshrc
chown "$USER_UID:$USER_GID" /home/$USERNAME/.zshrc
fi
if [ ! -f /home/$USERNAME/.tmux.conf ]; then
cp /opt/terminal-templates/.tmux.conf /home/$USERNAME/.tmux.conf
chown "$USER_UID:$USER_GID" /home/$USERNAME/.tmux.conf
fi
if [ ! -f /home/$USERNAME/.config/starship-officer.toml ]; then
mkdir -p /home/$USERNAME/.config
cp /opt/terminal-templates/starship-officer.toml /home/$USERNAME/.config/starship-officer.toml
chown -R "$USER_UID:$USER_GID" /home/$USERNAME/.config
fi
if [ ! -d /home/$USERNAME/.oh-my-zsh ]; then
cp -r /opt/oh-my-zsh /home/$USERNAME/.oh-my-zsh
chown -R "$USER_UID:$USER_GID" /home/$USERNAME/.oh-my-zsh
fi
mkdir -p /home/$USERNAME/.local/bin
chown -R "$USER_UID:$USER_GID" /home/$USERNAME/.local
# Run sidecar as the user
exec gosu "$USER_UID:$USER_GID" node /app/pty-sidecar.mjs
+2 -2
View File
@@ -158,8 +158,8 @@ wss.on('connection', (ws) => {
try {
await ensureUserFiles(homeDir);
} catch {
// ignore
} catch (err) {
console.error('[sidecar] ensureUserFiles failed:', err);
}
ptyEnv = {
+2
View File
@@ -251,6 +251,7 @@ export const ensureDockerContainer = async (email: string, userId: number, homeD
console.log(`[terminal] recreating container for ${email} — resource mounts missing`);
stopDockerSidecar(existing.dockerId);
} else {
console.log(`[terminal] reusing running container ${existing.dockerId} for ${email} on port ${existing.port}`);
return existing;
}
}
@@ -411,6 +412,7 @@ export const terminalWebsocket = {
sidecar = await connectSidecar(info.port);
} catch (err) {
const message = err instanceof Error ? err.message : 'Failed to connect terminal sidecar';
console.error(`[terminal] sidecar connection failed for ${email}:`, message);
sendOutput(ws, `\r\n[Terminal error] ${message}\r\n`);
if (info) {
const logs = readDockerLogs(info.dockerId);