Skip to content

Machine Learning

Cody Finegan edited this page Sep 5, 2024 · 2 revisions

There is a container for running the Totara Machine Learning service.(https://help.totaralearning.com/display/DEV/Machine+Learning+%28ML%29+Service).

Because Machine Learning is targeted at a single Totara instance, we can't make it a single container that can run all sites at once, but it can be configured via the .env file to target a single Totara instance.

Currently the Docker image also belongs to Totara, not Totara Docker, and it ties to a specific release, so if changing versions you'll have to rebuild the image again.

This version is only for the T15+ ml_service.

To try it out:

  1. Edit your Totara site config.php and add the following:
$CFG->ml_service_url = 'http://ml-service:5000';
$CFG->ml_service_key = 'totara';

It must be ml-service, as this is the internal domain name that docker uses to resolve the instance. Ditto for the port, 5000 is what ML expects via the internal network.

  1. Edit the .env file in your copy of the totara-docker-dev project and add the following:
ML_TOTARA_PROJECT=/path/to/totara/root - This needs to point at the base (not /server) of one Totara project
ML_TOTARA_URL=http://totara73/project/server
  1. Run tup ml-service or tdocker up ml-service. Note on a Mac you may need to change the default port or turn off the AirPlay receiver which is running on port 5000 by default. See https://developer.apple.com/forums/thread/682332.

  2. Check you can access http://localhost:5050 and you see the ML service homepage.

  3. Connect to your PHP container, and then run php server/ml/service/cli/healthcheck.php from the Totara project root. This will confirm if the two-way connection is running successfully. If this fails with "Unable to communicate with Totara" and your site is running in subdirectories or an otherwise different domain, you will need to add aliases to the server container config (compose/nginx.yml for nginx or compose/apache.yml for apache). Then tdown the server and ml-service and restart for changes to take effect.

Clone this wiki locally