Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,27 @@ FROM gradle:6.9.0-jdk11

# Set working directory so that all subsequent command runs in this folder
WORKDIR /test-ehr

ENV GRADLE_USER_HOME=/tmp/gradle-user-home

USER root
RUN mkdir -p /test-ehr/.gradle && chown -R gradle:gradle /test-ehr
USER gradle

# Copy app files to container
COPY --chown=gradle:gradle . .
RUN gradle build

USER root
RUN rm -rf /test-ehr/.gradle /tmp/gradle-user-home \
&& mkdir -p /test-ehr/.gradle /tmp/gradle-user-home \
&& chmod 0777 /test-ehr/.gradle /tmp/gradle-user-home

# Expose port to access the app
EXPOSE 8080

#HealthCheck
HEALTHCHECK --interval=45s --start-period=60s --timeout=10m --retries=10 CMD curl --fail http://localhost:8080/test-ehr/r4/metadata || exit 1

# Command to run our app
CMD ./dockerRunnerProd.sh
CMD ./dockerRunnerProd.sh
15 changes: 14 additions & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,27 @@ FROM gradle:6.9.0-jdk11

# Set working directory so that all subsequent command runs in this folder
WORKDIR /test-ehr

ENV GRADLE_USER_HOME=/tmp/gradle-user-home

USER root
RUN mkdir -p /test-ehr/.gradle && chown -R gradle:gradle /test-ehr
USER gradle

# Copy app files to container
COPY --chown=gradle:gradle . .
RUN gradle build

USER root
RUN rm -rf /test-ehr/.gradle /tmp/gradle-user-home \
&& mkdir -p /test-ehr/.gradle /tmp/gradle-user-home \
&& chmod 0777 /test-ehr/.gradle /tmp/gradle-user-home

# Expose port to access the app
EXPOSE 8080
EXPOSE 8081

HEALTHCHECK --interval=45s --start-period=60s --timeout=10m --retries=10 CMD curl --fail http://localhost:8080/test-ehr/r4/metadata || exit 1

# Command to run our app
CMD ./dockerRunnerDev.sh
CMD ./dockerRunnerDev.sh
2 changes: 1 addition & 1 deletion Dockerfile.keycloak
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM keycloak/keycloak:22.0.1
FROM quay.io/keycloak/keycloak:22.0.1
HEALTHCHECK --interval=30s --start-period=15s --timeout=10m --retries=10 CMD bash -c 'echo -n > /dev/tcp/127.0.0.1/8080'
COPY ./src/main/resources/ClientFhirServerRealm.json /opt/keycloak/data/import/ClientFhirServerRealm.json
15 changes: 9 additions & 6 deletions dockerRunnerDev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
trap "kill $LOAD_DATA_PID $CONTINUOUS_BUILD_PID $SERVER_PID; gradle --stop; exit" INT

# Set environment variables
mkdir logs
BUILD_PROJECT_CACHE=/tmp/test-ehr-gradle-project-cache/build
RUN_PROJECT_CACHE=/tmp/test-ehr-gradle-project-cache/run
LOAD_DATA_PROJECT_CACHE=/tmp/test-ehr-gradle-project-cache/load-data

mkdir -p logs
# Reset log file content for new application boot
echo "*** Logs for 'gradle installBootDist --continuous' ***" > ./logs/builder.log
echo "*** Logs for 'gradle bootRun' ***" > ./logs/runner.log
Expand All @@ -18,7 +22,7 @@ echo "Starting continuous data loader..."
sleep 1
done
echo "loading data into test-ehr..."
gradle loadData
gradle --project-cache-dir "$LOAD_DATA_PROJECT_CACHE" loadData

# Continuous Load Data command whenever fhirResourcesToLoad directory changes
resources_modify_time=$(stat -c %Y fhirResourcesToLoad)
Expand All @@ -29,7 +33,7 @@ do
if [[ "$resources_modify_time" != "$new_resources_modify_time" ]]
then
echo "loading data into test-ehr..."
gradle loadData
gradle --project-cache-dir "$LOAD_DATA_PROJECT_CACHE" loadData
fi

resources_modify_time=$new_resources_modify_time
Expand All @@ -38,19 +42,18 @@ done ) & LOAD_DATA_PID=$!

# Start the continious build listener process
echo "starting continuous build listener..."
( gradle build --continuous | tee ./logs/builder.log ) & CONTINUOUS_BUILD_PID=$!
( gradle --project-cache-dir "$BUILD_PROJECT_CACHE" build --continuous | tee ./logs/builder.log ) & CONTINUOUS_BUILD_PID=$!

# Start server process once initial build finishes
( while ! grep -m1 'BUILD SUCCESSFUL' < ./logs/builder.log; do
sleep 1
done
echo "starting test-ehr server in debug mode..."
gradle bootRun -Pdebug 2>&1 | tee ./logs/runner.log ) & SERVER_PID=$!
gradle --project-cache-dir "$RUN_PROJECT_CACHE" bootRun -Pdebug 2>&1 | tee ./logs/runner.log ) & SERVER_PID=$!



# Handle application background process exiting
wait $CONTINUOUS_BUILD_PID $SERVER_PID $LOAD_DATA_PID
EXIT_CODE=$?
echo "application exited with exit code $EXIT_CODE..."

10 changes: 6 additions & 4 deletions dockerRunnerProd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
trap "kill $LOAD_DATA_PID $SERVER_PID; gradle --stop; exit" INT

# Set environment variables
mkdir logs
RUN_PROJECT_CACHE=/tmp/test-ehr-gradle-project-cache/run
LOAD_DATA_PROJECT_CACHE=/tmp/test-ehr-gradle-project-cache/load-data

mkdir -p logs
# Reset log file content for new application boot
echo "*** Logs for 'gradle bootRun' ***" > ./logs/runner.log

Expand All @@ -16,14 +19,13 @@ echo "Starting application in production mode..."
sleep 1
done
echo "loading data into test-ehr..."
gradle loadData ) & LOAD_DATA_PID=$!
gradle --project-cache-dir "$LOAD_DATA_PROJECT_CACHE" loadData ) & LOAD_DATA_PID=$!

# Start server process
echo "starting test-ehr server..."
( gradle bootRun 2>&1 | tee ./logs/runner.log ) & SERVER_PID=$!
( gradle --project-cache-dir "$RUN_PROJECT_CACHE" bootRun 2>&1 | tee ./logs/runner.log ) & SERVER_PID=$!

# Handle application background process exiting
wait $SERVER_PID $LOAD_DATA_PID
EXIT_CODE=$?
echo "application exited with exit code $EXIT_CODE..."

6 changes: 3 additions & 3 deletions fhirResourcesToLoad/0. pharmacy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"resourceType": "HealthcareService",
"id": "pharm0111",
"active": true,
"name": "RiteAid Pharmacy",
"name": "PIMS Pharmacy A",
"category": [
{
"coding": [
Expand All @@ -28,7 +28,7 @@
"location": [
{
"reference": "Location/pharm-location-001",
"display": "123 Main Street, Detroit, MI 48224"
"display": "123 Main Street, Boston, MA 02134"
}
]
}
}
12 changes: 6 additions & 6 deletions fhirResourcesToLoad/7. pharmacy-location.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
"resourceType": "Location",
"id": "pharm-location-001",
"status": "active",
"name": "Test Pharmacy - Main Location",
"description": "Main location for Test Pharmacy providing community pharmacy services",
"name": "PIMS Pharmacy A - Main Location",
"description": "Main location for PIMS Pharmacy A providing community pharmacy services",
"mode": "instance",
"address": {
"use": "work",
"type": "physical",
"line": [
"123 Main Street"
],
"city": "Detroit",
"state": "MI",
"postalCode": "48224",
"city": "Boston",
"state": "MA",
"postalCode": "02134",
"country": "US"
},
"telecom": [
Expand All @@ -28,4 +28,4 @@
"use": "work"
}
]
}
}
8 changes: 4 additions & 4 deletions fhirResourcesToLoad/8.pharmacy-2.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"resourceType": "HealthcareService",
"id": "pharm4321",
"active": true,
"name": "Test Pharmacy #2",
"name": "PIMS Pharmacy B",
"category": [
{
"coding": [
Expand All @@ -27,8 +27,8 @@
],
"location": [
{
"reference": "Location/pharm-location-001",
"display": "561 Street Road, Anytown, CA 12345"
"reference": "Location/pharm-location-002",
"display": "456 Central Street, Cambridge, MA 02139"
}
]
}
}
16 changes: 8 additions & 8 deletions fhirResourcesToLoad/9. pharmacy-location-2.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"resourceType": "Location",
"id": "pharm-location-001",
"id": "pharm-location-002",
"status": "active",
"name": "Test Pharmacy - Secondary Location",
"description": "Secondary location for Test Pharmacy providing community pharmacy services",
"name": "PIMS Pharmacy B",
"description": "Second PIMS pharmacy location for product availability testing",
"mode": "instance",
"address": {
"use": "work",
"type": "physical",
"line": [
"561 Street Road"
"456 Central Street"
],
"city": "Anytown",
"state": "CA",
"postalCode": "12345",
"city": "Cambridge",
"state": "MA",
"postalCode": "02139",
"country": "US"
},
"telecom": [
Expand All @@ -28,4 +28,4 @@
"use": "work"
}
]
}
}
53 changes: 53 additions & 0 deletions fhirResourcesToLoad/medication_pexidartinib_generic.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"resourceType": "Medication",
"id": "med-pexidartinib-generic",
"code": {
"coding": [
{
"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
"code": "2183126",
"display": "Pexidartinib Hydrochloride 200 MG Oral Capsule"
},
{
"system": "http://hl7.org/fhir/sid/ndc",
"code": "99999-407-20",
"display": "Pexidartinib Hydrochloride"
}
],
"text": "Pexidartinib Hydrochloride 200 MG Oral Capsule"
},
"form": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "385055001",
"display": "Capsule dose form"
}
]
},
"ingredient": [
{
"itemCodeableConcept": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "774167006",
"display": "Pexidartinib"
}
]
},
"strength": {
"numerator": {
"value": 200,
"system": "http://unitsofmeasure.org",
"code": "mg"
},
"denominator": {
"value": 1,
"system": "http://terminology.hl7.org/CodeSystem/v3-orderableDrugForm",
"code": "CAP"
}
}
}
]
}
6 changes: 3 additions & 3 deletions fhirResourcesToLoad/rems_smith_01_patient.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
{
"use": "home",
"type": "both",
"state": "Wonderland",
"city": "Wonderland",
"postalCode": "12345",
"state": "MA",
"city": "Somerville",
"postalCode": "02143",
"line": ["47 Main St"]
}
],
Expand Down
Loading
Loading