OpenContest is an open-source programming contest management system written in Python. It allows judges to write problems and contest participants to submit solutions to those problems.
To run OpenContest,
- Install Docker on a Unix-based machine and start the daemon
- Run
docker pull nathantheinventor/open-contest
- Create a directory to hold the contest database (ex. mkdir ~/db)
- Run
docker run -v /tmp:/tmp -v [db-path]:/db -v /var/run/docker.sock:/var/run/docker.sock -p 0.0.0.0:8000:8000/tcp nathantheinventor/open-contest
, substituting the contest database location for[db-path]
. - Navigate to localhost:8000 and enter
Admin
as the username and enter the password generated by OpenContest (visible in the command prompt) - Create problems, a contest to hold them, and users to participate
For example, run the following
$> sudo apt install docker.io
Reading package lists... Done
Building dependency tree
Reading state information... Done
. . .
$> docker pull nathantheinventor/open-contest
Using default tag: latest
latest: Pulling from nathantheinventor/open-contest
Digest: sha256:9f65996f196f8780956cd08b9ed53d84f4e26c5e8456fe50c6487e8a5f316948
Status: Image is up to date for nathantheinventor/open-contest:latest
$> docker run -v /tmp:/tmp -v ~/db:/db -v /var/run/docker.sock:/var/run/docker.sock -p 0.0.0.0:
8000:8000/tcp nathantheinventor/open-contest
INFO:root:saving Admin
INFO:root:Admin username is 'Admin'
INFO:root:Admin password is 'presently description kirk died'
INFO:root:Starting server...
OpenContest runs inside a Docker container and starts other containers on the host machine to run submissions. The explanation for the Docker flags used above is shown below:
docker run
-v /tmp:/tmp # Maps the /tmp directory on the Docker image to the /tmp directory on the real machine
# This is needed for running the submitted code, since submissions are processed
# in the /tmp directory.
-v /<db-path>:/db # Maps the path that you want to hold the database on the physical machine
# to the /db directory on the container.
# Allows the database to persist between runs of the container.
-v /var/run/docker.sock:/var/run/docker.sock # Maps the Docker daemon socket to the image,
# allowing OpenContest to run submissions
# in Docker containers.
-p 0.0.0.0:8000:8000/tcp # Maps port 8000 inside the container to port 8000 outside the container.
# You can change the IP so that OpenContest listens only on a particular
# network interface, and you can also change the port
# on which OpenContest listens.
nathantheinventor/open-contest # DockerHub address of the production version
"<Yourname>" # The name of the first admin user. This user will be given admin rights,
# and a password will be generated and printed at the beginning of the log.
8000 # Port number inside the container.
To create a problem, follow these steps:
- Log in to OpenContest at localhost:8000 with the username and password provided when you started the server.
- Choose Setup in the menu.
- Choose Problems.
- Click Create Problem.
- Enter the details of the problem. You may use Markdown formatting for the Problem Statement, Input Format, Output Format, and Constraints.
Note: The Description is the text shown under the problem title in the list of all problems. - After saving the problem details, create test data.
- After creating the test data, set the number of sample cases and save the problem.
OpenContest allows you to create multiple contests that run at different times. The most common use case for this feature is to allow for a practice round before an actual contest. To create a contest, go to Setup > Contest > Create Contest and enter the contest details.
After creating the contest, you can choose problems to go into the contest.
Before the contest begins, the home page will show a countdown to the beginning of the contest. During the contest, the home page will show a list of problems in the contest. After the contest ends, the final leaderboard for the most recent contest will be visible.
OpenContest formats problems for printing so that you can print and distribute problem statement packets to contestants. To print a problem, go to the edit page for the problem, click View Problem, and print the page with Ctrl+P.
From the user list page, you can print the page with Ctrl+P for a list of usernames and passwords. You can then cut the paper and deliver these sheets to the contestants.
See the Wiki for more information about how OpenContest works and how to add features.