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
- Architecture Overview - Complete system design and components
- Services and Ports - Service interactions and networking
- Integration Patterns - How WAIIDE integrates with JupyterHub
π§ 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
| Port | Service | Mode | Description |
|---|---|---|---|
| 8080 | Main Service | Both | JupyterHub/API server |
| 8071 | WAIIDE Server | Both | Internal WAIIDE |
| 8070 | Legacy Port | Standalone | Backward 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 pathURL 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-hashformat 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
- User Access: User visits instance URL
- JupyterHub Auth: Validates user session
- OAuth Token: JupyterHub provides API token
- Container Auth: Token validated for container access
- 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
- Configuration - How to configure this architecture
- Troubleshooting - Fix architectural issues
- Development - Extend the architecture
π‘ Next Steps: Review Configuration to implement this architecture!