-
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
- 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.
-
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.
-
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
.
-
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-staging.toki.id 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. -
Run Sandalphon locally, run
../gradlew runPlayBinary
. -
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.
To be able to 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-staging.toki.id 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.
-
java.lang.IllegalStateException: Could not find a valid Docker environment.
when running./gradlew check
- This is due to the Docker not setup yet—we can ignore Docker errors for now.
-
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)