-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue #1708 merge with master and handle NPE when search param is fil…
…tered out Signed-off-by: Robin Arnold <robin.arnold23@ibm.com>
- Loading branch information
Showing
24 changed files
with
1,669 additions
and
308 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
This file was deleted.
Oops, something went wrong.
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 @@ | ||
../../LICENSE |
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,3 @@ | ||
target/ | ||
fhirschema.log | ||
out.log |
77 changes: 77 additions & 0 deletions
77
fhir-install/src/main/docker/ibm-fhir-schematool/DESIGN.md
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,77 @@ | ||
--- | ||
layout: default | ||
title: IBM FHIR Server - Schema Tool - Development | ||
date: 2020-11-11 | ||
permalink: /ibm-fhir-server-schema-tool-development/ | ||
--- | ||
|
||
# **Design** | ||
|
||
The IBM FHIR Schema Tool provides an Docker image that wraps the `fhir-persistence-schema` executable jar. The tool is state machine which take a single configuration to establish a current and running state of the IBM FHIR Server. | ||
|
||
The design is such that it COULD, but does not support multiple input files at this time. | ||
|
||
When the container is started, the container process one of two flows: | ||
|
||
* Schema Onboarding - creates and updates a schema and apply grants | ||
* Schema Offboarding - deletes a tenant (Db2) and removes data if there are no tenants left. | ||
|
||
**Schema Onboarding Flow** | ||
|
||
The schema onboarding flow setup add a new tenant or update the database to the latest schema levels. | ||
|
||
1. Check if set to **skip**: | ||
1. If `SKIP['true']`, stop and exit cleanly. | ||
1. If `SKIP['false']`, proceed. | ||
1. Check if **BEHAVIOR** set to ONBOARD: | ||
1. If not `BEHAVIOR['ONBOARD']`, skip. | ||
1. If `BEHAVIOR['ONBOARD']`, proceed. | ||
1. Create the database configuration file | ||
1. Check connectivity: | ||
1. If connectivity fails, stop and exit in error. | ||
1. If connectivity succeeds, proceed. | ||
1. Create the schema | ||
1. Update the Schema | ||
1. Check if Db2: | ||
1. If Db2, allocate tenant and save output. | ||
1. If Db2, test the allocated tenant | ||
1. If not Db2, proceed. | ||
1. Grant permissions to the IBM FHIR Server database user | ||
|
||
**Schema Offboarding Flow** | ||
|
||
The schema offboarding flow offboards the current schema, while preserving the schema for multiple tenants (if supported by the database type). | ||
|
||
1. Check if set to **SKIP**: | ||
1. If `SKIP['true']`, stop and exit cleanly. | ||
1. If `SKIP['false']`, proceed. | ||
1. Check if **BEHAVIOR** set to OFFBOARD: | ||
1. If not `BEHAVIOR['OFFBOARD']`, skip. | ||
1. If `BEHAVIOR['OFFBOARD']`, proceed. | ||
1. Check if Db2: | ||
1. If Db2, then deallocate tenant | ||
1. If not Db2, then proceed. | ||
1. If (Db2 and no more tenants) or Postgres, then proceed: | ||
1. Drop FHIR Schema | ||
1. Drop Java Batch | ||
1. Drop OAuth | ||
|
||
# **Implementation Details** | ||
|
||
## Configuration | ||
|
||
The configuration is drived primarily from a working directory, and in alternative circumstances backed by an Environment variable with the input. | ||
|
||
The configuration data is mounted to `/ibm-fhir-schematool/workarea/input`. | ||
|
||
## Logging | ||
1. Logging - The logging is to standard error and standard out. | ||
- The logs data is put into the `/ibm-fhir-schematool/workarea/output` folder. | ||
2. Must Gather Flow - Each execution generates a new set of log files to the `/ibm-fhir-schematool/workarea/output` folder. | ||
|
||
## Docker | ||
The design is to use as few layers as possible starting with `adoptopenjdk/openjdk11-openj9:ubi-minimal-jre`. | ||
|
||
The build uses multiple layers to avoid a bloated image after the necessary updates. Using a single image results in a 500M image (per docker history ibm-fhir-schematool), versus 167M. | ||
|
||
The DockerHub repository is at `ibmcom/ibm-fhir-schematool` and the team that manages it is the IBM FHIR Server team (Docker team: fhir). |
80 changes: 80 additions & 0 deletions
80
fhir-install/src/main/docker/ibm-fhir-schematool/DEVELOPMENT.md
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,80 @@ | ||
--- | ||
layout: default | ||
title: IBM FHIR Server - Schema Tool - Development | ||
date: 2020-11-11 | ||
permalink: /ibm-fhir-server-schema-tool-development/ | ||
--- | ||
|
||
# Development | ||
|
||
The document helps developers setup the development environment for the IBM FHIR Server Schema Tool. | ||
|
||
1. Build the `fhir-examples` and `fhir-parent` | ||
|
||
``` shell | ||
export WORKSPACE=`pwd` | ||
cd fhir-install/src/main/docker/ibm-fhir-schematool | ||
mvn clean install -DskipTests -f ${WORKSPACE}/fhir-examples/ | ||
mvn clean install -DskipTests -f ${WORKSPACE}/fhir-parent/ | ||
``` | ||
|
||
2. Change to the `fhir-install/src/main/docker/ibm-fhir-schematool` directory | ||
|
||
3. Prep the contents | ||
|
||
``` shell | ||
mkdir -p target | ||
cp ${WORKSPACE}/fhir-persistence-schema/target/fhir-persistence-schema-*-cli.jar target/ | ||
cp ${WORKSPACE}/LICENSE target/LICENSE | ||
``` | ||
|
||
4. Build the schema tool. | ||
|
||
``` shell | ||
docker build --tag ibm-fhir-schematool:latest . | ||
``` | ||
|
||
or | ||
|
||
``` shell | ||
docker build --build-arg FHIR_VERSION=4.5.0 -t ibm-fhir-schematool:4.5.0 . | ||
``` | ||
|
||
5. For Db2, change run. (You may have to edit the corresponding examples) | ||
|
||
* onboard | ||
``` shell | ||
time docker run --env ENV_TOOL_INPUT=`cat examples/db2/persistence-offboard-example.json |base64` ibm-fhir-schematool:latest | tee out.log | ||
``` | ||
|
||
* offboard | ||
``` shell | ||
time docker run --env ENV_TOOL_INPUT=`cat examples/db2/persistence-onboard-example.json |base64` ibm-fhir-schematool:latest | tee out.log | ||
``` | ||
|
||
6. For Postgres, run. (You may have to edit the corresponding examples) | ||
|
||
* onboard | ||
``` shell | ||
time docker run --env ENV_TOOL_INPUT=`cat examples/postgres/persistence-offboard-example.json |base64` ibm-fhir-schematool:latest | tee out.log | ||
``` | ||
|
||
* offboard | ||
``` shell | ||
time docker run --env ENV_TOOL_INPUT=`cat examples/postgres/persistence-onboard-example.json |base64` ibm-fhir-schematool:latest | tee out.log | ||
``` | ||
|
||
7. Confirm you see your changes work, and the Deployment works. | ||
|
||
* Schema is created, or deleted | ||
* No Error Logs (at least unexpected) | ||
* Output is as expected | ||
|
||
# Run a Shell Check | ||
|
||
Sanity check of the Shell Script | ||
|
||
``` | ||
brew install shellcheck | ||
shellcheck run.sh | ||
``` |
Oops, something went wrong.