Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

A DHIS2 on its own

A DHIS2 instance and its database, nothing else: for trying a DHIS2 version, developing an app, or restoring a database dump to look at it.

chap-devops init dhis --only dhis2
cd dhis
chap-devops up                     # returns when the containers start
chap-devops status                 # run it again until the dhis2 line says up
chap-devops open dhis2

You get DHIS2 on http://localhost:8780, with its own PostgreSQL, and no chap-core, OCS or models.

chap-devops up prints started dhis2, dhis2-db when the containers start. The first chap-devops up also pulls the images, about 2 GB on disk, and downloads the demo database, about 7 MB. DHIS2 then needs more time before it answers: less than a minute on a fast machine, several minutes on a slow one. Until then, chap-devops status shows this and exits with 1:

dhis2   starting   http://localhost:8780

1 of 1 component is still starting; run `chap-devops status` again in a moment

It worked when chap-devops status shows this, and the login admin / district works in the browser:

dhis2   up   http://localhost:8780

dhis2 is up

DHIS2 needs about 4 to 5 GB of memory; give Docker 8 GB or more.

Picking the version

--dhis2-tag picks the DHIS2 version, and --dhis2-seed what its database starts from:

VersionCommandDatabase it starts with
2.42 (the default)chap-devops init dhis --only dhis2the Laos climate demo
2.43chap-devops init dhis --only dhis2 --dhis2-tag 2.43empty
2.41chap-devops init dhis --only dhis2 --dhis2-tag 2.41empty
the next, unreleasedchap-devops init dhis --only dhis2 --dhis2-image dhis2/core-dev --dhis2-tag masterempty

Each command makes a new deployment dhis, and so do the commands in the next section. If dhis already exists, init stops with already contains a chap-devops deployment; choose another directory, or use --force to overwrite it. Use a different name.

A full version such as --dhis2-tag 2.42.6 works too. chap-devops has a demo database for 2.42 only, so 2.42 and every 2.42.x get it. Every other version starts empty, and init tells you so:

warning: chap-devops knows no DHIS2 demo dump for 2.43, so `dhis2_db` starts empty; name one with `seed:` in `.chap-devops/components.yaml` (a URL or a path) and run `chap-devops sync`

An empty DHIS2 still has the admin / district login, as a superuser. A version that is not on the machine yet adds a pull of 1 to 1.5 GB to the first chap-devops up.

Picking the data

chap-devops init dhis --only dhis2 --dhis2-seed none                  # empty, whatever the version
chap-devops init dhis --only dhis2 --dhis2-seed dumps/mine.sql.gz     # your own dump, a path
chap-devops init dhis --only dhis2 --dhis2-seed dumps/mine.sql.gz \
  --dhis2-seed-password                                         # every user logs in with district
chap-devops init dhis --only dhis2 --dhis2-tag 2.43 \
  --dhis2-seed https://databases.dhis2.org/sierra-leone/2.43/dhis2-db-sierra-leone.sql.gz

A relative path is relative to the deployment directory, not to the directory you run init in. For the commands above, put the dump at dhis/dumps/mine.sql.gz before chap-devops up. Until the dump is there, init tells you:

warning: the dhis2 seed names dumps/mine.sql.gz, which is not in /path/to/dhis; copy the dump there before `chap-devops up`, or run `chap-devops components enable dhis2 --seed none`

The seed is applied once, when the database is first created; after that the database is DHIS2’s. DHIS2’s Sierra Leone demo is published for 2.41, 2.42 and 2.43 at that address pattern, and the first chap-devops up downloads about 90 MB for it. It has no climate data, and its admin is not a superuser: it cannot create the route the Modeling App uses, so pick it for a DHIS2 on its own, not for one you will connect to Chap.

A dump of a real DHIS2 keeps the passwords of its users. --dhis2-seed-password gives every user the password district, turns on every account and turns off two-factor login, so you can log in as any of them. See One password for every user.

Next

chap-devops dhis2 connect refuses here, since there is no chap-core to connect to:

error: chap-core is not a component of this deployment, so the route would point at a service that is not there; run `chap-devops components enable chap-core` first

chap-devops dhis2 show works here. Its target row says none (this deployment has no chap-core), and it names no chap-devops dhis2 connect. When the apps or the analytics tables are missing, its last line is:

run `chap-devops dhis2 apps` for the apps, then `chap-devops dhis2 analytics` for the analytics tables; the `chap` route needs chap-core; `chap-devops components enable chap-core` adds it

chap-devops components enable chap-core adds one, then chap-devops up starts it, and Chap with a local DHIS2 is that shape from the start. More: The seed, Changing the DHIS2 version, Memory.

All shapes: Use cases.