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.

To add a model service of your own, see Running Your Own Model.

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.

Pass -f compose.override.yml explicitly

Compose only merges compose.override.yml on its own when you run a bare docker compose with no -f flags at all. As soon as you pass any -f — as First-time Setup does — the override file is ignored, silently and with no error, so the optional services never start. The commands below assume the compose.chapkit.yml overlay from that guide; adjust them to match how you started Chap, keeping compose.override.yml last.

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: "@<commit-sha>"  # the full sha of the commit to run; branches are rejected

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 -f compose.yml -f compose.chapkit.yml -f compose.override.yml build chap worker
docker compose -f compose.yml -f compose.chapkit.yml -f compose.override.yml up -d

5. Verify

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

docker compose -f compose.yml -f compose.chapkit.yml -f compose.override.yml ps
curl http://localhost:8000/v1/crud/configured-models

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