Skip to content

Commit 8e2c200

Browse files
committed
Add initial package and configuration files for FHIR info Gateway
1 parent 67e1a49 commit 8e2c200

File tree

6 files changed

+151
-2
lines changed

6 files changed

+151
-2
lines changed

config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
projectName: platform
2-
image: jembi/platform:3.0.0-beta
2+
image: jembi/platform:latest
33
logPath: /tmp/logs
44

55
packages:
@@ -26,6 +26,7 @@ packages:
2626
- database-postgres
2727
- reprocess-mediator
2828
- fhir-ig-importer
29+
- fhir-info-gateway
2930

3031
profiles:
3132
- name: cdr-dw
@@ -75,4 +76,3 @@ profiles:
7576
- openhim-mapping-mediator
7677
envFiles:
7778
- mpi.env
78-
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+
fhir-info-gateway:
5+
ports:
6+
- target: 8080
7+
published: 8880
8+
mode: host

fhir-info-gateway/docker-compose.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: "3.9"
2+
services:
3+
fhir-info-gateway:
4+
image: ${FHIR_INFO_GATEWAY_IMAGE}
5+
networks:
6+
openhim:
7+
keycloak:
8+
default:
9+
environment:
10+
TOKEN_ISSUER: ${KC_API_URL}/realms/${KC_REALM_NAME}
11+
ACCESS_CHECKER: ${ACCESS_CHECKER}
12+
PROXY_TO: ${MPI_PROXY_URL}
13+
BACKEND_TYPE: ${BACKEND_TYPE}
14+
RUN_MODE: ${RUN_MODE}
15+
deploy:
16+
replicas: ${FHIR_INFO_GATEWAY_INSTANCES}
17+
placement:
18+
max_replicas_per_node: ${FHIR_INFO_GATEWAY_MAX_REPLICAS_PER_NODE}
19+
resources:
20+
limits:
21+
cpus: ${FHIR_INFO_GATEWAY_CPU_LIMIT}
22+
memory: ${FHIR_INFO_GATEWAY_MEMORY_LIMIT}
23+
reservations:
24+
cpus: ${FHIR_INFO_GATEWAY_CPU_RESERVE}
25+
memory: ${FHIR_INFO_GATEWAY_MEMORY_RESERVE}
26+
networks:
27+
openhim:
28+
name: openhim_public
29+
external: true
30+
keycloak:
31+
name: keycloak_public
32+
external: true
33+
default:
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"id": "fhir-info-gateway",
3+
"name": "FHIR Info Gateway",
4+
"description": "Implement the FHIR Info Gateway as a platform package which sits between the OpenHIM and MPI Mediator and any other direct FHIR access",
5+
"type": "infrastructure",
6+
"version": "0.0.1",
7+
"dependencies": ["mpi-mediator"],
8+
"environmentVariables": {
9+
"MPI_PROXY_URL": "http://localhost:5001",
10+
"ACCESS_CHECKER": "patient",
11+
"RUN_MODE": "DEV",
12+
"FHIR_INFO_GATEWAY_IMAGE": "jembi/fhir-info-gateway:v0.0.1",
13+
"BACKEND_TYPE": "HAPI",
14+
"KC_API_URL": "http://identity-access-manager-keycloak:9088",
15+
"KC_REALM_NAME": "platform-realm",
16+
"FHIR_INFO_GATEWAY_INSTANCES": "1",
17+
"FHIR_INFO_GATEWAY_MAX_REPLICAS_PER_NODE": "1",
18+
"FHIR_INFO_GATEWAY_CPU_LIMIT": "0",
19+
"FHIR_INFO_GATEWAY_MEMORY_LIMIT": "2G",
20+
"FHIR_INFO_GATEWAY_CPU_RESERVE": "0.05",
21+
"FHIR_INFO_GATEWAY_MEMORY_RESERVE": "500M"
22+
}
23+
}

fhir-info-gateway/swarm.sh

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/bin/bash
2+
3+
declare ACTION=""
4+
declare MODE=""
5+
declare COMPOSE_FILE_PATH=""
6+
declare UTILS_PATH=""
7+
declare SERVICE_NAMES=()
8+
declare STACK="fhir-info-gateway"
9+
10+
function init_vars() {
11+
ACTION=$1
12+
MODE=$2
13+
14+
COMPOSE_FILE_PATH=$(
15+
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
16+
pwd -P
17+
)
18+
19+
UTILS_PATH="${COMPOSE_FILE_PATH}/../utils"
20+
21+
SERVICE_NAMES=(
22+
"fhir-info-gateway"
23+
)
24+
25+
readonly ACTION
26+
readonly MODE
27+
readonly COMPOSE_FILE_PATH
28+
readonly UTILS_PATH
29+
readonly SERVICE_NAMES
30+
readonly STACK
31+
}
32+
33+
# shellcheck disable=SC1091
34+
function import_sources() {
35+
source "${UTILS_PATH}/docker-utils.sh"
36+
source "${UTILS_PATH}/log.sh"
37+
}
38+
39+
function initialize_package() {
40+
local package_dev_compose_filename=""
41+
if [[ "${MODE}" == "dev" ]]; then
42+
log info "Running package in DEV mode"
43+
package_dev_compose_filename="docker-compose.dev.yml"
44+
else
45+
log info "Running package in PROD mode"
46+
fi
47+
48+
(
49+
docker::deploy_service $STACK "${COMPOSE_FILE_PATH}" "docker-compose.yml" "$package_dev_compose_filename"
50+
) || {
51+
log error "Failed to deploy package"
52+
exit 1
53+
}
54+
}
55+
56+
function destroy_package() {
57+
docker::stack_destroy "$STACK"
58+
}
59+
60+
main() {
61+
init_vars "$@"
62+
import_sources
63+
64+
if [[ "${ACTION}" == "init" ]] || [[ "${ACTION}" == "up" ]]; then
65+
log info "Running package in Single node mode"
66+
67+
initialize_package
68+
elif [[ "${ACTION}" == "down" ]]; then
69+
log info "Scaling down package"
70+
71+
docker::scale_services "$STACK" 0
72+
elif [[ "${ACTION}" == "destroy" ]]; then
73+
log info "Destroying package"
74+
75+
destroy_package
76+
else
77+
log error "Valid options are: init, up, down, or destroy"
78+
fi
79+
}
80+
81+
main "$@"

interoperability-layer-openhim/docker-compose.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ services:
2424
- api_openid_clientId=${KC_OPENHIM_CLIENT_ID}
2525
- api_openid_clientSecret=${KC_OPENHIM_CLIENT_SECRET}
2626
- openhimConsoleBaseUrl=${OPENHIM_CONSOLE_BASE_URL}
27+
- authentication_enableJWTAuthentication=true
28+
- authentication_jwt_jwksUri=${KC_API_URL}/realms/${KC_REALM_NAME}/protocol/openid-connect/certs
29+
- authentication_jwt_algorithms=RS256
30+
- authentication_jwt_issuer=${KC_FRONTEND_URL}/realms/${KC_REALM_NAME}
2731
deploy:
2832
replicas: ${OPENHIM_CORE_INSTANCES}
2933
placement:

0 commit comments

Comments
 (0)