How oldgalileo/bastille works
Main Components
• Frontend User Interface (UI):
• This is located in the “app” directory. Notice the Vue components (e.g., App.vue, Navigation.vue, Dashboard.vue), routing (app/src/router), state management (app/src/store), and build/config files (under app/build and app/config).
• The UI likely enables users to upload strategies, view tournament results, and configure tournaments.
• Backend Tournament Engine:
• The root-level files “main.go”, “server.go”, and “tournament.go” indicate that the core tournament logic and API server are implemented in Go.
• This server is responsible for orchestrating tournaments, scheduling matches, handling score calculations, and interfacing with strategy containers.
• Strategy Containerization Module:
• The “dock” directory (including “Dockerfile” and “relay.go”) is dedicated to setting up containerized environments wherein submitted strategies (written in any compiled language or Python as a starter) are run safely.
• The relay component likely handles the communication between the container (stdout/stdin) and the backend’s supervisor.
• Example Strategies:
• Located in the “examples” directory, these scripts (in Python, Bash, etc.) are sample strategies that help users get started.
• (Optional) Configuration/Deployment:
• There are various configuration files, such as .babelrc, webpack confs, and package.json, which underline the frontend building and deployment process.
Relationships and Data Flow
• Direction of Interaction:
• The Frontend communicates with the Backend over HTTP/REST (or possibly WebSockets) to submit strategies and fetch tournament results.
• The Backend orchestrates the tournament by launching containers using the Docker-related modules. It directs the containerized strategies via the “relay” mechanism to exchange moves through standard I/O.
• The examples serve as a reference for users on how to write strategies that interact with the containerized supervisor.
• Inside the container environment, show bi-directional communication with the strategy’s process (stdin and stdout streams) that feed back to the backend’s scoring logic.
Architectural Patterns and Design Principles
• Separation of Concerns:
• Clearly separate the frontend (Vue) from the backend (Go) and the strategy execution (Docker).
• Containerization:
• That each strategy runs in an isolated container, highlighting security and scalability foundations.
• Modularization:
• That the project is modular (with separate directories for UI, backend, docker setup, and examples) making it easy to extend or modify specific parts (like strategy handling or UI improvements).
Relevant Technologies and Frameworks
• Frontend Technologies: Vue.js, Webpack, Babel, and associated Node.js tooling.
• Backend Technologies: Go programming language, with modules deployed as server.go and tournament.go.
• Containerization: Docker (as seen in the “dock” directory), with specialized logic in relay.go to manage strategy container communication.
• Communication Interfaces: Use standard I/O for interacting with strategies, as described in the README’s strategy example.