Docker Compose (CHAP Core)¶
Starting CHAP Core using Docker Compose is specifically for those who want to use the CHAP Core REST-API, either together with other services or with the Prediction App installed on a DHIS2 server. See documentation for Prediction App for instructions on how to install the Prediction App.
Requirements
Access to credentials for Google Earth Engine. (Google Service Account Email and Private Key)
1. Install Docker (if not installed)¶
Docker is a platform for developing, shipping, and running applications inside containers.
To download and install Docker, visit the official Docker website: https://docs.docker.com/get-started/get-docker
2. Clone CHAP Core GitHub-Repository¶
You need to clone the CHAP Core repository from GitHub. Open your terminal and run the following command:
git clone https://github.com/dhis2-chap/chap-core.git
3. Add Credentials for Google Earth Engine¶
Open your terminal and navigate to the “chap-core” repository you cloned:
cd chap-core
Open the “chap-core” repository in your code editor. For example, if you are using Visual Studio Code, you can use the following command in the terminal:
code .
In your code editor, create a new file at the root level of the repository and name it
.env
.Add the following environment variables to the
.env
file. Replace the placeholder values with your actual Google Service Account credentials:GOOGLE_SERVICE_ACCOUNT_EMAIL="your-google-service-account@company.iam.gserviceaccount.com" GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----<your-private-key>-----END PRIVATE KEY-----"
4. Start CHAP Core¶
At the root level of the repository (the same level you placed the .env-file), run:
docker-compose up
This will build three images and start the following containers:
A REST-API (FastAPI)
A Redis server
A worker service
You can go to http://localhost:8000/docs to verify that the REST-API is working. A Swagger page, as shown below, should display:
5. Stop CHAP Core¶
docker-compose down