-
Notifications
You must be signed in to change notification settings - Fork 3
Home
D2-docker is a wrapper over docker and docker-compose that manages DHIS2 server instances from the command-line. D2-docker is implemented in Python 3 and provides both an executable and a Python module to extend from.
The CLI (command-line interface) resembles that of _docker-compose_, with a set of custom command needed to interact with DHIS2 instances. A user familiar with the docker infrastructure can still use docker to interact with the base infrastructure (containers, images, volumes, and so on) should they need to.
License: GNU GPL v3
D2-docker has been tested on GNU/Linux (specifically, Ubuntu 18.04 and Arch Linux), Windows 10 and MacOS X (10.14, Mojave). A typical DHIS2 instance takes around 4-8GB of RAM, so make sure you have that free memory for all the servers you are planning to run simultaneously.
External dependencies:
- Python >= 3.5 (with setuptools)
- Docker >= 18
- Docker compose >= 1.17
- RAM memory: At least 4Gb for instance, preferably 8Gb.
$ sudo apt install docker.io docker-compose python3 python3-setuptools
-
Install Python: https://www.python.org/downloads
NOTE: Please ensure that while installing, the checkbox asking for adding Python to PATH is checked
-
Install Docker Desktop: https://docs.docker.com/docker-for-windows/install
-
Configure Docker Desktop to give more memory to instance: Settings -> Advanced -> Memory: 6400 Mb (modify to meet your needs).
NOTE: If your computer has more than 2 CPUs, we encourage you to increase the CPUs to 4, making DHIS2 dockers run more softly.
NOTE 2: If, when starting a the d2-docker instance, there is an error about instace name that couldn't be found, you must access the docker application settings and uncheck the "use v3 version of docker-compose", the 2nd version corrects that problem.
Install Docker Desktop. Choose the correct version for your MAC Chipset. At the moment of writing this document Docker Desktop version is 4.23.0
In the Docker Desktop turn on the features:
- Use Rosetta for x86/amd64 emulation on Apple Silicon &
- File Sharing implementations should remain VirtioFS to enable virtualization
- Install python with homebrew
brew install python
brew postinstall python
- Install pip with homebrew
- Install pyenv and choose python version 3.9.16
Ensure that the correct version of python is run when running root commands as we will use root permissions on some of the commands. For example running:
sudo pyenv global 3.9.16
- Clone repository of d2-docker
https://github.com/EyeSeeTea/d2-docker.git
- Install requests
pip install requests
Modify local files to make the rest of the installation work
Modify the file src/d2_docker/docker-compose.yml to comment out the lines:
- ${DHIS_CONF}:/config/override/dhis2/dhis.conf and
- "${TOMCAT_SERVER}:/config/override/tomcat/server.xml"
It should look like this:
- Modify the file src/d2_docker/config/dhis2-core-start.sh to add a true fallback to the lines that copy files in the function setup_tomcat()
It should look like this:
Now the local environment should work. Start up a default empty image to test:
run
sudo python setup.py install
sudo d2-docker create core docker.eyeseetea.com/eyeseetea/dhis2-core:2.37.9 --version=2.37.9
sudo d2-docker create data docker.eyeseetea.com/eyeseetea/dhis2-data:2.37.9-sierra
sudo d2-docker start docker.eyeseetea.com/eyeseetea/dhis2-data:2.37.9-sierra
An DHIS2 instance should be available at localhost:8080
Note that if you will try to run an image that has capital letters, in the latest docker version you can not do it. So try to rename the image and follow the naming convention of the latest docker version.