Skip to main content

Migrating from v2 to v3

A. Summary​

We can upgrade from v2 to v3 in place, reusing the same VMs and database. We will need to do the following by hand:

  1. Deploy using the new deployment/v3-ubuntu-24.04 directory, after renaming or removing some variables in env/vars.yml.
  2. Re-enter the app name, slogan, home banner, announcements and session limits in the Admin tab. They are moved from the config files to the database, and will not be migrated automatically.

Everything else is migrated automatically on deploy:

  • The database gets a new judgels_setting table, for the settings above.
  • Grading is moved to new RabbitMQ queues.

There is also a breaking API change: the user role fields are renamed; see User roles.

B. Backing up existing config​

Back up env/vars.yml. Some of its settings will not be migrated, and we will need their values to re-enter them later.

If you have set any announcements, also copy jophiel.web.announcements from /opt/judgels/server/var/conf/judgels-server.yml in the core VM.

C. Deploying Judgels v3​

  1. Pull the latest Judgels repository, and link the existing env directory as env in deployment/v3-ubuntu-24.04/ansible. The hosts.ini file does not need any changes.

  2. In env/vars.yml, set the Judgels version, rename two variables, and remove the ones that are moved to the database:

    -app_version: '2.23.0'
    +app_version: '3.0.0'

    -jophiel_superadmin_initialPassword: ...
    +superadmin_initialPassword: ...
    -gabriel_grading_numWorkerThreads: ...
    +grading_numWorkerThreads: ...

    -app_name: ...
    -app_slogan: ...
    -app_title: ...
    -app_description: ...
    -app_footer: ...
    -jophiel_session_maxConcurrentSessionsPerUser: ...
    -jophiel_session_disableLogout: ...

    app_footer is removed for good: the footer is now always "Powered by Judgels". Any other variables with the jophiel_, gabriel_, or jerahmeel_ prefix are ignored in v3.

Then, run the deploy playbook:

ansible-playbook -e @env/vars.yml playbooks/deploy.yml

This will deploy the server, client, and graders together, and migrate the database automatically. We don't need to rerun the provision playbook.

D. Restoring settings​

Open the contestant web interface and log in as superadmin. Go to the Admin tab, then System → Settings. Re-enter the values from the backed up env/vars.yml:

SettingFrom
App nameapp_name
App sloganapp_slogan
App announcementjophiel.web.announcements in judgels-server.yml
Home bannerapp_title and app_description
Disable logoutjophiel_session_disableLogout
Max concurrent sessions per userjophiel_session_maxConcurrentSessionsPerUser

E. Verifying​

  1. Verify that we can log in as superadmin in the admin web interface.
  2. Verify that the contestant web interface shows the correct app name and home banner.
  3. Submit a solution to a contest problem, and verify that it gets graded.

At this point, Judgels v3 should be fully operational.

F. Cleaning up​

  1. (Optional) We can remove the remaining variables with the jophiel_, gabriel_, or jerahmeel_ prefix from env/vars.yml, which are no longer used.
  2. (Optional) We can remove the following unused queues from the RabbitMQ management web interface:
    • gabriel-grading-request
    • sandalphon-grading-response
    • uriel-grading-response
    • jerahmeel-grading-response

G. What changed​

Settings in the database​

The following settings are now managed in the Admin tab, under System → Settings, instead of in the config files:

Settingv2
App name, slogan and home bannerenv/vars.yml
Announcementsjudgels-server.yml
Session limitsenv/vars.yml

They are stored in a new judgels_setting table, which is created by the deploy playbook.

Account and role management​

Accounts and roles are now managed in the Admin tab of the contestant web interface, instead of in the admin web interface.

Ansible variables​

The jophiel_, gabriel_, and jerahmeel_ prefixes are dropped. jophiel_superadmin_initialPassword and gabriel_grading_numWorkerThreads are renamed to superadmin_initialPassword and grading_numWorkerThreads; the others are either moved to the database or no longer used.

Grading queues​

v2v3
gabriel-grading-requestjudgels-grading-request
sandalphon-grading-responsejudgels-grading-response-problem
uriel-grading-responsejudgels-grading-response-contest
jerahmeel-grading-responsejudgels-grading-response-training

User roles​

In the user role API, the role fields are renamed after the layers:

v2v3
jophielaccount
sandalphonproblem
urielcontest
jerahmeeltraining