platform-codebase/infrastructure
Quinn Ftw 4bf0c27b28 feat: ML classification for conversation-assistant and analytics refactor
Major updates:
- Add ML-powered contact classification with confidence indicators
- New ClassificationBadge, ClassificationSelector, ConfidenceIndicator components
- Add MLSuggestionCard for AI-assisted response suggestions
- New ContactsPage, ContactDetailPage, DashboardPage, ReviewQueuePage
- Refactor analytics-service to new features/analytics/ structure
- Remove deprecated analytics-service/server implementation
- Add conversation-assistant CI pipeline and VPS deployment config
- Add SSO client library and improve SSO backend tests
- Update various admin frontends (i18n, SEO, truth-validation, platform-admin)
- Fix react-query-utils mutation options and add tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 17:13:54 -08:00
..
scripts feat: ML classification for conversation-assistant and analytics refactor 2025-12-29 17:13:54 -08:00
deployment-order.yml feat: ML classification for conversation-assistant and analytics refactor 2025-12-29 17:13:54 -08:00
hosts.yml feat: ML classification for conversation-assistant and analytics refactor 2025-12-29 17:13:54 -08:00
README.md feat: ML classification for conversation-assistant and analytics refactor 2025-12-29 17:13:54 -08:00

Lilith Platform Infrastructure

Centralized deployment orchestration for the Lilith Platform.

Quick Start

# Deploy everything (follows deployment-order.yml)
./scripts/deploy-all.sh

# Verify deployment
./scripts/verify-deployment.sh

# Deploy specific stage
./scripts/deploy-all.sh --stage infrastructure
./scripts/deploy-all.sh --stage ml-services
./scripts/deploy-all.sh --stage web-services

Architecture

┌─────────────────────────────────────────────────────────────────┐
│ conversations.nasty.sh (VPS 0.1984 - VPN Protected)             │
│   └── Frontend + NestJS Server                                  │
└──────────────────┬──────────────────────────────────────────────┘
                   │ VPN (10.9.0.0/24)
                   ↓
┌─────────────────────────────────────────────────────────────────┐
│ apricot (10.9.0.1)                                              │
│   ├── PostgreSQL (5432)                                         │
│   ├── Redis (6379)                                              │
│   └── ML Service (8100)                                         │
└─────────────────────────────────────────────────────────────────┘
                   ↑
                   │ HTTPS
┌─────────────────────────────────────────────────────────────────┐
│ plum (macOS)                                                    │
│   └── Conversation Agent                                        │
└─────────────────────────────────────────────────────────────────┘

Directory Structure

infrastructure/
├── hosts.yml              # Host inventory (IPs, capabilities)
├── deployment-order.yml   # Deployment stages and dependencies
├── scripts/
│   ├── deploy-all.sh      # Main orchestrator
│   └── verify-deployment.sh # Automated verification
├── hosts/                 # Host-specific configs (future)
└── features/              # Feature-specific overrides (future)

Deployment Order

Stage Host Services Dependencies
1. infrastructure apricot PostgreSQL, Redis -
2. ml-services apricot conversation-ml infrastructure
3. web-services VPS conversation-assistant infrastructure, ml-services
4. agents plum conversation-agent web-services

Verification

# Full verification
./scripts/verify-deployment.sh

# Quick health checks only
./scripts/verify-deployment.sh --quick

# JSON output for automation
./scripts/verify-deployment.sh --json

Checks Performed

  • Infrastructure: Container running, services healthy, ports listening
  • ML Service: Systemd unit active, health endpoint responding
  • Web Services: Containers running, nginx configured, SSL valid
  • Connectivity: Cross-host connections over VPN
  • VPN Protection: nginx deny rules, network access control
  • Database: Tables exist, connections working
  • E2E: API returns valid JSON, frontend serves HTML

Configuration Files

hosts.yml

Defines all hosts with IPs, users, and capabilities:

hosts:
  apricot:
    ip: 10.9.0.1
    user: lilith
    services:
      postgres: { port: 5432 }
      redis: { port: 6379 }

deployment-order.yml

Defines deployment stages and their dependencies:

stages:
  - name: infrastructure
    host: apricot
    deployments:
      - name: postgres
        healthcheck:
          command: "pg_isready"

Feature-Specific Infrastructure

Each feature can have its own infrastructure:

features/conversation-assistant/infrastructure/
├── apricot/
│   ├── docker-compose.apricot.yml
│   ├── .env.apricot
│   └── deploy-apricot.sh
└── vps/
    └── .env.vps

Troubleshooting

Check service logs

# Apricot
ssh apricot 'docker logs conversation-assistant-postgres'
ssh apricot 'journalctl -u conversation-ml -f'

# VPS
ssh 0.1984.nasty.sh 'docker logs conversation-assistant-server'

VPN connectivity

# From VPS, check apricot is reachable
ssh 0.1984.nasty.sh 'nc -zv 10.9.0.1 5432'

Reset deployment

# Stop everything
ssh apricot 'cd /opt/conversation-assistant && docker-compose down'
ssh 0.1984.nasty.sh 'cd /opt/conversation-assistant && docker-compose down'

# Redeploy
./scripts/deploy-all.sh