20.2. Architecture

The figure below shows the main components involved in a DHIS2 system.

Figure 20.1. Single machine all-in-one installation


The dhis2-tools are primarily concerned with the creation and managing of the tomcat instances which deliver the web application. As you can see in the diagram there may be one or more of these. In addition the system requires a postgresql database server and an nginx web proxy server. There are many possible configurations where these can be running on a different server than the dhis2 instances. These tools for the most part assume that they are all installed together on the one machine. Some customisation is required to separate them.

When an instance is created with the dhis2-create-instance command, a new user is created with the name of the instance (lets say its called hmis). The home directory of that user is located at /var/lib/dhis2/hmis. A database role is created also called hmis together with a database with the name of hmis. The DHIS2_HOME environment variable for the instance is set to the same home directory of the user.

The essential components of a standalone tomcat instance are also created within the same directory (modelled after the ubuntu tomcat7-user package). The web.xml file of that tomcat instance has been customized to allow an upstream web proxy server (such as nginx) to cache the static content of the dhis2 application.

The user will also have a crontab configuration automatically setup to manage daily backups, start on computer restart and log file rotation.

Note that postgresql optimization, as described in the dhis2 user documentation, is not managed by this package and needs to be done as a post-installation step.