bytelyst-devops-tools/dashboard/DEPLOYMENT.md
root fbaaa71a66 feat(devops): adopt trading web deployment model with docker-compose
- Add docker-compose.yml following trading web pattern
- Update web Dockerfile to use multi-stage build with metadata
- Add build metadata (commit SHA, branch, timestamp, author, message)
- Rewrite deploy.sh to use docker compose with build metadata
- Add hotcopy deployment script for quick updates
- Add comprehensive backend API with deployment orchestration
- Add health checks, service management, and monitoring endpoints
- Add CI/CD workflow configuration
- Add deployment documentation and guides

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-05-11 03:24:11 +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/bytelyst-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/bytelyst-devops-tools/dashboard/backend
npm install
npm run build
npm start
# In another terminal:
cd /opt/bytelyst/bytelyst-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.