bytelyst-devops-tools/dashboard/DEPLOYMENT.md
Hermes VM 3ee4e7104e fix(dashboard): Phase 5 P0 — correct CI workspace path + real ESLint
- ci.yml: actions/checkout into the runner workspace instead of cd-ing into a
  hard-coded host path and `git reset --hard origin/main` on the live checkout;
  install via `pnpm install:gitea` (self-contained, no sibling common-plat
  checkout); E2E step left as a TODO pointer (ci-e2e-hardening, Phase 5 P2).
- Fix the same stale /opt/bytelyst/bytelyst-devops-tools path in deploy.sh,
  scripts/deploy-hotcopy.sh, DEPLOYMENT.md, DEPLOYMENT_GUIDE.md.
- Replace the no-op `lint` echoes with real ESLint 9 flat configs (js +
  typescript-eslint recommended) for backend and web; add a root `pnpm lint`.
- Fix the 10 errors lint surfaced, incl. require('os') in an ESM backend
  (system/repository.ts -> import * as os), prefer-const x4, and a ternary
  expression-statement in web vm/page.tsx.

Verified locally: secret-scan, lint (0 errors; correctly fails on bad code),
typecheck, unit tests (backend 9 / web 11), and build all green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-05-30 06:50:32 +00:00

173 lines
4.8 KiB
Markdown

# DevOps Dashboard Deployment Guide
## Current Status
The DevOps dashboard has been significantly enhanced with production-ready features, but deployment requires resolving workspace dependencies.
## Dependency Issues
The dashboard currently depends on workspace packages from `learning_ai_common_plat`:
- `@bytelyst/config` - Configuration management
- `@bytelyst/auth` - Authentication utilities
- `@bytelyst/cosmos` - Cosmos DB client
- `@bytelyst/errors` - Error handling
- `@bytelyst/react-auth` - React auth context
- `@bytelyst/telemetry-client` - Telemetry
## Deployment Options
### Option 1: Deploy with Common Platform (Recommended)
**Prerequisites:**
1. Ensure `learning_ai_common_plat` packages are built and available
2. Configure npm registry to point to local package registry
3. Use the provided install scripts
**Steps:**
```bash
cd /opt/bytelyst/learning_ai_devops_tools/dashboard
# Install dependencies with common platform
pnpm install:common-plat
# Build both backend and web
pnpm build
# Deploy with Docker Compose
docker-compose up -d
```
### Option 2: Deploy Standalone (Simplified)
**Prerequisites:**
1. Remove workspace dependencies
2. Implement simplified auth/config/cosmos layers
3. Set up environment variables
**Environment Variables Required:**
```env
PORT=4004
PLATFORM_SERVICE_URL=http://localhost:4003
COSMOS_ENDPOINT=https://your-cosmos-account.documents.azure.com:443/
COSMOS_KEY=your-cosmos-primary-key
COSMOS_DATABASE=bytelyst-platform
JWT_SECRET=your-jwt-signing-secret
CSRF_SECRET=your-csrf-secret-change-in-production
```
**Steps:**
```bash
cd /opt/bytelyst/learning_ai_devops_tools/dashboard/backend
npm install
npm run build
npm start
# In another terminal:
cd /opt/bytelyst/learning_ai_devops_tools/dashboard/web
npm install
npm run build
npm start
```
### Option 3: Deploy to Production Server
**Prerequisites:**
1. Production server with Node.js 22+
2. Azure Cosmos DB account
3. Platform service instance
4. Docker installed
**Steps:**
```bash
# Build Docker images
docker-compose build
# Tag and push to registry
docker tag devops-backend:latest your-registry/devops-backend:latest
docker tag devops-web:latest your-registry/devops-web:latest
docker push your-registry/devops-backend:latest
docker push your-registry/devops-web:latest
# On production server:
docker pull your-registry/devops-backend:latest
docker pull your-registry/devops-web:latest
docker-compose -f docker-compose.prod.yml up -d
```
## Features Implemented
The dashboard includes these production-ready features:
### Backend (Port 4004)
- ✅ CI/CD pipeline with Gitea Actions
- ✅ E2E tests with Playwright
- ✅ Telemetry integration
- ✅ Error boundary
- ✅ CSRF protection with token refresh
- ✅ Service CRUD operations
- ✅ Real-time log streaming (SSE)
- ✅ Audit logging
- ✅ Structured logging
- ✅ Database migrations
- ✅ Backup/restore functionality
- ✅ Performance monitoring (APM)
- ✅ System metrics (CPU, memory, disk)
- ✅ Docker cleanup endpoints
- ✅ OpenAPI/Swagger documentation at `/docs`
### Frontend (Port 3000)
- ✅ Service management UI
- ✅ Deployment monitoring
- ✅ Health dashboard
- ✅ Metrics/charts page
- ✅ System management page
- ✅ Real-time log viewer
- ✅ Accessibility features (ARIA, keyboard nav)
- ✅ PWA manifest
- ✅ Responsive design
## Services Configured
The dashboard can deploy:
1. **Investment Trading** (`learning_ai_invt_trdg`)
2. **Agentic Notes** (`learning_ai_notes`)
3. **AI Clock** (`learning_ai_clock`)
4. **Platform Services** (`learning_ai_common_plat`) - can be added
## Next Steps for Production Deployment
1. **Resolve Workspace Dependencies**: Ensure common platform packages are accessible
2. **Configure Environment Variables**: Set production values for Cosmos, JWT, etc.
3. **Set Up Infrastructure**: Azure Cosmos DB, platform service instance
4. **Configure CI/CD**: Update Gitea Actions with production registry
5. **Test Deployments**: Verify all deployment scripts work in production
6. **Set Up Monitoring**: Configure logging, metrics, and alerting
## Access
- **Dashboard**: http://localhost:3000 (or production URL)
- **API**: http://localhost:4004 (or production URL)
- **API Docs**: http://localhost:4004/docs
- **System Management**: Navigate to System page in dashboard
## Troubleshooting
**Workspace dependency errors:**
```bash
# Use the install scripts provided
pnpm install:common-plat # For local development
pnpm install:gitea # For Gitea environment
```
**Docker build failures:**
- Ensure Dockerfiles reference correct lock files
- Check that all dependencies are in registry
- Verify context paths in docker-compose.yml
**Port conflicts:**
- Backend uses port 4004
- Web uses port 3000
- Ensure these ports are available
The dashboard is feature-complete and ready for production deployment once the dependency infrastructure is resolved.