Skip to content

Commit

Permalink
Merge branch 'main' into CU-86bygcqxd_Images-Placement-for-DataStore-…
Browse files Browse the repository at this point in the history
…Dashboards-Monitoring
  • Loading branch information
drizzentic committed May 21, 2024
2 parents cf9cf27 + 67e1a49 commit 806bef4
Show file tree
Hide file tree
Showing 35 changed files with 442 additions and 214 deletions.
6 changes: 3 additions & 3 deletions .env.cluster
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,18 @@ GF_SERVER_DOMAIN=grafana.domain
KC_POSTGRES_REPLICA_SET=pgpool-1:5432,pgpool-2:5432,pgpool-3:5432

# Client Registry - JeMPI
JEMPI_WEB_INSTANCES=3
JEMPI_WEB_INSTANCES=1
REACT_APP_JEMPI_BASE_API_HOST=https://jempi-api.domain
REACT_APP_JEMPI_BASE_API_PORT=50000
JEMPI_SESSION_SECURE=true
JEMPI_REPMGR_PARTNER_NODES=jempi-postgresql-01,jempi-postgresql-02,jempi-postgresql-03
JEMPI_REPMGR_PARTNER_NODES=jempi-postgresql-01
JEMPI_ASYNC_RECEIVER_INSTANCES=1
JEMPI_SYNC_RECEIVER_INSTANCES=1
JEMPI_PRE_PROCESSOR_INSTANCES=1
JEMPI_CONTROLLER_INSTANCES=1
JEMPI_EM_CALCULATOR_INSTANCES=1
JEMPI_LINKER_INSTANCES=1
JEMPI_API_INSTANCES=3
JEMPI_API_INSTANCES=1

# Resource limits
OPENHIM_MEMORY_LIMIT=4G
Expand Down
16 changes: 12 additions & 4 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,33 @@ jobs:
build-and-push:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push tag
if: ${{ github.ref_name != 'main' }}
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
push: true
tags: jembi/platform:${{ github.ref_name }}

- name: Build and push latest
if: ${{ github.ref_name == 'main' }}
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
push: true
tags: jembi/platform:latest
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ Each service's resource allocations can be piped into their .yml file through en
- Take note to not allocate less memory to ELK Stack services than their JVM heap sizes.
- Exit code 137 indicates an out-of-memory failure. When running into this, it means that the service has been allocated too little memory.

## Build multi-platform docker images
It's essential to make sure that any docker image should be available for multiple platforms : AMD, ARM, ... (not only linux, but MacOS as well). To do so you can follow the steps below :
1. Create your own custom builder by running `docker buildx create --name mycustombuilder --driver docker-container --bootstrap`
2. Ask docker to use this new builder for future builds by running `docker buildx use mycustombuilder`
3. Inspect buildx to see if docker has indeed switched builders to the new one you asked it to use by running `docker buildx inspect`
4. Then you can perform the build and push, for example : `docker buildx build --platform linux/amd64,linux/arm64 --push -t jembi/hapi:v7.0.3-wget .`

## Tests

Tests are located in `/test`
Expand Down
11 changes: 6 additions & 5 deletions client-registry-jempi/swarm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ function initialize_package() {
log info "Running package in PROD mode"
fi

if [[ "$CLUSTERED_MODE" == "true" ]]; then
dgraph_cluster_compose_param="docker-compose.dgraph-cluster.yml"
dgraph_zero_cluster_compose_param="docker-compose.dgraph-zero-cluster.yml"
combined_cluster_compose_param="docker-compose.combined-cluster.yml"
fi
# Jempi not working in clustered mode, temporarily disable
# if [[ "$CLUSTERED_MODE" == "true" ]]; then
# dgraph_cluster_compose_param="docker-compose.dgraph-cluster.yml"
# dgraph_zero_cluster_compose_param="docker-compose.dgraph-zero-cluster.yml"
# combined_cluster_compose_param="docker-compose.combined-cluster.yml"
# fi

(
log info "Importing JeMPI Kafka topics"
Expand Down
4 changes: 3 additions & 1 deletion config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
projectName: platform
image: jembi/platform:latest
image: jembi/platform:3.0.0-beta
logPath: /tmp/logs

packages:
Expand All @@ -24,6 +24,7 @@ packages:
- identity-access-manager-keycloak
- openhim-mapping-mediator
- database-postgres
- reprocess-mediator
- fhir-ig-importer

profiles:
Expand Down Expand Up @@ -74,3 +75,4 @@ profiles:
- openhim-mapping-mediator
envFiles:
- mpi.env

7 changes: 3 additions & 4 deletions documentation/recipes/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@

---
description: Pre-defined recipes for common use cases
---

# 📜 Recipes

OpenHIM platform comes bundles with a set of generic packages that can be deployed and configured to support a number of different use cases. To help users of OpenHIM Platform get started with something they can make use of immediately, a number of default OpenHIM Platform reciepes are provided. These help you get started with everything you need setup and configured for a particular use case.

We current support the following default recipes:

OpenHIM platform comes bundled with a set of generic packages that can be deployed and configured to support a number of different use cases. To help users of OpenHIM Platform get started with something they can make use of immediately, a number of default OpenHIM Platform recipes are provided. These help you get started with everything you need setup and configured for a particular use case.

We currently support the following default recipes:

<table data-view="cards"><thead><tr><th align="center"></th><th></th><th data-hidden></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><strong>Central Data Repository with Data Warehouse</strong></td><td>A FHIR-based Shared Health record linked to an MPI for linking and matching patient demographics and a default reporting pipeline to transform and visualise FHIR data.</td><td></td><td><a href="central-data-repository-with-data-warehousing.md">central-data-repository-with-data-warehousing.md</a></td></tr><tr><td align="center"><strong>Central Data Repository</strong></td><td>A FHIR-based Shared Health record linked to an MPI for linking and matching patient demographics. No reporting is include but all FHIR data is pushed to Kafka for external system to use.</td><td></td><td><a href="central-data-repository-no-reporting.md">central-data-repository-no-reporting.md</a></td></tr><tr><td align="center"><strong>Master Patient Index</strong></td><td>A master patient index setup using JeMPI. it also includes OpenHIM as the API gateway providing security, a mapping mediator to allow FHIR-based communication with JeMPI and Keycloak to support user management.</td><td></td><td><a href="master-patient-index.md">master-patient-index.md</a></td></tr></tbody></table>
7 changes: 7 additions & 0 deletions fhir-ig-importer/importer/docker-compose.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ services:
target: /openhimConfig.js
- source: fhir-ig-importer-config-importer-openhim-import.json
target: /openhim-import.json
- source: fhir-ig-importer-config-importer-ig-importer-app.json
target: /ig-importer-app.json
deploy:
replicas: 1
restart_policy:
Expand All @@ -34,6 +36,11 @@ configs:
name: fhir-ig-importer-config-importer-openhim-import.json-${fhir_ig_importer_config_importer_openhim_import_js_DIGEST:?err}
labels:
name: fhir-ig-importer
fhir-ig-importer-config-importer-ig-importer-app.json:
file: ./volume/ig-importer-app.json
name: fhir-ig-importer-config-importer-ig-importer-app.json-${fhir_ig_importer_config_importer_ig_importer_app_DIGEST:?err}
labels:
name: fhir-ig-importer

networks:
openhim:
Expand Down
11 changes: 11 additions & 0 deletions fhir-ig-importer/importer/volume/ig-importer-app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "FHIR IG Importer",
"description": "FHIR IG microfrontend app",
"category": "HIE Configuration",
"type": "esmodule",
"url": "http://localhost:3000/jembi-fhir-ig-importer.js",
"showInPortal": true,
"showInSideBar": true,
"access_roles": ["admin"],
"icon": "https://fonts.gstatic.com/s/i/materialicons/medical_information/v1/24px.svg"
}
79 changes: 58 additions & 21 deletions fhir-ig-importer/importer/volume/openhimConfig.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,90 @@
"use strict";

const fs = require("fs");
const https = require("https");
const path = require("path");

("use strict");

const OPENHIM_CORE_SERVICE_NAME = "openhim-core";
const OPENHIM_MEDIATOR_API_PORT = 8080;
const OPENHIM_API_PASSWORD = process.env.OPENHIM_API_PASSWORD || "instant101";
const OPENHIM_API_USERNAME =
process.env.OPENHIM_API_USERNAME || "[email protected]";

const authHeader = new Buffer.from(
const authHeader = Buffer.from(
`${OPENHIM_API_USERNAME}:${OPENHIM_API_PASSWORD}`
).toString("base64");

function makeRequest(options, data) {
const req = https.request(options, (res) => {
if (res.statusCode == 401) {
throw new Error(`Incorrect OpenHIM API credentials`);
}

if (![201, 200].includes(res.statusCode)) {
throw new Error(`Failed to import OpenHIM config: ${res.statusCode}`);
}

console.log("Successfully Imported OpenHIM Config");
});

req.on("error", (error) => {
throw new Error(`Failed to import OpenHIM config: ${error}`);
});

req.write(data);
req.end();
}

const jsonData = JSON.parse(
fs.readFileSync(path.resolve(__dirname, "openhim-import.json"))
);

const appJsonData = JSON.parse(
fs.readFileSync(path.resolve(__dirname, "ig-importer-app.json"))
);

const data = JSON.stringify(jsonData);
const appData = JSON.stringify(appJsonData);

const options = {
protocol: "https:",
hostname: OPENHIM_CORE_SERVICE_NAME,
port: OPENHIM_MEDIATOR_API_PORT,
path: "/metadata",
method: "POST",
headers: {
"Content-Type": "application/json",
"Content-Length": data.length,
Authorization: `Basic ${authHeader}`,
},
};

const req = https.request(options, (res) => {
if (res.statusCode == 401) {
throw new Error(`Incorrect OpenHIM API credentials`);
}

if (res.statusCode != 201) {
throw new Error(`Failed to import OpenHIM config: ${res.statusCode}`);
}
const reqOptions = {
...options,
path: "/metadata",
method: "POST",
headers: {
...options.headers,
"Content-Length": data.length,
},
};

console.log("Successfully Imported OpenHIM Config");
});
const appReqOptions = {
...options,
path: "/apps",
method: "POST",
headers: {
...options.headers,
"Content-Length": appData.length,
},
};

req.on("error", (error) => {
throw new Error(`Failed to import OpenHIM config: ${error}`);
});
const importMapRebuildOptions = {
...options,
path: "/apps",
method: "GET",
headers: {
...options.headers,
},
};

req.write(data);
req.end();
makeRequest(reqOptions, data);
makeRequest(appReqOptions, appData);
makeRequest(importMapRebuildOptions, "");

This file was deleted.

This file was deleted.

40 changes: 0 additions & 40 deletions identity-access-manager-keycloak/docker-compose-postgres.yml

This file was deleted.

Loading

0 comments on commit 806bef4

Please sign in to comment.