How pwncollege/dojo works
• Frontend (User Interface): Represented primarily by the dojo_theme directory which contains HTML templates, CSS, and JavaScript. This layer is responsible for rendering the user interface (dashboard, challenge pages, admin pages, etc.).
• Backend/API Layer: Centered in the dojo_plugin directory, which is segmented into API endpoints (dojo_plugin/api/v1), page rendering handlers (dojo_plugin/pages), and utility modules. This layer processes requests from the frontend and coordinates with other services.
• CTF Integration: The ctfd directory indicates built-in integration with a CTFd platform, which may be used for scoring, challenge management, or event tracking.
• Databases and Storage: The db directory (with its Dockerfile and startup scripts) represents the project's data persistence layer. Additionally, components like homefs, workspace, and dojofs indicate specialized file or volume management services.
• Orchestration & Containerization: With a docker-compose.yml and multiple Dockerfiles scattered across directories (ctfd, db, dojo, dojofs, sshd, watchdog, workspace, workspacefs), the architecture is containerized. Create a container cluster node or a “Docker” boundary that groups these services.
• Reverse Proxy & Load Balancer: The nginx-proxy directory contains configuration files for NGINX, which likely routes incoming web requests to the appropriate backend containers.
• Monitoring & Logging: The grafana and prometheus directories provide monitoring and metric dashboards for the system.
• System Integration & Timers: The etc/systemd directory comprises unit files (services and timers) that schedule backups, cache warmers, image pulling, and overall system health.
• Additional Services: Components like sshd (providing SSH gateway functionality) and watchdog (for container cleanup or monitoring) form additional pieces of the architecture.
Relationships and Data Flows
• Container Orchestration: Encapsulate most of these functionalities within Docker containers (as defined by the Dockerfiles and docker-compose). Indicate the orchestration boundary and how systemd timers (found in etc/systemd) trigger maintenance tasks on these containers.
• Reverse Proxy Routing: The nginx-proxy container should be shown routing external requests to the appropriate service containers.
Architectural Patterns and Design Principles
• Microservices / Containerized Architecture: Emphasize that many of the components are independent, containerized services communicating over defined interfaces.
• Separation of Concerns: The clear division between the frontend (dojo_theme), backend/API (dojo_plugin), and supporting services (database, reverse proxy, workspace, etc.).
• Extensibility: The dojo_plugin structure with modular API endpoints indicates an architecture designed for extensibility (supporting plugins and adding new endpoints).
• Infrastructure as Code: The presence of multiple Dockerfiles, docker-compose.yml, and systemd unit files indicates an environment where the infrastructure is reproducible and version-controlled.
Further Details
• Subsystems: For instance, within the API backend (dojo_plugin), detail submodules such as API endpoints (like belts, docker, score, scoreboard) to illustrate how requests are routed internally.
• Deployment Flow: Optionally, add a high-level deployment pipeline that shows how code moves from development (with devcontainer support) to production, utilizing Dockerfiles, docker-compose, and systemd-managed services.
• Refer to Documentation: Acknowledge the existence of detailed documentation in docs/architecture.md, docs/deployment.md, etc., for further clarification on interactions and deployment setups.