Skip to content

Dev's Guide: Running from source

Ashar Fuadi edited this page May 11, 2023 · 46 revisions

This page explains how to run Judgels locally from source.

Prerequisites

Running the server app

  1. Go to judgels-backends/judgels-server-app.

  2. Copy the example config file:

    cp var/conf/judgels-server.yml.example var/conf/judgels-server.yml
    
  3. Create a new local MySQL database called judgels.

  4. Open the config file var/conf/judgels-server.yml.

  5. Under database:, modify user and password as necessary so that we can connect to the judgels database.

  6. Run database migration:

    ../gradlew dbMigrate
    
  7. Verify that there are new tables generated in the database.

  8. Finally, run the server app:

    ../gradlew run
    
  9. Verify that we can open the server admin app at http://localhost:9101.

  10. Verify that we can log in as the default superadmin user (username: superadmin, password: superadmin).

Importing sample data

  1. Import the sample SQL data from seeds/judgels.sql to the judgels database.

  2. Still in judgels-backends/judgels-server-app, untar the *.tar.gz files from seeds/ to var/data:

    tar -xf ../../seeds/problems.tar.gz -C var/data/
    tar -xf ../../seeds/lessons.tar.gz -C var/data/
    tar -xf ../../seeds/submissions.tar.gz -C var/data/
    

The seed data contains:

  • 6 users with the following usernames: andi, budi, caca, dudi, emir, fuad. Passwords are equal to the usernames.
  • Sample problems, lessons, and submissions data.

Running the client app

  1. Go to judgels-client/raphael.

  2. Copy the example config:

    cp public/var/conf/raphael-v9.js.example public/var/conf/raphael-v9.js
    
  3. (Optional) If you are developing for TLX, open the config file (public/var/conf/raphael-v9.js) and change window.conf.mode to TLX.

  4. Install client app dependencies:

    yarn install
    
  5. Finally, run the client app:

    yarn start
    
  6. Verify that we can open the client app at http://localhost:3000.

Congratulations, you have successfully run Judgels from source!

Troubleshooting

  • Error: EMFILE: too many open files, watch on macOS when running yarn test

  • 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 version 1.8.0_201 works.