Skip to content

Get Started

adrien1018 edited this page Mar 2, 2025 · 2 revisions

Installation

You can use either Docker or the provided setup script to install TIOJ on your machine.

After installing TIOJ, remember to change the default admin password!

Docker

This method will install TIOJ and its judge client into Docker containers.

  1. Install docker-compose and setup .env using the format of .env.example.
    • The SMTP_* and MAIL_* variables are only added if password recovery function is needed. Without them, the function is automatically disabled.
  2. docker-compose up -d and enjoy TIOJ on port 4000.

Installation script

This method will install TIOJ onto the machine itself. Note that this means the machine environment changes (for example, installing Python packages or upgrading compiler) will directly affect the judge.

To run the installation, make sure the current user has sudo privileges, and run the provided installation script:

curl -sSL https://raw.githubusercontent.com/TIOJ-INFOR-Online-Judge/tioj/main/scripts/install.sh | DB_PASSWORD=some_password bash -s

It is recommended to run this script on a freshly-installed machine. This script will install both the web server (by passenger-install-nginx-module) and the judge client, and start & enable them via systemd.

The systemd service names are nginx.service and tioj-judge.service. The configuration files are located at /opt/nginx/conf and /etc/tioj-judge.conf. You can modify them and reload/restart the services.

If password recovery is needed, setup the settings file after the installation is completed, or pass the SMTP_* and MAIL_* environment variables to bash just like those in .env.example.

This script is tested on Ubuntu 20.04 LTS and 22.04 LTS. It also works on Arch Linux, but direct installation on Arch Linux is not recommended since it involves rebuilding some community packages for static libraries.

It is strongly recommended to mount tmpfs on /tmp by adding tmpfs /tmp tmpfs rw,nosuid,nodev in /etc/fstab.

Settings

Website Settings

Settings such as password recovery, Sentry monitoring and some optional features (such as allow Unicode usernames or disabling registration) can be adjusted by modifying config/settings.yml. See config/settings.yml.example for the format.

Admin Control Panel

TIOJ has an admin control panel located at /admin (powered by Active Admin), which has an independent authentication system. The default admin username and password are both admin (set in db/seeds.rb and created when running rails db:seed). Be sure to change it in the Admin Users tab before exposing the website!

The only recommended purpose of the control panel are to set users to be admin accounts (in the Users tab), reset user passwords, and view the website data. Directly editing other data in the admin interface is not recommended.

To do ordinary judge management such as problem setting, testdata uploading, and article creation, set an account to be an admin account and do them directly in the website.

It is possible to have multiple judge clients by setting up the fetch keys in the Judge Servers tab in the control panel.

Clone this wiki locally