fix: remove sudo from happy daemon start — startapp.sh already runs as app user

sudo -u failed because the app user is not in sudoers. It was unnecessary
anyway: startapp.sh (and init-repo.sh) run as the app user (UID 1000) so
happy daemon start already executes as the correct user with the right HOME.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-20 10:05:41 -05:00
parent 8d7b39f1b5
commit e89c3040b7
+4 -5
View File
@@ -59,13 +59,12 @@ chown -R "$RUN_UID:$RUN_GID" "$WORKSPACE_DIR"
mkdir -p "$HOME" mkdir -p "$HOME"
chown "$RUN_UID:$RUN_GID" "$HOME" chown "$RUN_UID:$RUN_GID" "$HOME"
# Start Happy Coder daemon as the app user so it can access user credentials # Start Happy Coder daemon. startapp.sh already runs as the app user (UID 1000),
# (running as root means HOME=/root, Claude Code and Happy config would be missing) # so no sudo needed — Happy/Claude Code will find credentials in the correct home dir.
echo "Starting Happy Coder..." echo "Starting Happy Coder..."
RUN_USER=$(id -nu "$RUN_UID" 2>/dev/null || echo "user") cd "$WORKSPACE_DIR"
sudo -u "$RUN_USER" -E sh -c "cd '$WORKSPACE_DIR' && happy daemon start" \ happy daemon start || echo "Happy Coder daemon failed to start, continuing anyway..."
|| echo "Happy Coder daemon failed to start, continuing anyway..."
echo "Happy Coder daemon started" echo "Happy Coder daemon started"