:author: Christoph Walther, Elmar Kresse
:toc: left
:toc-title: Table of Contents
:sectnums: 
:toclevels: 2
:bibtex-file: bibliography/CodeContender.bib
:data-uri:
ifndef::imagesdir[:imagesdir: media]
ifndef::includedir[:includedir: content]
= CodeContender =


== Introduction ==

CodeContender is a platform for learning and practicing coding. It is a web application that provides a set of coding courses with diffrend tasks and questions. Content is divided into different categories and levels. Users get information in form of text, images, and videos. They can also practice coding in an online code editor. The platform is designed to be user-friendly and easy to use. It is suitable for beginners as well as advanced users.
Goal after finishing a course is to pass a final test and get a certificate.

== Problem Analysis ==

Software Setup:

* is a cluster already running wtih the required software? (e.g. docker, kubernetes, etc.)
* Installation scripts like ansible, puppet, etc. to install the required software
* Installation scripts for the application
* Configuration files for the application
* Configuration files for the cluster


=== Requirements ===

* Authentication, Authorization, User Management

#### Content

* Courses, Categories, Levels
    ** Tasks, Questions
    ** Text, Images, Videos
    ** Folder structure for content or standerdized format for content like IMS QTI
    ** Versioning of content (e.g. git)
    ** Admin Panel for managing content
    ** Progress Tracking, evaluation, scoring of users
    ** Submitting the solution separately from the evaluation (error timeout etc.)
    ** Final Test, Certificate
    ** Programming Language independent
    ** Courses should have diffrent forms of questions (e.g. multiple choice, fill in the blank, etc.)
    ** own definable docker images for the evaluation of the submissions (e.g. python, java, golang, etc.)
    ** Possible ML or AI tasks (e.g. image recognition, video generation, etc.)

#### Evaluation of submission

    ** Management container per user for evaluation (security, isolation, resource management)
        *** Management of containers solution (e.g. docker, kubernetes, etc.) or a extra own container management service
        *** Extrecting of diffrent responses from the container (extraction and saving results)
    ** Submission
        *** directed to extera container for user session
        *** hook in datamanagement for submissions to run the evaluation -> Management Container
    ** Evaluation
        *** Evaluation of the submission
        *** Running the code on extra container for evaluation (security, isolation, resource management)
        *** Saving the results
        *** Sending the results back to the user

#### Code Editor

* Code Editor
    ** Syntax Highlighting
    ** Code Completion
    ** Code Execution
    ** Code Testing
    ** Code Sharing

## Architecture

image::codeContender.png[]


### Components

#### Frontend

This is the user interface of the application. It is a web application that users interact with. It is responsible for displaying content, managing user interactions, and sending requests to the backend.
It could be loadbalanced and scaled horizontally to handle more users. Its stateless and can be easily replaced.

#### Backend

This is the core of the application. It is responsible for handling requests from the frontend, processing data, and sending responses back. It is also responsible for managing the database, handling authentication, and managing user sessions.

#### Database

For saving progress, user data, and other information, a database is needed. It could be a traditional SQL database or a NoSQL database. It should be scalable, reliable, and secure.

No traditional database is needed for course and user data. All content is stored in a git repository. The backend fetches the content from the repository and serves it to the frontend. This makes it easy to update content, manage versions, and collaborate with others.
There are diffrent git repositories for user generated content and the content of the courses. Both utilize a LFS (Large File Storage) for storing images and videos and the ability to pull the content from the repository without the need to clone the whole repository.

#### CourseService

This is a microservice that is responsible for managing courses. It fetches content from the git repository, processes it, and serves it. The course content is cached and linked with the git revision. This makes it easy to update content and manage versions.


#### UserService

This is a microservice that is responsible for managing users input and output. It fetches the users input data for courses from the git repository, processes it, and serves it. The user content is cached and linked with the git revision. This makes it easy to update content and manage versions.

#### UserRepository

This is the git server that stores the user input data for solving tasks in the courses. It is a separate git repository that is linked with the user input data. This makes it easy to manage user input data and track changes.
It follows a predefined structure for storing user input data. Each user has a separate repository with a unique ID. Inside the repository, there are diffrent branches for each course. Each branch contains the user input data for the course. This makes it easy to manage user input data and track changes.
The repository makes it possible to work in your own environment and push the changes to the repository. The backend fetches the changes and updates the user input data. This makes it easy to work offline and collaborate with others.

Repositorys need to be secured and limited in size. That users can't upload large files or malicious content. The repository should be monitored and checked for changes. It should be possible to revert changes and restore the repository to a previous state.

== Existing Solutions ==

include::{includedir}/existing_solutions.asciidoc[]

== edX Platform ==

include::{includedir}/edX.asciidoc[]

== edX Kubernetes Deployment ==

include::{includedir}/edX-k8s.asciidoc[]

== Kubernetes vs. Nomad ==

include::{includedir}/kubernetes-nomad.asciidoc[]

== Dockerized Codeocean ==

include::{includedir}/dockerization-codeocean.asciidoc[]

== Deployment ==

include::{includedir}/deployment.asciidoc[]

== CodeOcean Docker Images ==

include::{includedir}/codeocean-dockerimages.asciidoc[]

== Sources ==

include::{includedir}/sources.asciidoc[]
