Configuration and Deployment Runbook
Introduction
This runbook documents local development, build, Docker runtime, Nginx behavior, runtime configuration, and common troubleshooting steps for the Ravenxcope frontend.
Local Development
Install dependencies using Yarn (recommended for consistency with Docker):
yarn install --frozen-lockfile
Common Commands:
- Dev Server:
yarn dev - Build:
yarn build - Lint:
yarn lint
Equivalent npm commands may work locally, but production Docker builds strictly use Yarn.
Environment Variables
Documented in .env.example:
VITE_API_BASE_URL=
VITE_ANALYTICS_AI_CHAT_ENABLED=false
| Variable | Required | Default / Fallback | Purpose |
|---|---|---|---|
VITE_API_BASE_URL | Recommended | http://localhost:5009/api | Backend base URL |
VITE_ANALYTICS_AI_CHAT_ENABLED | No | false | Enables analytics AI chat UI |
For production, set these variables on the container so docker-entrypoint.sh can inject them.
Docker Build
The Dockerfile uses a two-stage build:
-
Builder Stage:
- Uses
node:22-alpine. - Installs dependencies with
yarn install --frozen-lockfile. - Generates production assets with
yarn build.
- Uses
-
Runtime Stage:
- Uses
nginx:alpine. - Serves assets from
/usr/share/nginx/html. - Injects runtime configuration via
docker-entrypoint.sh. - Exposes port
8000.
- Uses
Runtime Config Injection
At container startup, docker-entrypoint.sh writes variables into window.__APP_CONFIG__ before starting Nginx. This allows the same image to be deployed across different environments (Staging, Production) without rebuilds.
Nginx Behavior
nginx/default.conf listens on port 8000 and provides:
- Static Serving: Serves built assets with long-term caching.
- Compression: Enables gzip for text and JSON assets.
- Security: Adds
X-Frame-Options,X-Content-Type-Options, andX-XSS-Protection. - SPA Fallback: Uses
try_files $uri $uri/ /index.htmlto support client-side routing. - Config Freshness: Serves
/config.jswith no-cache headers.
Deployment Checklist
Before deploying, verify the following:
- API Reachability: Backend API must be reachable from the user's browser.
- API Origin:
VITE_API_BASE_URLshould be the public backend origin without/api. - Chat Status:
VITE_ANALYTICS_AI_CHAT_ENABLED=truerequires a configured backend chat endpoint. - Port Mapping: Nginx port
8000must be correctly routed. - Config Verification: Confirm
/config.jsreturns the expected runtime values. - Route Fallback: Confirm deep-linked dashboard routes refresh correctly.
Troubleshooting
Login requests go to localhost
- Cause:
VITE_API_BASE_URLis missing or invalid. - Check: Verify
/config.jscontent. It should be a validhttporhttpsURL.
404 on dashboard refresh
- Cause: SPA fallback is inactive.
- Check: Ensure
nginx/default.confis correctly mounted and contains thetry_filesdirective.
Config changes not reflecting
- Cause: Browser or CDN caching of
/config.js. - Check: Verify
Cache-Control: no-storeheaders are present.
Auth redirects to login
- Possible Causes:
- Missing or expired session cookies.
- Backend returned
401. - API base URL mismatch.
- SameSite cookie policy restrictions.
- Check: Browser devtools for cookie presence and API response payloads.
Analytics AI chat is missing
- Possible Causes:
VITE_ANALYTICS_AI_CHAT_ENABLEDis false.- Backend chat status endpoint is unreachable or reports disabled.
- Check:
/config.jsandGET /api/analytics/chat/status.
Non-Goals
This frontend image only serves the browser application and runtime config. It does not run backend services, databases, or sensor agents.