-
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
- Setting up Jerahmeel
- Running the microservices
- Optional: setting up Sandalphon (staging)
- Optional: setting up Sandalphon (locally)
- Optional: setting up Sealtiel
- Miscellaneous
- Troubleshooting
-
Java 8 JDK
- Earlier or later versions of Java might not work.
-
MySQL 5.7
- Earlier or later versions of MySQL might not work.
- Yarn 1.3+
- Docker
-
IntelliJ IDEA
- Community Edition is sufficient.
-
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 (except for Docker errors, see the Troubleshooting section below).
-
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.
-
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.
-
Go to Judgels repository root.
-
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 all occurrences of jophiel
to uriel
.
The steps are similar to Jophiel's above. Just replace all occurrences of jophiel
to jerahmeel
.
Additionally, untar the tar.gz files from seeds/jerahmeel/var/data/*
to jerahmeel-dist/var/data/
, to be able to see submission files.
-
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.
-
Similary, run Jerahmeel server. By default, it will listen to port 9005.
-
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 and Jerahmeel 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-staging.toki.id clientJid: JIDSACL-uriel clientSecret: sandalphon-staging
-
Verify that you can view the problems in the contests.
-
Do the similar steps for Jerahmeel.
You can also run Sandalphon from source locally.
-
Create a new local database called
judgels_sandalphon
. -
Go to Sandalphon directory (
judgels-backends/judgels-play/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. -
Run Sandalphon locally, run
../../gradlew runPlay
. -
To connect Uriel and Sandalphon, edit the config file
judgels-backends/uriel/uriel-dist/var/conf/uriel.yml
. Underuriel:
, set thesandalphon:
keys as follows:sandalphon: baseUrl: https://localhost:9002 clientJid: JIDSACL-uriel-local clientSecret: sandalphon-local
-
Now, you can access Sandalphon at
localhost:9002
to add problem and insert into contest. -
Do similar steps for Jerahmeel.
To be able to submit solutions, you can connect your Uriel to TOKI's staging Sealtiel as follows:
NOTE: Sealtiel in staging might be down from time to time for resource saving. These steps MIGHT FAIL.
-
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-staging.toki.id clientJid: JIDSECL-uriel clientSecret: sealtiel-staging
-
Verify that you can submit solutions in the contests.
-
Do similar steps for Jerahmeel.
- 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.
-
Error: EMFILE: too many open files, watch
on macOS when runningyarn test
-
To fix this, run:
brew install watchman
See https://github.com/facebook/create-react-app/issues/4540 for more details.
-
-
java.lang.IllegalStateException: Could not find a valid Docker environment.
when running./gradlew check
- This is due to the Docker not set up yet. Docker is required for running Sealtiel integration tests. This is not blocking if you don't want to install Docker.
-
java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'.
when running../gradlew dbMigrate
- Please make sure that you are using MySQL 5.7 (and not later versions)
-
error: method transform in class Lists cannot be applied to given types
when running./gradlew check
- This is compilation error when using Java version
1.8.0_25
, not sure which exact minimum version that compiles successfully but Java version1.8.0_201
works.
- This is compilation error when using Java version