Initial commit - NUC server configuration and docs

- CLAUDE.md: Server instructions and service reference
- docs/: Persistent documentation (architecture, guides)
- .artifacts/: Session-generated notes
- playwriter-browser/: Remote browser container config

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-02-01 20:49:20 +00:00
commit 390eda1595
25 changed files with 3664 additions and 0 deletions

View File

@@ -0,0 +1,90 @@
#!/bin/bash
set -e
echo "=== Starting Playwriter Browser Container ==="
# Start Xvfb (virtual display)
echo "Starting Xvfb..."
Xvfb :99 -screen 0 1920x1080x24 -ac +extension GLX +render -noreset &
export DISPLAY=:99
sleep 2
# Initialize D-Bus for gnome-keyring
echo "Starting D-Bus session..."
mkdir -p /run/dbus
if [ ! -f /run/dbus/pid ]; then
dbus-daemon --system --fork 2>/dev/null || true
fi
export $(dbus-launch)
echo "D-Bus started: $DBUS_SESSION_BUS_ADDRESS"
# Initialize gnome-keyring (enables Chrome password saving)
echo "Starting gnome-keyring daemon..."
mkdir -p /root/.local/share/keyrings
# Create default keyring with empty password for headless operation
eval $(echo '' | gnome-keyring-daemon --unlock --start --components=secrets,pkcs11 2>/dev/null || true)
export GNOME_KEYRING_CONTROL
export SSH_AUTH_SOCK
echo "Keyring initialized at: $GNOME_KEYRING_CONTROL"
# Start window manager (needed for proper window handling)
echo "Starting Openbox window manager..."
openbox &
sleep 1
# Start VNC server
echo "Starting VNC server on port 5900..."
x11vnc -display :99 -forever -shared -rfbport 5900 -nopw -bg
sleep 1
# Start noVNC web interface
echo "Starting noVNC web interface on port 6080..."
websockify --web=/usr/share/novnc/ 6080 localhost:5900 &
sleep 1
# Start Playwriter relay server in background (binds to all interfaces for remote access)
echo "Starting Playwriter relay server on port 19988..."
playwriter serve --host 0.0.0.0 --token "${PLAYWRITER_TOKEN:-nuc-browser-token}" &
RELAY_PID=$!
sleep 2
# Start Chrome with remote debugging enabled
# The extension needs to be installed from Chrome Web Store on first run
echo "Starting Google Chrome..."
google-chrome-stable \
--no-sandbox \
--disable-gpu \
--disable-dev-shm-usage \
--remote-debugging-port=9222 \
--remote-debugging-address=0.0.0.0 \
--user-data-dir=/root/.config/google-chrome \
--start-maximized \
--no-first-run \
--disable-default-apps \
--disable-background-networking \
--disable-sync \
--disable-translate \
--password-store=gnome \
--enable-features=PasswordImport \
"chrome://extensions" &
CHROME_PID=$!
echo ""
echo "=== Playwriter Browser Ready ==="
echo "VNC: vnc://localhost:5900"
echo "noVNC Web: http://localhost:6080/vnc.html"
echo "Playwriter Relay: ws://localhost:19988"
echo "Chrome DevTools: http://localhost:9222"
echo ""
echo "IMPORTANT: On first run, install Playwriter extension from Chrome Web Store:"
echo "https://chromewebstore.google.com/detail/playwriter-mcp/jfeammnjpkecdekppnclgkkffahnhfhe"
echo ""
echo "Then run: /app/auto-activate.sh to try auto-activating the extension"
echo ""
# Wait for auto-activation script if extension is installed
sleep 10
/app/auto-activate.sh &
# Keep container running
wait $CHROME_PID