You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Tianyun Zhang 94eb86257e
fix reading output of compile error
2 months ago
.vscode add vscode C# config 2 months ago
Client update size of refresh button in problem submissions page 2 months ago
Dockerize add static folder in caddy 2 months ago
Isolate add Isolate source code 8 months ago
Notification change namespace of Data to Shared 2 months ago
Server fix adding accepted contestants to problem stats 2 months ago
Shared add exporting of lab problem submissions 2 months ago
Worker fix reading output of compile error 2 months ago
.dockerignore add dockerfile to build worker container 8 months ago
.drone.yml set registry mirror for dockerd in drone.yml 2 months ago
.gitignore update Docker configuration files 8 months ago
.gitlab-ci.yml update pipeline config 7 months ago fix reading output of compile error 2 months ago
Dockerfile.env use tencent nuget mirror, bump version 1.5.9 2 months ago
Dockerfile.node update dockerfiles, add node container 2 months ago
Dockerfile.runtime fix apt source in sdk and runtime containers 2 months ago
Dockerfile.sdk fix apt source in sdk and runtime containers 2 months ago
Dockerfile.webapp fix building spa, bump version 1.5.1 2 months ago
Dockerfile.worker update dockerfiles, add node container 2 months ago
DotOJ.sln update client project config file 2 months ago
LICENSE add GPLv3 license 2 months ago update dockerfiles, add node container 2 months ago fix adding .env to zip file 2 months ago


Also known as: .OJ, NTOJ, OJ Core, etc.

Yet another online judge built on .NET Core tech stack, with ASP.NET and Angular.


DotOJ depends on multiple open-source projects:


The judging service depends on control group of Linux kernels. It is not possible to run workers on Windows or macOS, but the web application is cross-platform.

Follow the steps to prepare a dev environment:

1. Install .NET Core SDK

Proceed to and download .NET Core SDK for your platform. Do not download .NET Framework or you will not be able to make a build. After installation, fire dotnet in a shell to check it is correctly installed.

Important: You MIGHT see a line in output that tells 'Successfully installed the ASP.NET Core HTTPS Development Certificate.' This would be critical in step 5 for development environment.

Now install Entiry Framework Core CLI tools with the following commands (reference):

$ dotnet tool install --global dotnet-ef
$ dotnet add package Microsoft.EntityFrameworkCore.Design

You can verify that the EFCore tool is correctly installed with dotnet ef.

2. Install Node.js

Visit and download the latest LTS version installer. After installation, you should check node --version and npm --version to make sure these two tools are working.

We are not using Yarn for this project. If your Internet connection is not smooth, refer to this page to learn how to change registry for NPM.

3. Install dependencies

Clone this repository and open the folder in a shell.

  • Run the following command to install .NET packages.
    $ dotnet restore
  • cd into directory /ClientApp and run the following command to install Node.js dependencies.
    $ npm install

    During the installation you might get a prompt for telemetering of Angular. After that you should see Angular modules being compiled locally. You should test installation with ng version.

4. Configure Data Source

We are using MySQL or MariaDB (preferred) as the data source.

Install DB server on your computer and update the connection string in WebApp/appsettings.json, then create a user called dotoj with full access to database dotoj. Tables will be created on the first run so there is no need for manual migrations.

5. Run the application

Before we run the application for the first time, it is CRITICAL to install and trust an HTTPS development certificate on Windows and macOS. Simply run the following command and trust the certificate, or refer to this manual:

$ dotnet dev-certs https --trust

Start WebApp and Worker with dotnet run and you should be able to visit the site at https://localhost:5001.


Docker Containers

Docker containers are published in registry and namespace There are six containers to build and run services:

  • sdk: .NET Core SDK.
  • runtime: ASP.NET runtime.
  • env: build environment.
  • node: node environment.
  • webapp: web frontend and server.
  • worker: judge service.

For more information on how to deploy with docker, refer to Dockerize/

Scaling Application

The application can be easily scaled by adding or removing workers.

However, workers needs to share file system with web app in order to keep judge data updated. On the other hand, if judge data can be made read only, then workers can run on separate environments with connection to the same DB context.

Create X.509 Cerfificate

$ openssl req -x509 -newkey rsa:4096 -sha256 -nodes \
  -subj "/CN=DotOJ" -keyout identity.key -out identity.crt
$ openssl pkcs12 -export -out out/identity.pfx -password pass:identity \
  -inkey identity.key -in identity.crt