fix: mount PVC at /config to persist Chrome and app state across restarts

The jlesage/baseimage-gui sets XDG_CONFIG_HOME=/config/xdg/config at
runtime, so Chrome was writing its profile to /config/xdg/config/google-chrome
which lived on ephemeral storage. This caused Chrome to open as a fresh
install on every pod restart.

Changes:
- Mount the PVC at /config instead of /home (aligns with baseimage-gui convention)
- Move user home directory to /config/userdata (on the PVC)
- Add explicit --user-data-dir for Chrome pointing to PVC path
- Clean up Chrome crash lock files and patch Preferences on startup
  to prevent session/cookie loss after unclean pod shutdown
- Update all scripts (sshd, init-repo, cont-init) to use new paths
- Remove unnecessary cont-init-home.sh

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
Antigravity Developer
2026-02-20 22:21:36 +00:00
parent c42b47bb56
commit b6bf4b6640
7 changed files with 22 additions and 41 deletions
-26
View File
@@ -1,26 +0,0 @@
#!/bin/sh
# Initialize persistent home directory structure for the app user
# This ensures Chrome settings and SSH keys persist across pod restarts
echo "=== Initializing persistent home directory ==="
# Ensure the user home directory exists with proper ownership
if [ ! -d "/home/user" ]; then
echo "Creating /home/user directory..."
mkdir -p /home/user
chown app:app /home/user
fi
# Ensure critical directories exist for persistent data
echo "Ensuring persistent directories exist..."
mkdir -p /home/user/.config
mkdir -p /home/user/.ssh
mkdir -p /home/user/.cache
# Set proper ownership for all directories
chown -R app:app /home/user
# Ensure SSH directory has proper permissions
chmod 700 /home/user/.ssh
echo "Home directory initialization complete"
+1 -1
View File
@@ -5,7 +5,7 @@
echo "=== SSH enabled: starting sshd ==="
HOME_DIR="/home/user"
HOME_DIR="/config/userdata"
HOST_KEY_STORE="$HOME_DIR/.ssh/host_keys"
# Persist host keys on the home PVC so clients don't see a "host key
+1 -1
View File
@@ -3,4 +3,4 @@
# baseimage-gui sets shell=/sbin/nologin and home=/dev/null, which
# prevents VSCode from opening terminals.
usermod -s /bin/bash app
usermod -d /home/user app
usermod -d /config/userdata app
+4 -4
View File
@@ -25,8 +25,8 @@ else
# Configure git to use token if provided
if [ -n "$GITHUB_TOKEN" ]; then
git config credential.helper store
echo "https://oauth2:${GITHUB_TOKEN}@github.com" > /home/.git-credentials
chmod 600 /home/.git-credentials
echo "https://oauth2:${GITHUB_TOKEN}@github.com" > /config/userdata/.git-credentials
chmod 600 /config/userdata/.git-credentials
fi
git pull || echo "Pull failed, continuing anyway..."
@@ -42,8 +42,8 @@ else
# Configure credentials for future use
git config --global credential.helper store
echo "https://oauth2:${GITHUB_TOKEN}@github.com" > /home/.git-credentials
chmod 600 /home/.git-credentials
echo "https://oauth2:${GITHUB_TOKEN}@github.com" > /config/userdata/.git-credentials
chmod 600 /config/userdata/.git-credentials
else
git clone "$GITHUB_REPO" "$WORKSPACE_DIR"
fi