How inducer/relate works
Project Type and Purpose
• RELATE is a full-stack, web-based courseware platform built on Django.
• It provides content creation (YAML/Markdown), versioning via Git, code-question sandboxes, grading workflows, calendar/gradebook features, and instant messaging (XMPP).
High-Level Architectural Overview
• Browser / Client (HTML, CSS, JS assets served under frontend/)
• Reverse Proxy / Load Balancer (e.g., Nginx)
• Django Application Server
• WSGI entry point (relate/wsgi.py)
• Core Django project (relate/settings.py, URLs, middleware)
• Django apps:
– accounts (authentication, admin)
– course (content, flows, grading, calendar)
– prairietest (test harness)
– relate (global URLs, templates, static assets)
• Celery workers (relate/celery.py) for background tasks
• Data Stores
• Relational DB (PostgreSQL)
• Message broker (Redis or RabbitMQ) for Celery
• File storage (bulk-storage/ for large uploads)
• Git repositories (local or remote) for content versioning
• Sandboxed Code Execution
• Separate container or process (course/sandbox.py + docker-image-run-py/)
• Secured by Linux namespaces, resource limits
• External Services
• XMPP server for instant messaging
• Email service (SMTP) for notifications
• SAML Identity Provider for SSO
• Caching (e.g., Redis or memcached) for session data and analytics
• CI/CD pipelines (.github/, .ci/) and Docker scripts for deployment
Detailed Component Relationships
• Client → HTTP(S) → Load Balancer → Nginx
• Static assets (CSS/JS under frontend/) routed via Nginx or CDN
• Dynamic requests → Gunicorn/uWSGI → Django WSGI
• Django
• Views/controllers handle REST API and page rendering
• Views invoke models (accounts.models, course.models)
• Templates (relate/templates, course/templates) produce HTML
• Static files collected by collectstatic.sh
• Background Processing
• Django tasks (course.tasks, relate tasks) enqueued to broker
• Celery workers consume tasks for grading, analytics, email
• Code Sandbox
• User code submitted via a page (course/page/code_run_backend.py)
• Code execution delegated to sandbox container
• Results returned to Django, then to user and grading engine
• Data Persistence
• PostgreSQL stores user, course, flow session, grading, messaging data
• Git stores course content under version control
• Messaging
• In-class chat via XMPP (relate/auth integration)
• Instantflow requests (course/instantflowrequest) managed by Django
Architectural Patterns and Design Principles
• MVC (Model-View-Template) with clear separation of concerns
• Modular Django apps encapsulate features
• Asynchronous processing via Celery for scalability
• Containerized sandbox for isolation
• Git-backed versioning supports immutability and content previews
• Pluggable SSO (SAML) and external integrations