Skip to content

Commit

Permalink
Add initial package and configuration files for FHIR info Gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
drizzentic committed May 20, 2024
1 parent 67e1a49 commit 8e2c200
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 2 deletions.
4 changes: 2 additions & 2 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
projectName: platform
image: jembi/platform:3.0.0-beta
image: jembi/platform:latest
logPath: /tmp/logs

packages:
Expand All @@ -26,6 +26,7 @@ packages:
- database-postgres
- reprocess-mediator
- fhir-ig-importer
- fhir-info-gateway

profiles:
- name: cdr-dw
Expand Down Expand Up @@ -75,4 +76,3 @@ profiles:
- openhim-mapping-mediator
envFiles:
- mpi.env

8 changes: 8 additions & 0 deletions fhir-info-gateway/docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3.9'

services:
fhir-info-gateway:
ports:
- target: 8080
published: 8880
mode: host
33 changes: 33 additions & 0 deletions fhir-info-gateway/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: "3.9"
services:
fhir-info-gateway:
image: ${FHIR_INFO_GATEWAY_IMAGE}
networks:
openhim:
keycloak:
default:
environment:
TOKEN_ISSUER: ${KC_API_URL}/realms/${KC_REALM_NAME}
ACCESS_CHECKER: ${ACCESS_CHECKER}
PROXY_TO: ${MPI_PROXY_URL}
BACKEND_TYPE: ${BACKEND_TYPE}
RUN_MODE: ${RUN_MODE}
deploy:
replicas: ${FHIR_INFO_GATEWAY_INSTANCES}
placement:
max_replicas_per_node: ${FHIR_INFO_GATEWAY_MAX_REPLICAS_PER_NODE}
resources:
limits:
cpus: ${FHIR_INFO_GATEWAY_CPU_LIMIT}
memory: ${FHIR_INFO_GATEWAY_MEMORY_LIMIT}
reservations:
cpus: ${FHIR_INFO_GATEWAY_CPU_RESERVE}
memory: ${FHIR_INFO_GATEWAY_MEMORY_RESERVE}
networks:
openhim:
name: openhim_public
external: true
keycloak:
name: keycloak_public
external: true
default:
23 changes: 23 additions & 0 deletions fhir-info-gateway/package-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"id": "fhir-info-gateway",
"name": "FHIR Info Gateway",
"description": "Implement the FHIR Info Gateway as a platform package which sits between the OpenHIM and MPI Mediator and any other direct FHIR access",
"type": "infrastructure",
"version": "0.0.1",
"dependencies": ["mpi-mediator"],
"environmentVariables": {
"MPI_PROXY_URL": "http://localhost:5001",
"ACCESS_CHECKER": "patient",
"RUN_MODE": "DEV",
"FHIR_INFO_GATEWAY_IMAGE": "jembi/fhir-info-gateway:v0.0.1",
"BACKEND_TYPE": "HAPI",
"KC_API_URL": "http://identity-access-manager-keycloak:9088",
"KC_REALM_NAME": "platform-realm",
"FHIR_INFO_GATEWAY_INSTANCES": "1",
"FHIR_INFO_GATEWAY_MAX_REPLICAS_PER_NODE": "1",
"FHIR_INFO_GATEWAY_CPU_LIMIT": "0",
"FHIR_INFO_GATEWAY_MEMORY_LIMIT": "2G",
"FHIR_INFO_GATEWAY_CPU_RESERVE": "0.05",
"FHIR_INFO_GATEWAY_MEMORY_RESERVE": "500M"
}
}
81 changes: 81 additions & 0 deletions fhir-info-gateway/swarm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/bash

declare ACTION=""
declare MODE=""
declare COMPOSE_FILE_PATH=""
declare UTILS_PATH=""
declare SERVICE_NAMES=()
declare STACK="fhir-info-gateway"

function init_vars() {
ACTION=$1
MODE=$2

COMPOSE_FILE_PATH=$(
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
pwd -P
)

UTILS_PATH="${COMPOSE_FILE_PATH}/../utils"

SERVICE_NAMES=(
"fhir-info-gateway"
)

readonly ACTION
readonly MODE
readonly COMPOSE_FILE_PATH
readonly UTILS_PATH
readonly SERVICE_NAMES
readonly STACK
}

# shellcheck disable=SC1091
function import_sources() {
source "${UTILS_PATH}/docker-utils.sh"
source "${UTILS_PATH}/log.sh"
}

function initialize_package() {
local package_dev_compose_filename=""
if [[ "${MODE}" == "dev" ]]; then
log info "Running package in DEV mode"
package_dev_compose_filename="docker-compose.dev.yml"
else
log info "Running package in PROD mode"
fi

(
docker::deploy_service $STACK "${COMPOSE_FILE_PATH}" "docker-compose.yml" "$package_dev_compose_filename"
) || {
log error "Failed to deploy package"
exit 1
}
}

function destroy_package() {
docker::stack_destroy "$STACK"
}

main() {
init_vars "$@"
import_sources

if [[ "${ACTION}" == "init" ]] || [[ "${ACTION}" == "up" ]]; then
log info "Running package in Single node mode"

initialize_package
elif [[ "${ACTION}" == "down" ]]; then
log info "Scaling down package"

docker::scale_services "$STACK" 0
elif [[ "${ACTION}" == "destroy" ]]; then
log info "Destroying package"

destroy_package
else
log error "Valid options are: init, up, down, or destroy"
fi
}

main "$@"
4 changes: 4 additions & 0 deletions interoperability-layer-openhim/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ services:
- api_openid_clientId=${KC_OPENHIM_CLIENT_ID}
- api_openid_clientSecret=${KC_OPENHIM_CLIENT_SECRET}
- openhimConsoleBaseUrl=${OPENHIM_CONSOLE_BASE_URL}
- authentication_enableJWTAuthentication=true
- authentication_jwt_jwksUri=${KC_API_URL}/realms/${KC_REALM_NAME}/protocol/openid-connect/certs
- authentication_jwt_algorithms=RS256
- authentication_jwt_issuer=${KC_FRONTEND_URL}/realms/${KC_REALM_NAME}
deploy:
replicas: ${OPENHIM_CORE_INSTANCES}
placement:
Expand Down

0 comments on commit 8e2c200

Please sign in to comment.