# Charon plugin Plugin is running on [moodle.taltech.ee](https://moodle.taltech.ee/). Source code is in [gitlab](https://gitlab.cs.ttu.ee/ained/charon). Thesis is in [digikogu.taltech.ee](https://digikogu.taltech.ee/et/Item/459405a1-5f63-4c08-b575-629e9db4af47). Wiki is at [gitlab](https://gitlab.cs.ttu.ee/ained/charon/-/wikis/home). ## Architecture ![stack](stack.png) ## Flows in Charon ### Submission testing flow Charon is a link between Gitlab and Arete. Whenever a student pushes to a repository a webhook is triggered and the event is sent to https://moodle.taltech.ee/mod/charon/api/git_callback. There Charon extracts gradable exercises ands sends the information with additional information to Arete. Once the testing is complete, Arete sends the result back to Charon where it is saved. ![testing flow](./run_tests.png) Here is what happens inside when receiving git callback: ![git callback](./groupSubmissionSequence.png) Tester callback: ![git callback](./testerCallbackSequence.png) ### Creating a Charon through UI [Videos](https://gitlab.cs.ttu.ee/ained/charon/-/wikis/Charon-video-tutorials) demonstrate the configuration for certain Charon parts ### Defence flow Defence flow [functional requirements](https://gitlab.cs.ttu.ee/ained/charon/-/wikis/Defending). ### Future Future [nice-to-haves](https://gitlab.cs.ttu.ee/ained/charon/-/wikis/Future). ## Creating Charons through CLI Seeder now allows to choose a course, section under that course and a grade preset to populate the database with a given number of charons, together with its grade category, grademaps and grade items. Formula calculation multiplies grade items from preset. Run the following command in `/mod/charon` folder ``` php artisan db:seed --class=CharonSeeder Enter course ID: > 2 Choose a preset: [1] Tests and style [1] [2] Tests and defense [2] [3] Tests, style and defense [3] > 3 Choose a section: [1] Topic 0 (visible) [1] [2] Name of topic (visible) [2] [3] Topic 2 (visible) [3] [4] Topic 3 (visible) [4] [5] Topic 4 (visible) [5] > 5 Enter a number of charons [1]: > 2 [2020-11-20 22:04:43] develop.INFO: Creating a grade map: [{"grademap_name":"eos - Tests","max_points":"1.00","id_number":"eos_Tests"}] [2020-11-20 22:04:43] develop.INFO: Creating a grade map: [{"grademap_name":"eos - Style","max_points":"1.00","id_number":"eos_Style"}] [2020-11-20 22:04:43] develop.INFO: Creating a grade map: [{"grademap_name":"eos - Defense","max_points":"1.00","id_number":"eos_Defense"}] Successfully linked grades for Charon 241 [2020-11-20 22:04:43] develop.INFO: Creating a grade map: [{"grademap_name":"iure - Tests","max_points":"1.00","id_number":"iure_Tests"}] [2020-11-20 22:04:43] develop.INFO: Creating a grade map: [{"grademap_name":"iure - Style","max_points":"1.00","id_number":"iure_Style"}] [2020-11-20 22:04:43] develop.INFO: Creating a grade map: [{"grademap_name":"iure - Defense","max_points":"1.00","id_number":"iure_Defense"}] Successfully linked grades for Charon 242 ``` ## Deploying in a new Moodle instance ````bash #!/usr/bin/env bash # Run this file in Moodle server as root from /srv/moodle directory SRC=/srv/moodle DEST=/srv/moodle/public_html/mod/charon die () { echo >&2 "$@" exit 1 } if [ "$#" != 1 ]; then printf "1 argument required, $# provided. Argument can be test or live.\n\ test - moodle-test\n\ live - moodle-live" die fi ENV=$1 # environment if [ -d "$SRC/charon" ]; then rm -r "$SRC/charon" fi if [ -f "$SRC/artifacts.zip" ]; then rm "$SRC/artifacts.zip" fi curl -v -X GET --header "PRIVATE-TOKEN: $(cat .charon_token)" -o artifacts.zip "https://gitlab.cs.ttu.ee/api/v4/projects/216/jobs/artifacts/master/download?job=create_production_artifacts" unzip artifacts.zip chmod -R 0755 "$SRC/charon" find "$SRC/charon" -type f -exec chmod 0644 {} \; chown -R moodle:http "$SRC/charon" cp -rT charon "$DEST" chown -R moodle:http /srv/moodle/public_html/mod/charon chmod -R 775 /srv/moodle/public_html/mod/charon/plugin/storage find /srv/moodle/public_html/mod/charon/plugin/storage -type f -exec chmod 0664 {} \; sh clear_opcache.sh $ENV cd /srv/moodle/public_html echo "y" | php admin/cli/upgrade.php # answer "y" to prompt php admin/cli/purge_caches.php cd mod/charon php artisan key:generate php artisan db:seed --force ````