-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial package and configuration files for FHIR info Gateway
- Loading branch information
1 parent
67e1a49
commit 8e2c200
Showing
6 changed files
with
151 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters