bytelyst-devops-tools/DEPLOYMENT_GUIDE.md
root ca085ce63e Add production deployment scripts for ByteLyst services
- deploy-invttrdg.sh: Single-repo deployment for trading platform
  * Dirty checks (uncommitted changes, unpushed commits)
  * Pre-deployment smoke tests (backend contracts, web DOM tests)
  * Docker build and deployment (backend + web)
  * Post-deployment validation (health checks, endpoint verification)
  * Comprehensive smoke testing for production-grade deployment

- deploy-all.sh: Multi-repo deployment orchestration
  * Deploy all 4 production repos or specific ones
  * Same safety checks and deployment process for each repo
  * Health checks for all services

- DEPLOYMENT_GUIDE.md: Complete deployment documentation
  * Usage instructions for both scripts
  * Service endpoint mappings
  * Troubleshooting guide
  * Docker management commands

These scripts enable safe, tested production deployments with
comprehensive validation at every stage.

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

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-05-09 21:42:58 +00:00

6.0 KiB

ByteLyst Production Deployment Guide

Overview

This directory contains production deployment scripts for ByteLyst services.

Production Repos

Deployment Scripts

1. Single Repo Deployment (deploy-invttrdg.sh)

Deploy only the investment trading platform with comprehensive testing.

# Standard deployment (with dirty checks + smoke tests)
./deploy-invttrdg.sh

# Force deployment (skip dirty checks + smoke tests)
./deploy-invttrdg.sh --force

# Skip health checks and smoke tests
./deploy-invttrdg.sh --skip-health-check

What it does:

  1. Dirty check (uncommitted changes, unpushed commits)
  2. Pull and rebase origin/main
  3. Pre-deployment smoke tests:
    • Backend contract checks (API, audit repository, WebSocket, session rules)
    • Web typecheck + production build
    • Web DOM smoke tests (auth, kill-switch, components)
    • Mobile typecheck compilation
  4. Build and deploy Docker containers (backend + web)
  5. Post-deployment validation:
    • Health checks on localhost endpoints
    • Production endpoint verification (api.bytelyst.com, invttrdg.bytelyst.com)
    • API smoke tests (health endpoint, content validation)
    • Web frontend validation (HTML content check)

2. Multi-Repo Deployment (deploy-all.sh)

Deploy all production repos or specific ones.

# Deploy all production repos
./deploy-all.sh

# Deploy specific repos
./deploy-all.sh learning_ai_invt_trdg learning_ai_clock

# Force deployment (skip dirty checks)
./deploy-all.sh --force

# Skip health checks
./deploy-all.sh --skip-health-check

# Deploy specific repos with force
./deploy-all.sh --force learning_ai_invt_trdg

What it does:

  1. Runs dirty checks for each repo
  2. Pulls and rebases origin/main for each repo
  3. Builds and deploys Docker containers
  4. Runs health checks on all services

Service Endpoints

Investment Trading (learning_ai_invt_trdg)

Docker Services Deployed:

  • Backend: invttrdg-backend (port 4018 → mapped to 4025)
    • Trading engine + REST API + Socket.IO
    • Health endpoint: /health/live
    • API endpoints for trading operations
  • Web: invttrdg-web (port 3085)
    • Vite SPA served via nginx
    • React trading interface

Exposed Endpoints:

Platform Services (learning_ai_common_plat)

ChronoMind (learning_ai_clock)

NoteLett (learning_ai_notes)

Docker Management

Check running containers

docker ps

View logs

# Specific repo
cd learning_ai_invttrdg
docker compose logs -f

# All containers
docker compose -f learning_ai_common_plat/docker-compose.ecosystem.yml logs -f

Restart services

# Specific repo
cd learning_ai_invttrdg
docker compose restart

# All services
docker compose -f learning_ai_common_plat/docker-compose.ecosystem.yml restart

Stop services

# Specific repo
cd learning_ai_invttrdg
docker compose down

# All services
docker compose -f learning_ai_common_plat/docker-compose.ecosystem.yml down

Troubleshooting

Dirty Check Failures

If deployment fails due to uncommitted changes:

# Option 1: Commit changes
cd learning_ai_invttrdg
git add .
git commit -m "Your commit message"

# Option 2: Stash changes
git stash

# Option 3: Force deployment
./deploy-invttrdg.sh --force

Rebase Conflicts

If rebase fails due to conflicts:

cd learning_ai_invttrdg
# Resolve conflicts
git add .
git rebase --continue

Health Check Failures

If health checks fail but services are starting:

# Skip health checks and smoke tests
./deploy-invttrdg.sh --skip-health-check

# Check manually
curl http://localhost:4025/health/live
curl http://localhost:3085

Smoke Test Failures

If pre-deployment smoke tests fail:

# Run smoke tests manually to debug
cd learning_ai_invt_trdg
./scripts/smoke-release.sh

# Run individual backend checks
cd backend
npm run check:api-contract
npm run check:websocket-contract
npm run check:session-rule-normalization

# Run web tests individually
cd ../web
pnpm vitest run src/components/Login.dom.test.tsx

Docker Build Failures

If Docker build fails:

# Clean build
cd learning_ai_invttrdg
docker compose build --no-cache

# Check disk space
df -h

DNS Configuration

DNS is managed via GoDaddy. To update DNS records:

cd learning_ai_common_plat
./scripts/godaddy-sync-bytelyst-dns.sh --ip <YOUR_VM_IP> --validate

Monitoring

Health Check Script

./check-health.sh

View Logs

Production Checklist

Before deploying to production:

  • All tests pass locally
  • No uncommitted changes
  • No unpushed commits
  • Environment variables are set correctly
  • DNS records point to correct IP
  • Database migrations are applied
  • Backup current deployment
  • Monitor logs after deployment

Rollback

If deployment causes issues:

cd learning_ai_invttrdg
# Revert to previous commit
git log --oneline -5
git revert <commit-hash>

# Redeploy
docker compose up -d --build