Skip to content

CawaAlreadyTaken/docker-cms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contest Management System Docker Version

All credits go to tico88612/cms-docker and ioi/cms.

Support

System Support
Ubuntu 20.04
Ubuntu 22.04 ✅, Need to enable cgroup v1
Windows Subsystem Linux (Ubuntu 22.04)
macOS ⚠️

macOS doesn't support isolate (a.k.a. cmsWorker) running, because cgroups doesn't support macOS.

Architecture

TBD

Requirement

Enable cgroup v1 (Ubuntu 22.04)

Contest Management System is used ioi/isolate for sandbox, which is not supported cgroup v2 yet.

In Ubuntu 22.04, cgroup v1 default is not enabled. You need to enable it and reboot.

#!/bin/bash

echo 'GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_DEFAULT} cgroup_enable=memory swapaccount=1 systemd.unified_cgroup_hierarchy=false systemd.legacy_systemd_cgroup_controller=false"' | sudo tee /etc/default/grub.d/70-cgroup-v1.cfg
sudo update-grub
sudo reboot

After that, you will need to check cgroup v1 is enabled.

mount | grep cgroup

This is success example output.

ubuntu@cms:~$ mount | grep cgroup
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,size=4096k,nr_inodes=1024,mode=755,inode64)
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/misc type cgroup (rw,nosuid,nodev,noexec,relatime,misc)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)

Install Docker

Follow this manual to install Docker.

Installation

  1. If you want to change worker number, edit config/cms.conf and docker-compose.yml

  2. Copy .env.example to .env and edit CMS_SECRET_KEY, CMS_ADMIN_PASSWORD, CMS_RANKING_PASSWORD etc. (Contest has not been created yet, don't touch CMS_CONTEST_ID before creating the contest.)

cp .env.example .env
vim .env # Edit .env
  1. Build cms-base:latest image.
# Docker build
docker build -f images/cms-base/Dockerfile . -t cms-base:latest
# If you have install Buildx, you can try this
docker buildx build -f images/cms-base/Dockerfile . -t cms-base:latest
  1. Up all service
docker compose up -d
  1. Login to Admin system & Create contest.
Contest: http://localhost:8888
Admin: http://localhost:8889
Ranking: http://localhost:8890
  1. Have fun!

Bugs And Fixes

  1. Ranking Page issue with raphael.js

I experienced issues when trying to reach for the ranking page.

In particular, I saw that the file lib/raphael.js was missing. In order to fix this:

docker ps
docker exec -it <cms-web-ranking id> bash

Now that we are in cms-web-ranking docker, we need to add raphael.js into /cms/cmsranking/static/lib.

In order to have an editor:

apt update
apt install vim

Then, raphael.js can be found at https://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.1/raphael.js

Just copy it into the newly created file and reload the contest!

Reference project

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •