Skip to content

Commit 6975f75

Browse files
Merge pull request #162 from jembi/PLAT-566-create-mpi-package
Plat 566 create mpi package
2 parents 052fb59 + 6d15658 commit 6975f75

File tree

8 files changed

+105
-2
lines changed

8 files changed

+105
-2
lines changed

client-registry-santempi/package-metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "A patient matching and deduplicater for the platform",
55
"type": "infrastructure",
66
"version": "0.0.1",
7-
"dependencies": ["reverse-proxy-nginx"],
7+
"dependencies": [],
88
"environmentVariables": {
99
"STATEFUL_NODES": "single",
1010
"SANTEMPI_INSTANCES": "1",

client-registry-santempi/swarm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ main() {
6363

6464
try "docker stack deploy -c ""$COMPOSE_FILE_PATH""/docker-compose.yml $sante_mpi_dev_compose_param instant" "Failed to stand up SanteMPI"
6565
elif [ "$ACTION" == "down" ]; then
66-
try "docker service scale instant_santedb-mpi=0 instant_santempi-psql-1=0" "Failed to scale down santeMPI"
66+
try "docker service scale instant_santedb-mpi=0 instant_santedb-www=0 instant_santempi-psql-1=0" "Failed to scale down santeMPI"
6767

6868
if [ "$STATEFUL_NODES" == "cluster" ]; then
6969
try "docker service scale instant_santempi-psql-2=0 instant_santempi-psql-3=0" "Failed to scale down santeMPI postgres replicas"

config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ packages:
3838
name: Dashboard Visualiser Superset
3939
- id: monitoring
4040
name: Monitoring package
41+
- id: mpi-mediator
42+
name: OpenHIM-Sante Mediator
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: '3.9'
2+
3+
services:
4+
mpi-mediator:
5+
deploy:
6+
placement:
7+
max_replicas_per_node: 1
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: '3.9'
2+
3+
services:
4+
mpi-mediator:
5+
ports:
6+
- target: 3000
7+
published: 3010
8+
mode: host

mpi-mediator/docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: '3.9'
2+
3+
services:
4+
mpi-mediator:
5+
image: jembi/mpi-mediator:0.1.0
6+
environment:
7+
CLIENT_REGISTRY_URL: ${CLIENT_REGISTRY_URL}
8+
REGISTER_MEDIATOR: ${REGISTER_MEDIATOR}
9+
OPENHIM_MEDIATOR_URL: ${OPENHIM_MEDIATOR_URL}
10+
TRUST_SELF_SIGNED: ${TRUST_SELF_SIGNED}

mpi-mediator/package-metadata.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"id": "mpi-mediator",
3+
"name": "OpenHIM-Sante Mediator",
4+
"description": "This package creates a mediator service that is used in facilitating patient creation, updating and reading from SanteMPI and Hapi-Fhir, from FHIR bundles using Kafka",
5+
"type": "infrastructure",
6+
"version": "0.0.1",
7+
"dependencies": [
8+
"fhir-datastore-hapi-fhir",
9+
"message-bus-kafka",
10+
"client-registry-santempi"
11+
],
12+
"environmentVariables": {
13+
"STATEFUL_NODES": "single",
14+
"CLIENT_REGISTRY_URL": "http://santedb-mpi:8080",
15+
"OPENHIM_MEDIATOR_URL": "https://openhim-core:8080",
16+
"TRUST_SELF_SIGNED": true,
17+
"REGISTER_MEDIATOR": true
18+
}
19+
}

mpi-mediator/swarm.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
3+
# Constants
4+
readonly ACTION=$1
5+
readonly MODE=$2
6+
7+
COMPOSE_FILE_PATH=$(
8+
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
9+
pwd -P
10+
)
11+
readonly COMPOSE_FILE_PATH
12+
13+
# Import libraries
14+
ROOT_PATH="${COMPOSE_FILE_PATH}/.."
15+
. "${ROOT_PATH}/utils/config-utils.sh"
16+
. "${ROOT_PATH}/utils/docker-utils.sh"
17+
. "${ROOT_PATH}/utils/log.sh"
18+
19+
main() {
20+
if [[ "${STATEFUL_NODES}" == "cluster" ]]; then
21+
log info "Running MPI-Mediator package in Cluster node mode"
22+
local mpi_mediator_cluster_compose_param="-c ${COMPOSE_FILE_PATH}/docker-compose.cluster.yml"
23+
else
24+
log info "Running MPI-Mediator package in Single node mode"
25+
local mpi_mediator_cluster_compose_param=""
26+
fi
27+
28+
if [[ "${MODE}" == "dev" ]]; then
29+
log info "Running MPI-Mediator package in DEV mode"
30+
local mpi_mediator_dev_compose_param="-c ${COMPOSE_FILE_PATH}/docker-compose.dev.yml"
31+
else
32+
log info "Running MPI-Mediator package in PROD mode"
33+
local mpi_mediator_dev_compose_param=""
34+
fi
35+
36+
if [[ "$ACTION" == "init" ]]; then
37+
log info "Deploying MPI-Mediator..."
38+
try "docker stack deploy -c $COMPOSE_FILE_PATH/docker-compose.yml $mpi_mediator_cluster_compose_param $mpi_mediator_dev_compose_param instant" "Failed to deploy mpi-mediator"
39+
overwrite "Deploying MPI-Mediator... Done"
40+
elif [[ "$ACTION" == "up" ]]; then
41+
log info "Updating MPI-Mediator..."
42+
try "docker stack deploy -c $COMPOSE_FILE_PATH/docker-compose.yml $mpi_mediator_cluster_compose_param $mpi_mediator_dev_compose_param instant" "Failed to stand up mpi-mediator"
43+
overwrite "Updating MPI-Mediator... Done"
44+
elif [[ "$ACTION" == "down" ]]; then
45+
log info "Scaling MPI-Mediator down..."
46+
try "docker service scale instant_mpi-mediator=0" "Failed to scale down mpi-mediator"
47+
overwrite "Scaling MPI-Mediator down... Done"
48+
elif [[ "$ACTION" == "destroy" ]]; then
49+
log info "Destroying MPI-Mediator..."
50+
docker::service_destroy mpi-mediator
51+
overwrite "Destroying MPI-Mediator... Done"
52+
else
53+
log error "Valid options are: init, up, down, or destroy"
54+
fi
55+
}
56+
57+
main "$@"

0 commit comments

Comments
 (0)