Skip to content
DHIS2.org Community GitHub

Enabling Optional Model Services

Some models require an external service to be running alongside Chap. These services are not started by default but can be enabled using a Docker Compose overlay file.

Note

This page covers models that are not part of the bundled overlay. The bundled model services started by compose.chapkit.yml (see First-time Setup) register themselves automatically and need no config edits or rebuild. Use the steps below only for additional services like ewars_plus or chtorch.

Available Optional Services

Service Image Port Description
ewars_plus maquins/ewars_plus_api:Upload 3288 EWARS Plus R-based prediction API
chtorch ghcr.io/dhis2-chap/chtorch:chapkit2-8f17ee3 5001 Deep learning model using chapkit

Setup

Chap ships with a compose.override.yml.example file that defines these optional services. Docker Compose automatically merges compose.override.yml with compose.yml when both are present.

1. Copy the overlay file

cp compose.override.yml.example compose.override.yml

2. Edit the overlay (optional)

Open compose.override.yml and remove any services you do not need. For example, to enable only EWARS Plus:

services:
  ewars_plus:
    image: maquins/ewars_plus_api:Upload
    container_name: ewars_plus
    ports:
      - "3288:3288"

3. Add the model to configured models

The model also needs to be registered so that Chap seeds it on startup. Create or edit a YAML file in config/configured_models/ (do not edit default.yaml):

# config/configured_models/local.yaml
- url: https://github.com/dhis2-chap/ewars_plus_python_wrapper/
  versions:
    v1: "@modeling_app_test"

See Managing models for details on the configured models format.

4. Rebuild and start

After adding the overlay and the model configuration, rebuild the Chap images (so the new config is included) and start all services:

docker compose build chap worker
docker compose up -d

5. Verify

Check that the service is running and the model appears in the API:

docker compose ps
curl http://localhost:8000/v1/crud/configured-models

The model (e.g. ewars_plus) should appear in the list of configured models.