Mandatory Assignment 2

DHIS2 instance

Local instance

We recommend running a local instance of DHIS2 on your machine, as this will make general debugging easier, and also be helpful in the group project. Setting up your own local instance is not a requirement for the course and you can use demo instances if you do not want to deal with additional software on your machine.

Demo instance

You can also use one of the demo instances that DHIS2 provides for everyone to play around with.

Due to recent web browser security standard changes, connecting from a local development app to a remote server is blocked on most servers unless the server explicitly provides the correct CORS and SameSite cookie headers.

We can work around these security measures by manually modifying some browser settings such that the security measures are disabled. This, however, is obviously not optimal; security restrictions are there for our safety.

We can instead use a tool that runs on our local machine and proxies all requests to one of the demo servers. The dhis-portal tool does exactly this; it creates a proxy to a DHIS2 instance and makes a remote server seem like a local instance.

Installation of the dhis-portal tool is straight forward.

// yarn
yarn global add dhis-portal
// npm
npm install --global dhis-portal

We can then run the below command in our terminal

dhis-portal --server=play --instance=2.34.1

and a local web server will start running at the default port (9999) that proxies all requests from http://localhost:9999 to https://play.dhis2.org/2.34.1.

Server URL and credentials

When you run yarn start inside your React project folder, you'll be met with a login screen that asks for a server URL, username and password.

DHIS2 application platform login dialog
DHIS2 application platform login dialog

Local instance

If you're running a local instance, your server URL is going to be (unless you modified any of the default values)

http://localhost:8080

with the username

admin

and password

district

Demo instance using dhis-portal

The dhis-portal tool by default runs the web server at port 9999, so your server URL is going to be

http://localhost:9999

with the username

admin

and password

district