This project aims at providing a back-end server that will serve as a companion to the Codecast front-end. The main functionalities provided by this back-end are:
- fetch information about a specific task
- grade a user submission on a task
- save user source code and avancement on a task
It is a complete rewriting in NodeJS/TypeScript of TaskPlatform which had been written in PHP in 2015.
The Codecast front-end can interact with this backend through a JSON API with
GET or POST methods (see the available routes in src/server.ts
).
This back-end can then interact with other back-end servers. In particular, to grade a user submission, this back-end calls the API of the grader queue to run tests on the user submission.
This back-end also interacts with a MySQL database that will store:
- the available tasks that can be solved with Codecast
- the user submissions and the grading of each of the submissions
- the user source codes
The goal is for this database to keep the same structure as the one used by TaskPlatform so that the migration from TaskPlatform to CodecastTaskBackend can be done smoothly.
You need to have NodeJS and Yarn installed on your computer.
First, clone this project.
Then copy .env
file to a .env.local
file and fill in your database credentials.
Then use:
yarn
yarn dev
Generate a pair of public/private keys
openssl genrsa -out keys/platform_key.pem 2048
openssl rsa -in keys/platform_key.pem -outform PEM -pubout -out keys/platform_public.pem
And put them in your .env.local
file:
- the
platform_key.pem
in a variablePLATFORM_OWN_PRIVATE_KEY
- the
platform_public.pem
in a variablePLATFORM_OWN_PUBLIC_KEY
And give your public key to an Algorea platform admin.
Generate a SSH key
ssh-keygen -t ed25519 -f keys/git_sync -N ""
This key will be used to connect to Git repositories to establish the synchronization. The public key can be added to the deploy keys of the concerned Git repositories.
To run the Cucumber tests, prepare the testing environment:
- Create a database
task_platform_test
- Import
schema.sql
into this database - Copy
.env
to a.env.test
file and fill in your database credentials
Then, run:
yarn test
To build a new version of the back-end, use:
yarn build