Skip to content
Snippets Groups Projects

Moodle Autograde plugin

⚠️ The following readme is yet to be completed. For now, it contains basic information about the repository.

Set up locally

  • Clone the repository using the following command:
    git clone --recursive git@github.com:hamzaremmal/moodle-autograde.git
  • Install minikube and kubectl on your machine.

Test your environment

  • Start minikube with the following command:

    minikube start --driver=docker
    • This will automatically switch your kubectl context to minikube.
      But you should also switch the namespace to grading-service with the following command:

      kubectl config set-context minikube --namespace=grading-service
    • You can view the Kubernetes dashboard with the following command:

      minikube dashboard
  • Build the grading service image with the following commands:

    • Switch to minikube docker environment
      eval $(minikube -p minikube docker-env)
    • Build the grading-service Spring app image
      docker build -t ghcr.io/hamzaremmal/moodle-autograde/moodle-grading-service:latest moodle-grading-service/
    • Build the Moodle (including autograder-plugin) image
        docker build -t moodle-with-autograde -f Dockerfile-moodle-with-autograde ./
  • Configure the dotenv file k8s/deploy-envs/local/grading-service-variables.env with the following content:

    API_KEY= <Add the autograde service API-KEY>
    
    MOODLE_BASE_URL= <Add the moodle base url, `http://moodle:80` if you are using the local environment>
    MOODLE_AUTOGRADE_TOKEN= <Add the autograde moodle token>
    
    GRADING_SERVICE_NAME= <Add the name with which the grading-service is deployed, by default it is `grading-service-tcp`>
    
    GRADING_SERVICE_LOG_LEVEL= <Add the log level, recommend to set `DEBUG` for local env>
  • Deploy the environment with the following command:

    kubectl apply -k k8s/deploy-env/local
  • If you update the grading-service or autograder-plugin, you will need to:

    • Build the grading-service image
    • Update the grading-service deployment with the following command:
      kubectl rollout restart deployment grading-service

    • Build the autograder-plugin image
    • Update the moodle deployment with the following command:
      kubectl rollout restart statefulset moodle
  • Kill everything with one command:

    kubectl delete -k k8s/deploy-env/local
    • Stop minikube with the following command:
      minikube stop
    • Delete the minikube cluster with the following command:
      minikube delete
  • To access the services, you will need to:

    • Add the following lines to your /etc/hosts file:
      localhost    moodle-tcp
    • Start a new terminal session and run :
      sudo minikube tunnel
      This will ask for your password because it configures network routing on your machine.
    • Access Moodle via http://moodle-tcp:80
    • Ping the grading service with http://localhost:8082/api/v1/ping/no-auth

ℹ️ When accessing Moodle for the first time, you will need to install it. This step is pretty simple as all the links with the database are already configured (See config.php ;-) )

Support

Contact the support team at autograde-support@groups.epfl.ch for any questions or issues.