-
Notifications
You must be signed in to change notification settings - Fork 25
Dev's Guide: Running from source
This section explains how to run the Judgels platform locally from source, with default configuration. This is a good starting point for new developers to ensure that they can run Judgels on their machine.
- Prerequisites
- Setting up backend project
- Setting up frontend project
- Setting up Jophiel
- Setting up Uriel
- Running the microservices
- Optional: setting up Sandalphon (staging)
- Optional: setting up Sandalphon (locally)
- Optional: setting up Sealtiel
- Miscellaneous
- Java 8 JDK
- MySQL 5.7+
- Yarn 1.3+
- Docker
- IntelliJ IDEA
-
Go to the backend directory (
judgels-backends
). -
Run:
./gradlew check
This will download all required JAR dependencies, and run all unit and integration tests. Note that it may take quite a while for the first time.
-
Make sure the tests pass before moving on to the next sections.
-
Go to Raphael directory (
judgels-frontends/raphael
). -
Copy the example config:
cp public/var/conf/raphael.js.example public/var/conf/raphael.js
-
Run:
yarn && yarn test
This will download all required NPM dependencies and run the tests. Note that it may take quite a while for the first time.
-
Make sure the tests pass before moving on to the next sections.
-
If you get
Error: EMFILE: too many open files, watch
on macOS, run:brew install watchman
See https://github.com/facebook/create-react-app/issues/4540 for more details.
-
-
Create a new local database called
judgels_jophiel
. -
Go to Jophiel directory (
judgels-backends/jophiel
). -
Copy the example config:
cp jophiel-dist/var/conf/jophiel.yml.example jophiel-dist/var/conf/jophiel.yml
-
Open the config file
jophiel-dist/var/conf/jophiel.yml
. -
Under
database:
, modifyurl
,user
, andpassword
as necessary. -
Run database migration:
../gradlew dbMigrate
. -
Verify that there are tables generated in the database.
-
Import the seed data (
seeds/judgels_jophiel.sql
) to the database. -
Verify that there data generated in the database.
The steps are similar to Jophiel's above. Just replace replace all occurrences of jophiel
to uriel
.
-
Run Jophiel server:
- Go to
judgels-backends/jophiel
. - Run:
../gradlew run
. - By default, it will listen to port 9001.
- To make sure that it is running correctly, hit the version endpoint:
http://localhost:9001/api/v2/version
. It should return the current version string.
- Go to
-
Similary, run Uriel server. By default, it will listen to port 9004.
-
Run Raphael server:
- Go to
judgels-frontends/raphael
. - Run:
yarn start
. - By default, it will open your default web browser and navigate to
http://localhost:3000
.
- Go to
-
Make sure that you can see the Judgels homepage with no errors.
-
Log in to Judgels using superadmin account (username:
superadmin
, password:superadmin
). -
Make sure that you can log in successfully.
Congratulations, you have successfully run Judgels from source!
To be able to view problems, you can connect your Uriel to TOKI's staging Sandalphon as follows:
-
Go to Uriel directory (
judgels-backends/uriel
). -
Open the config file
uriel-dist/var/conf/uriel.yml
. -
Under
uriel:
, set thesandalphon:
keys as follows:sandalphon: baseUrl: https://sandalphon.tlx.toki-staging.org clientJid: JIDSACL-uriel-staging clientSecret: sandalphon-staging
-
Verify that you can view the problems in the contests.
You can also run Sandalphon from source locally.
-
Create a new local database called
judgels_sandalphon
. -
Go to Sandalphon directory (
judgels-legacy/sandalphon
). -
Copy the example config:
cp conf/application_default.conf conf/application.conf
-
Open the config file
application.conf
. -
Under
db.default
, modifyurl
,username
, andpassword
as necessary. -
Under directory
judgels/judgels-legacy
create directoryvar/data
-
Run Sandalphon locally, run
../gradlew runPlayBinary
. -
Open
localhost:9002
then login so that a new user registered in tablejudgels_sandalphon.sandalphon_user
as a guest. -
From new registered user, change it's role from
user
intouser,admin
-
Reload role changing by logout and login.
-
From Sandalphon app, click Client, copy
JID
andsecret
into filejudgels/judgels-backends/uriel/uriel-dist/var/conf/uriel.yml
underdatabase:
. -
Now, you can add problem and insert into contest.
To be able to view submit solutions, you can connect your Uriel to TOKI's staging Sealtiel as follows:
-
Go to Uriel directory (
judgels-backends/uriel
). -
Open the config file
uriel-dist/var/conf/uriel.yml
. -
Under
uriel:
, set thesealtiel:
keys as follows:sealtiel: baseUrl: https://sealtiel.tlx.toki-staging.org clientJid: JIDSECL-uriel-staging clientSecret: sealtiel-staging
-
Verify that you can submit solutions in the contests. Note that currently, your solutions won't be graded yet.
- The seed data contains a
superadmin
and 6 users with the following usernames:andi
,budi
,caca
,dudi
,emir
,fuad
. Passwords are equal to the usernames.