Academic

Coursero — A Containerized Prototype for Automated Code Grading

A two-person prototype of a platform where students submit code that is graded automatically — two front ends behind Nginx, replicated MySQL, Docker Compose.

Completed
Diagram of the prototype on a single host. In Docker Compose, an Nginx load balancer sends HTTP requests to two identical frontends (Nginx and PHP-FPM 8.1) running the PHP application, which uses the primary MySQL database and falls back to a secondary one if the primary is unreachable. Submitted files are dropped into a shared folder; outside the containers, a grading script run every five seconds processes them in arrival order with Python and writes grades to the primary database. Replication between the two databases was configured by hand during the project and is not kept in the repository.
Implemented architecture — prototypeFunctional view of the implemented prototype: HTTP load balancing across two PHP frontends, submission processing by a grading script, and MySQL storage. Database replication was configured by hand during the project and is not documented as reproducible from the repository.

My contribution

A two-person project, with shared work on the infrastructure, the web application, the database, deployment and the grading pipeline.

Highlights

  • Submission, automated grading and grade lookup, end to end
  • Submission queue processed in arrival order by a scripted grader
  • Continuity demonstrated when stopping a web front end, then the primary database

Goal

Build a platform where students upload their code, which is then run, compared against a reference solution and graded automatically. The project covered the application as much as the infrastructure hosting it, with a redundancy requirement. The result is a prototype: a working submission and grading chain, not a production platform.

How it works

A PHP web interface lets students pick an exercise, upload their file and look up their grades later. Submissions land in a shared folder; a grader written in Bash checks it every five seconds, handles the oldest submission first, runs the submitted Python program with several sets of arguments, compares the output and expected errors, then stores the grade in the database and archives the submission. Two Python exercises are graded automatically.

Infrastructure

Everything runs under Docker Compose. An Nginx instance in front spreads requests across two web front ends, each combining Nginx and PHP-FPM. Data lives on two MySQL instances: replication between them was configured by hand during the project, and the application falls back to the secondary database if the primary stops responding. Shell and PowerShell scripts start, check and stop the environment.

Redundancy demonstrated

Two scenarios were demonstrated during the final presentation. Stopping one of the two front ends did not interrupt the service: the site stayed reachable through the other one. Stopping the primary database showed the application switching to the secondary one. These are two targeted redundancy mechanisms, not a fully highly available architecture.

Prototype limits

The prototype focused on the working submission and grading chain. Sandboxing of submitted code and some of the protections planned at the start were not finished. The MySQL replication setup, done by hand inside the containers, was not kept with the project.

Media