Skip to content

Installation instructions (development environments)

Vinícius B. Matos edited this page Mar 3, 2025 · 2 revisions

The page contains installation instructions for development environments. The plugin directories are mapped to the Moodle installation in real time; thus, changes are applied immediately. Do not follow these steps on production environments.

Pre-requisites

A Linux installation with Docker.

Installation steps

Clone or download this repository, and open a terminal in its root directory (which contain the README file). Follow the steps below:

  1. Clone the repositories of HarpIA Ajax and HarpIA Interaction under src/plugins/ by running ./src/plugins/clone_dev.sh.
  2. Install Docker. Then, build the image:
docker build -t harpia-survey-dev:1.0 -f containers/dev/Dockerfile .
  1. Create an empty directory where data will be stored, and take note of its location.
    IMPORTANT: In the next steps, write the absolute path or the path relative to the containers/dev/ directory.

  2. Define the the HarpIA Survey home page address, which is the URL that users will access. The address has a protocol (http:// or https://), a subdomain/domain or IP, a port (if not the default for the protocol) and path (optional, empty by default):

    • in a local environment available on a single computer, this address will look like http://localhost:8080/ (the port can be changed);
    • in a server accessible from other computers (via the internet or a local network), the address may look like:
      • https://yourwebsite.example.com/;
      • https://yourwebsite.example.com:8080/;
      • http://192.168.99.99:8080/.
  3. Run initial Moodle setup (replace <DATADIR> with the directory defined in step 3, <ADDRESS> with the address explained in step 4, and <PORT> with the chosen port):

    HARPIA_MOODLE_ADDRESS=<ADDRESS> HARPIA_DATA_DIR="<DATADIR>" HARPIA_MOODLE_PORT=<PORT> docker compose run harpia_moodle_setup

    Example:

    HARPIA_MOODLE_ADDRESS=http://localhost:8080/ HARPIA_DATA_DIR="/somewhere/data/dev" HARPIA_MOODLE_PORT=8080 docker compose -f containers/dev/compose.yml run harpia_moodle_setup

    When prompted, type the password of the first account that will be created (the administrator), whose username is harpia_admin by default (to user another username, add the HARPIA_ADMIN_USER variable to the command above). Then, the initial Moodle set up will be executed, and it may take several minutes.

  4. Start the server container (replace <PORT> with the desired port, the same used in step 4, and replace <DATADIR> with the directory defined in step 3):

    HARPIA_DATA_DIR="<DATADIR>" HARPIA_MOODLE_PORT=<PORT> docker compose -f containers/dev/compose.yml up

    Example:

    HARPIA_DATA_DIR="/somewhere/data/dev" HARPIA_MOODLE_PORT=8080 docker compose -f containers/dev/compose.yml up

    Note: the argument --add-host=harpia-model-gateway:host-gateway makes the host's localhost available as harpia-model-gateway.

  5. Open in your web browser the address defined in step 4.

    • Log in using the credentials chosen in step 5.
    • Fill in the form to complete the creation of the administrator's account and click Update profile.
  6. Make sure the HarpIA Model Gateway container is running and that the communication between the containers is not blocked by firewalls or system settings.

    When both containers are running, the following command can quickly show if the HarpIA Survey container can access the model gateway (replace the values accordingly). If it works, the model's output will be displayed.

    docker exec harpia-survey-dev curl -X POST http://harpia-model-gateway:42774/send -H "Content-Type: application/json" -d '{"query": "this is a test", "answer_provider": "ECHO"}'
  7. With Edit Mode enabled, go to Site administration > Plugins > Local plugins > HarpIA AJAX, and fill in the address of the HarpIA Model Gateway server (if the name in step 6 was kept and the default port was used for the gateway, the address is http://harpia-model-gateway:42774).

  8. Create user accounts, courses and activities. (TO DO: add detailed steps)

Clone this wiki locally