WAIIDE Architecture

WAIIDE Architecture

Calliope Integration: This component is integrated into the Calliope AI platform. Some features and configurations may differ from the upstream project.

Understanding WAIIDE’s architecture helps with configuration, troubleshooting, and custom integrations.

πŸ—οΈ System Overview

πŸ”§ Core Components

WAIIDE Container Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     WAIIDE Container            β”‚
β”‚                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚  Entrypoint Script      β”‚    β”‚
β”‚  β”‚  - Environment Detectionβ”‚    β”‚
β”‚  β”‚  - Permission Managementβ”‚    β”‚  
β”‚  β”‚  - Service Orchestrationβ”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚  JupyterHub Mode        β”‚    β”‚
β”‚  β”‚  β”œβ”€ jupyterhub-singleuser  β”‚
β”‚  β”‚  β”œβ”€ jupyter-server-proxyβ”‚    β”‚
β”‚  β”‚  └─ WAIIDE (port 8071) β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚  Standalone Mode        β”‚    β”‚
β”‚  β”‚  β”œβ”€ API Server (8080)   β”‚    β”‚
β”‚  β”‚  └─ WAIIDE (port 8071) β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Service Discovery and Health Checking

  • API Endpoints: /api, /api/status, /api/services
  • Health Checks: JupyterHub compatibility
  • Service Registry: Dynamic service detection

🌐 Network Architecture

Port Configuration

PortServiceModeDescription
8080Main ServiceBothJupyterHub/API server
8071WAIIDE ServerBothInternal WAIIDE
8070Legacy PortStandaloneBackward compatibility

URL Routing (JupyterHub Mode)

External Request: /user/lmata/lmata-waiide-abc123/
                ↓
JupyterHub Proxy: Routes to container
                ↓
jupyterhub-singleuser: Port 8080
                ↓
jupyter-server-proxy: Detects WAIIDE
                ↓
WAIIDE Server: Port 8071 (internal)
                ↓
Response: WAIIDE UI at root path

URL Routing (Standalone Mode)

External Request: http://localhost:8080/
                ↓
API Server: Port 8080
                ↓
Proxy Logic: Routes to WAIIDE
                ↓
WAIIDE Server: Port 8071 (internal)
                ↓  
Response: WAIIDE UI with path rewriting

πŸ”„ Multi-Instance Architecture

Instance Isolation

  • Container Per Instance: Each server gets its own container
  • Unique Naming: username-service-hash format ensures no conflicts
  • Resource Isolation: CPU, memory, and storage per instance
  • Network Isolation: Each container has its own network namespace

Instance Management

User: lmata

Instance 1: lmata-waiide-abc123
β”œβ”€ Container: lmata-waiide-abc123
β”œβ”€ URL: /user/lmata/lmata-waiide-abc123/
└─ Storage: volume-lmata-waiide-abc123

Instance 2: lmata-lab-def456  
β”œβ”€ Container: lmata-lab-def456
β”œβ”€ URL: /user/lmata/lmata-lab-def456/
└─ Storage: volume-lmata-lab-def456

πŸ” Authentication and Security

OAuth Flow

  1. User Access: User visits instance URL
  2. JupyterHub Auth: Validates user session
  3. OAuth Token: JupyterHub provides API token
  4. Container Auth: Token validated for container access
  5. WAIIDE Access: User authenticated to WAIIDE

Security Boundaries

  • User Isolation: Each user’s containers run as UID 1000
  • Network Security: WAIIDE only accessible via proxy
  • Token Security: OAuth tokens are scoped per instance
  • File System: User home directories are isolated

πŸ“Š Data Flow

Request Processing

1. User Request β†’ JupyterHub Proxy
2. Proxy β†’ Container (port 8080)
3. Container β†’ jupyterhub-singleuser
4. singleuser β†’ jupyter-server-proxy  
5. proxy β†’ WAIIDE Server (port 8071)
6. WAIIDE β†’ Response
7. Response β†’ User (with URL rewriting)

WebSocket Handling

  • Upgrade Detection: Automatic WebSocket upgrade handling
  • Bidirectional Proxy: Full duplex communication
  • Connection Management: Proper connection lifecycle
  • Error Handling: Graceful disconnection handling

βš™οΈ Configuration Integration

Environment-Based Configuration

  • JupyterHub Mode: Detected via JUPYTERHUB_* variables
  • Instance Names: Read from JUPYTERHUB_SERVER_NAME
  • URL Prefixes: Applied from JUPYTERHUB_SERVICE_PREFIX
  • Dynamic Config: Configuration adapts to environment

Container Lifecycle

1. Container Start β†’ Root privileges
2. Permission Fix β†’ Set ownership to 1000:100
3. User Drop β†’ Switch to UID 1000
4. Environment Check β†’ Detect JupyterHub mode
5. Service Start β†’ Launch appropriate services
6. Health Check β†’ Report ready status

πŸ”Œ Extension Points

Custom Spawners

  • ECS Integration: Environment variable passing
  • Kubernetes: Pod specification
  • Custom Spawners: Generic integration pattern

Service Discovery

  • API Endpoints: Programmatic service discovery
  • Health Monitoring: Integration with monitoring systems
  • Load Balancing: Multiple instance coordination

πŸ“ˆ Performance Characteristics

Resource Usage

  • Base Memory: ~500MB per container
  • CPU Usage: Variable based on WAIIDE usage
  • Storage: User workspace + WAIIDE extensions
  • Network: Minimal overhead from proxying

Scaling Patterns

  • Horizontal: Multiple instances per user
  • Vertical: Resource limits per container
  • Auto-scaling: Based on resource usage
  • Load Distribution: Across multiple nodes

πŸ” Monitoring and Observability

Built-in Monitoring

  • Health Endpoints: /api/status, /api/services
  • Log Aggregation: Structured logging
  • Metrics: Service availability and performance
  • Debugging: Detailed error reporting

Integration Points

  • Prometheus: Metrics exposition
  • Grafana: Dashboard integration
  • ELK Stack: Log analysis
  • Custom Monitoring: API-based monitoring

πŸ“– Related Documentation


πŸ’‘ Next Steps: Review Configuration to implement this architecture!