Skip to content

Commit

Permalink
Merge pull request #2818 from IBM/issue-2798
Browse files Browse the repository at this point in the history
Add Automation for ibm-fhir-term-graph-loader and ibm-fhir-bucket-tool
  • Loading branch information
prb112 authored Oct 18, 2021
2 parents a4a2b29 + 2a3a1db commit 717123c
Show file tree
Hide file tree
Showing 16 changed files with 403 additions and 25 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ The server can be packaged as a set of jar files, a web application archive (war
### Running the IBM FHIR Server
The IBM FHIR Server is available from the [Releases tab](https://github.com/IBM/FHIR/releases) as a zip file with installation scripts for Mac/Linux and Windows or as a docker image at https://hub.docker.com/r/ibmcom/ibm-fhir-server.

Note: The Docker image [ibmcom/ibm-fhir-schematool](https://hub.docker.com/r/ibmcom/ibm-fhir-schematool) is an early technology preview and is experimental.
Note:
1. The Docker image [ibmcom/ibm-fhir-schematool](https://hub.docker.com/r/ibmcom/ibm-fhir-schematool) is an early technology preview and is experimental.
2. The Docker image [ibmcom/ibm-fhir-bucket-tool](https://hub.docker.com/r/ibmcom/ibm-fhir-bucket-tool) is an early technology preview and is experimental.
3. The Docker image [ibmcom/ibm-fhir-term-loader](https://hub.docker.com/r/ibmcom/ibm-fhir-term-loader) is an early technology preview and is experimental.

More information on installing and running the server is available in the User Guide at https://ibm.github.io/FHIR/guides/FHIRServerUsersGuide.

Expand Down
4 changes: 4 additions & 0 deletions build/release/bin/30_release/1_dockerhub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ docker login -u "${DOCKERHUB_USERNAME}" -p "${DOCKERHUB_TOKEN}"
export WORKSPACE=$(pwd)
bash ${WORKSPACE}/fhir-install/src/main/docker/ibm-fhir-schematool/build.sh

bash ${WORKSPACE}/fhir-install/src/main/docker/ibm-fhir-term-graph-loader/build.sh

bash ${WORKSPACE}/fhir-install/src/main/docker/ibm-fhir-bucket-tool/build.sh

# create and remove a 1 GB file to make sure we have the room needed later
df -h
dd if=/dev/urandom oflag=direct of=balloon.dat bs=1024k count=1000
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target/
50 changes: 50 additions & 0 deletions fhir-install/src/main/docker/ibm-fhir-bucket-tool/DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
layout: default
title: IBM FHIR Server - Bucket Tool - Development
date: 2021-10-14
permalink: /ibm-fhir-bucket-tool-development/
---

# Development

The document helps developers setup the development environment for the IBM FHIR Server - Bucket Tool.

1. Build the `fhir-examples` and `fhir-parent`

``` shell
export WORKSPACE=`pwd`
cd fhir-install/src/main/docker/ibm-fhir-bucket-tool
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-bucket-tool` directory

3. Prep the contents

``` shell
mkdir -p target
cp ${WORKSPACE}/fhir-bucket/target/fhir-bucket-*-cli.jar target/
cp ${WORKSPACE}/LICENSE target/LICENSE
```

4. Build the bucket tool.

``` shell
docker build --build-arg FHIR_VERSION=4.10.0 -t ibm-fhir-bucket-tool:4.10.0 .
```

5. Run

``` shell
time docker run ibmcom/ibm-fhir-bucket-tool:latest $ARGS | tee out.log
```

# Run a Shell Check

Sanity check of the Shell Script

```
brew install shellcheck
shellcheck run.sh
```
63 changes: 63 additions & 0 deletions fhir-install/src/main/docker/ibm-fhir-bucket-tool/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# ----------------------------------------------------------------------------
# (C) Copyright IBM Corp. 2021
#
# SPDX-License-Identifier: Apache-2.0
# ----------------------------------------------------------------------------
# Stage: Base

# IBM Semeru Runtimes provides Non-official docker images. These are maintained by IBM.
# The link to Semeru is at https://hub.docker.com/r/ibmsemeruruntime/open-11-jdk
FROM ibmsemeruruntime/open-11-jdk:ubi_min-jre-latest as base

# Create the base working directory
RUN mkdir -p /opt/ibm/fhir/bucket/workarea

# Copy in the relevant artifacts in a single command
COPY ./run.sh ./target/fhir-bucket-*-cli.jar ./target/LICENSE /opt/ibm/fhir/bucket/

# ----------------------------------------------------------------------------
# Stage: Runnable

FROM registry.access.redhat.com/ubi8/ubi-minimal

ARG FHIR_VERSION=4.10.0

# The following labels are required:
LABEL name='IBM FHIR Server - Bucket Tool'
LABEL vendor='IBM'
LABEL version="$FHIR_VERSION"
LABEL summary="Image for IBM FHIR Server - Bucket Tool with OpenJ9 and UBI 8"
LABEL description="The IBM FHIR Server - Bucket Tool manages the IBM FHIR Server operations and generates synthetic load."

# Environment variables
ENV SKIP false
ENV TOOL_INPUT false

ENV LANG='en_US.UTF-8'
ENV LANGUAGE='en_US:en'
ENV LC_ALL='en_US.UTF-8'
ENV TZ 'UTC'

WORKDIR /opt/ibm/fhir/bucket/workarea

COPY --chown=1001:0 --from=base /opt/ /opt/

RUN chmod -R 755 /opt/ibm/fhir/bucket/run.sh && \
mkdir -p /licenses && \
mv /opt/ibm/fhir/bucket/LICENSE /licenses && \
microdnf update -y && \
microdnf install -y nc tzdata openssl curl ca-certificates fontconfig glibc-langpack-en gzip tar findutils shadow-utils && \
groupadd -r fhirbucketadmin -g 1001 && \
useradd -u 1001 -r -g 1001 -m -d /opt/ibm/fhir/bucket/home -s /sbin/nologin fhirbucketadmin && \
chmod -R 755 /opt/ibm/fhir/bucket/ && \
rm -rf /var/cache/yum && \
rm -f /@System.solv && \
microdnf clean all && \
rm -rf /var/tmp/* && \
rm -rf /tmp/* && \
mkdir -p /opt/ibm/fhir/bucket/workarea && \
chmod -R 775 /opt/ibm/fhir/bucket/workarea

USER 1001

ENTRYPOINT ["/opt/ibm/fhir/bucket/run.sh"]
11 changes: 11 additions & 0 deletions fhir-install/src/main/docker/ibm-fhir-bucket-tool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# IBM FHIR Server - Bucket Tool

The image wraps the IBM FHIR Server Bucket Tool which wraps the module - `fhir-bucket`.

************
# **License**

The IBM FHIR Server - Bucket Tool is licensed under the Apache 2.0 license. Full license text is available at [LICENSE](https://github.com/IBM/FHIR/blob/master/LICENSE).

FHIR® is the registered trademark of HL7 and is used with the permission of HL7. Use of the FHIR trademark does not constitute endorsement of this product by HL7.
IBM and the IBM logo are trademarks of International Business Machines Corporation, registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on [https://ibm.com/trademark](https://ibm.com/trademark).
45 changes: 45 additions & 0 deletions fhir-install/src/main/docker/ibm-fhir-bucket-tool/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash

# ----------------------------------------------------------------------------
# (C) Copyright IBM Corp. 2021
#
# SPDX-License-Identifier: Apache-2.0
# ----------------------------------------------------------------------------

##############################################################################

if [ -z "${WORKSPACE}" ]
then
echo "The WORKSPACE is not set"
exit 10;
fi

if [ -z "${BUILD_ID}" ]
then
echo "The Build ID is not set"
exit 11;
fi

# docker login is already complete at this point.

pushd $(pwd)

cd ${WORKSPACE}/fhir-install/src/main/docker/ibm-fhir-bucket-tool/

# Copy the files over
mkdir -p target/
cp ${WORKSPACE}/fhir-bucket/target/fhir-bucket-*cli.jar target/
cp ${WORKSPACE}/LICENSE target/

docker build --build-arg FHIR_VERSION=${BUILD_ID} -t ibm-fhir-bucket-tool:latest .
DOCKER_IMAGE=$(docker images --filter=reference='ibm-fhir-bucket-tool:latest' --format "{{.ID}}")
echo "Docker Image is: ${DOCKER_IMAGE}"

docker tag ${DOCKER_IMAGE} ibmcom/ibm-fhir-bucket-tool:${BUILD_ID}
docker tag ${DOCKER_IMAGE} ibmcom/ibm-fhir-bucket-tool:latest
docker push ibmcom/ibm-fhir-bucket-tool:${BUILD_ID}
docker push ibmcom/ibm-fhir-bucket-tool:latest

popd > /dev/null

# EOF
10 changes: 10 additions & 0 deletions fhir-install/src/main/docker/ibm-fhir-bucket-tool/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

# ----------------------------------------------------------------------------
# (C) Copyright IBM Corp. 2021
#
# SPDX-License-Identifier: Apache-2.0
# ----------------------------------------------------------------------------

/opt/java/openjdk/bin/java -jar /opt/ibm/fhir/bucket/fhir-bucket-*-cli.jar "$@"
# EOF
2 changes: 0 additions & 2 deletions fhir-install/src/main/docker/ibm-fhir-schematool/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
# SPDX-License-Identifier: Apache-2.0
# ----------------------------------------------------------------------------

set -e -o pipefail

##############################################################################

if [ -z "${WORKSPACE}" ]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target/
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
layout: default
title: IBM FHIR Term Graph Loader Tool - Development
date: 2021-10-04
permalink: /ibm-fhir-term-graph-loader-tool-development/
---

# Development

The document helps developers setup the development environment for the IBM FHIR Server - Term Graph Loader Tool.

1. Build the `fhir-examples` and `fhir-parent`

``` shell
export WORKSPACE=`pwd`
cd fhir-install/src/main/docker/ibm-fhir-term-graph-loader
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-term-graph-loader` directory

3. Prep the contents

``` shell
mkdir -p target
cp ${WORKSPACE}/term/fhir-term-graph-loader/target/fhir-term-graph-loader-*-cli.jar target/
cp ${WORKSPACE}/LICENSE target/LICENSE
```

4. Build the tool.

``` shell
docker build --tag ibm-fhir-term-loader:latest .
```

or

``` shell
docker build --build-arg FHIR_VERSION=4.10.0 -t ibm-fhir-term-loader:4.10.0 .
```

5. Run the shell. (You may have to edit the corresponding examples)

``` shell
time docker run --rm -e LOAD_UMLS=true ibmcom/ibm-fhir-term-loader:latest| tee out.log
```

``` shell
time docker run --rm -e LOAD_MAP=true ibmcom/ibm-fhir-term-loader:latest| tee out.log
```

You'll also have to mount a config properties and pass in a configuration environment variable.

# Run a Shell Check

Sanity check of the Shell Script

```
brew install shellcheck
shellcheck run.sh
```
70 changes: 54 additions & 16 deletions fhir-install/src/main/docker/ibm-fhir-term-graph-loader/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,63 @@
# SPDX-License-Identifier: Apache-2.0
# ----------------------------------------------------------------------------

# Build stage
FROM maven:3.6.0-jdk-11-slim AS build
COPY . /
# Stage: Base

RUN mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.2:go-offline -f /fhir-examples -DexcludeReactor=true -Dmaven.wagon.http.retryHandler.count=3
RUN mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.2:resolve-plugins -f /fhir-examples -DexcludeReactor=true -Dmaven.wagon.http.retryHandler.count=3
RUN mvn -f /fhir-examples/pom.xml install -DskipTests=true
# IBM Semeru Runtimes provides Non-official docker images. These are maintained by IBM.
# The link to Semeru is at https://hub.docker.com/r/ibmsemeruruntime/open-11-jdk
FROM ibmsemeruruntime/open-11-jdk:ubi_min-jre-latest as base

RUN mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.2:go-offline -f /fhir-parent -DexcludeReactor=true -Dmaven.wagon.http.retryHandler.count=3
RUN mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.2:resolve-plugins -f /fhir-parent -DexcludeReactor=true -Dmaven.wagon.http.retryHandler.count=3
RUN mvn -f /fhir-parent/pom.xml install -DskipTests=true -pl ../fhir-term-graph -am
# Create the base working directory
RUN mkdir -p /opt/ibm/fhir/graph/loader/workarea

RUN mvn org.apache.maven.plugins:maven-dependency-plugin:3.2.0:copy-dependencies -f /fhir-parent -pl ../fhir-term-graph -am -DoutputDirectory=target/ftg
# Copy in the relevant artifacts in a single command
# the cli is a shaded jar with all dependencies
COPY ./run.sh ./target/fhir-term-graph-loader-*-cli.jar ./target/LICENSE /opt/ibm/fhir/graph/loader/

# Package stage
FROM openjdk:11-jre-slim
# ----------------------------------------------------------------------------
# Stage: Runnable

FROM registry.access.redhat.com/ubi8/ubi-minimal

ARG FHIR_VERSION=4.10.0

# The following labels are required:
LABEL name='IBM FHIR Server - Term Loader Tool'
LABEL vendor='IBM'
LABEL version="$FHIR_VERSION"
LABEL summary="Image for IBM FHIR Server - Term Loader Tool with OpenJ9 and UBI 8"
LABEL description="The IBM FHIR Server - Term Loader Tool is designed to load the terminology graph."

# Environment variables
ENV SKIP false
ENV TOOL_INPUT false

ENV LANG='en_US.UTF-8'
ENV LANGUAGE='en_US:en'
ENV LC_ALL='en_US.UTF-8'
ENV TZ 'UTC'

WORKDIR /opt/ibm/fhir/graph/loader/

COPY --chown=1001:0 --from=base /opt/ /opt/

RUN chmod -R 755 /opt/ibm/fhir/graph/loader/run.sh && \
mkdir -p /licenses && \
mv /opt/ibm/fhir/graph/loader/LICENSE /licenses && \
microdnf update -y && \
microdnf install -y nc tzdata openssl curl ca-certificates fontconfig glibc-langpack-en gzip tar findutils shadow-utils && \
groupadd -r fhirgraphadmin -g 1001 && \
useradd -u 1001 -r -g 1001 -m -d /opt/ibm/fhir/graph/loader/home -s /sbin/nologin fhirgraphadmin && \
chmod -R 755 /opt/ibm/fhir/graph/loader && \
rm -rf /var/cache/yum && \
rm -f /@System.solv && \
microdnf clean all && \
rm -rf /var/tmp/* && \
rm -rf /tmp/* && \
mkdir -p /opt/ibm/fhir/graph/loader/workarea && \
chmod -R 775 /opt/ibm/fhir/graph/loader/workarea

COPY --from=build run.sh /opt/
COPY --from=build /fhir-term-graph/target/*.jar /opt/lib/
COPY --from=build /fhir-term-graph/target/ftg/*.jar /opt/lib/
USER 1001

ENTRYPOINT ["/opt/run.sh"]
ENTRYPOINT ["/opt/ibm/fhir/graph/loader/run.sh"]
# EOF
11 changes: 11 additions & 0 deletions fhir-install/src/main/docker/ibm-fhir-term-graph-loader/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# IBM FHIR Term Graph Loader Tool

The image wraps the IBM FHIR Server Term Graph Loader tool.

************
# **License**

The IBM FHIR Server - Term Graph Loader Tool is licensed under the Apache 2.0 license. Full license text is available at [LICENSE](https://github.com/IBM/FHIR/blob/master/LICENSE).

FHIR® is the registered trademark of HL7 and is used with the permission of HL7. Use of the FHIR trademark does not constitute endorsement of this product by HL7.
IBM and the IBM logo are trademarks of International Business Machines Corporation, registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on [https://ibm.com/trademark](https://ibm.com/trademark).
Loading

0 comments on commit 717123c

Please sign in to comment.