Skip to content

OnceCemic/uoj

 
 

Repository files navigation

Universal Online Judge

Dependence

This is a dockerized version of UOJ. Before installation, please make sure that Docker has already been installed on your OS.

The docker image of UOJ is 64-bit, so a 32-bit host OS may cause installation failure.

Installation

First please download JDK7u76 and JDK8u31, and put them to docker/jdk-7u76-linux-x64.tar.gz and docker/jdk-8u31-linux-x64.tar.gz. These two compressed files are used by judge_client for judging Java program. If you are too lazy to download these two huge files, you can simply place two empty .tar.gz files there.

Next, you can run the following command in your terminal: (not the one in the docker/ directory!)

./install

If everything goes well, you will see Successfully built <image-id> in the last line of the output.

To start your UOJ main server, please run:

docker run -it -p 80:80 -p 3690:3690 <image-id>

If you are using docker on Mac OS or having 'std: compile error. no comment' message on uploading problem data, you could possibly use this alternative command:

docker run -it -p 80:80 -p 3690:3690 --cap-add SYS_PTRACE <image-id>

The default hostname of UOJ is local_uoj.ac, so you need to modify your host file in your OS in order to map 127.0.0.1 to local_uoj.ac. (It is /etc/hosts on Linux.) After that, you can access UOJ in your web browser.

The first user registered after the installation of UOJ will be a super user. If you need another super user, please register a user and change its usergroup to "S" in the table user_info. Run

mysql app_uoj233 -u root -p

to login mysql in the terminal.

Notice that if you want only one judge client, then everything is ok now. Cheers!

However, if you want more judge clients, you need to set up them one by one. First run:

./config_judge_client

and answer the questions.

  • uoj container id: the container id of the main server.
  • uoj ip: the ip address of the main server.
  • judger name: you can take a name you like, such as judger, judger_2, very_strong_judger. (containing special characters may cause unforeseeable consequence.)

After that, a sql command is given, we will talk about it later.

Next, we need to run:

./install_judge_client

to build the docker image. If you want to run judger at the same server, you just need to run

docker run -it <image-id>

And, you need to complete the sql command given just now with the ip address of the judger docker, and modify the database. To someone who do not know how to get the ip address of a docker container, here is the answer:

docker inspect --format '{{ .NetworkSettings.IPAddress }}' <container-id>

Or, if you want to run judger at different server, you need to copy the image to the other server, and run

docker run -p 2333 -it <image-id>

Similarly, you need to complete the sql command and modify the database. This time, you need to fill with the ip address of the host machine of the judger docker.

You may meet many difficulties during the installation. Good luck and have fun!

Notes

mysql default password: root

local_main_judger password: judger

You can change the default hostname and something else in /var/www/uoj/app/.config.php. However, not all the config is here, haha.

More Documentation

As you know, my Yingyu is not very hao. Suoyi only the README file is En(Chi)nglish for internationalization.

More documentation is here: https://vfleaking.github.io/uoj/

License

MIT License.

About

Universal Online Judge

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 36.3%
  • HTML 21.2%
  • PHP 20.7%
  • C++ 10.8%
  • CSS 7.7%
  • C 1.2%
  • Other 2.1%