-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ refactor(log-service): Refactor server and log service for docker …
…packaging.
- Loading branch information
Showing
24 changed files
with
191 additions
and
95 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 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 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 |
---|---|---|
@@ -1,14 +1,11 @@ | ||
FROM openjdk:11-jre-slim | ||
|
||
# Create folders | ||
RUN mkdir -p /tofhir | ||
WORKDIR /tofhir | ||
ENV TOFHIR_HOME /usr/local/tofhir | ||
RUN mkdir -p "$TOFHIR_HOME" | ||
WORKDIR $TOFHIR_HOME | ||
|
||
# Add Files | ||
COPY ./tofhir-log-server/target/tofhir-log-server-standalone.jar . | ||
COPY ./docker/log-server/docker-entrypoint.sh . | ||
COPY ./tofhir-log-server/src/main/resources/logback.xml . | ||
RUN chmod +x docker-entrypoint.sh | ||
|
||
RUN chmod +x /tofhir/docker-entrypoint.sh | ||
|
||
ENTRYPOINT ["/tofhir/docker-entrypoint.sh"] | ||
ENTRYPOINT ["./docker-entrypoint.sh"] |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Execute one of the following commands from the project.root.directory (../../) | ||
|
||
docker build -f docker/log-server/Dockerfile -t srdc/tofhir-log-server:latest -t srdc/tofhir-log-server:1.0 . | ||
docker build -f docker/log-server/Dockerfile -t srdc/tofhir-log-server:latest . | ||
|
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 |
---|---|---|
@@ -1,15 +1,42 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
JAVA_CMD="java -jar " | ||
JAVA_CMD="java -Xms256m -Xmx3g -jar " | ||
|
||
# Configure application.conf path | ||
if [ ! -z "$APP_CONF_FILE" ]; then | ||
JAVA_CMD+="-Dconfig.file=$APP_CONF_FILE " | ||
JAVA_CMD+="-Dconfig.file=$APP_CONF_FILE " | ||
fi | ||
|
||
# Finally, tell which jar to run | ||
JAVA_CMD+="/tofhir/tofhir-log-server-standalone.jar" | ||
# Configure logback configuration file | ||
if [ ! -z "$LOGBACK_CONF_FILE" ]; then | ||
JAVA_CMD+="-Dlogback.configurationFile=$LOGBACK_CONF_FILE " | ||
fi | ||
|
||
# Configure Spark | ||
if [ ! -z "$SPARK_APPNAME" ]; then | ||
JAVA_CMD+="-Dspark.app-name=$SPARK_APPNAME " | ||
fi | ||
if [ ! -z "$SPARK_MASTER" ]; then | ||
JAVA_CMD+="-Dspark.master=$SPARK_MASTER " | ||
fi | ||
|
||
# Configure tofhir-server web server | ||
if [ ! -z "$WEBSERVER_HOST" ]; then | ||
JAVA_CMD+="-Dwebserver.host=$WEBSERVER_HOST " | ||
fi | ||
if [ ! -z "$WEBSERVER_PORT" ]; then | ||
JAVA_CMD+="-Dwebserver.port=$WEBSERVER_PORT " | ||
fi | ||
if [ ! -z "$WEBSERVER_BASEURI" ]; then | ||
JAVA_CMD+="-Dwebserver.base-uri=$WEBSERVER_BASEURI " | ||
fi | ||
|
||
echo "Running command: $JAVA_CMD" | ||
# Delay the execution for this amount of seconds | ||
if [ ! -z "$DELAY_EXECUTION" ]; then | ||
sleep $DELAY_EXECUTION | ||
fi | ||
|
||
# Finally, tell which jar to run | ||
JAVA_CMD+="tofhir-log-server-standalone.jar" | ||
|
||
eval $JAVA_CMD | ||
eval $JAVA_CMD "$@" |
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 |
---|---|---|
@@ -1,14 +1,11 @@ | ||
FROM openjdk:11-jre-slim | ||
|
||
# Create folders | ||
RUN mkdir -p /tofhir | ||
WORKDIR /tofhir | ||
ENV TOFHIR_HOME /usr/local/tofhir | ||
RUN mkdir -p "$TOFHIR_HOME" | ||
WORKDIR $TOFHIR_HOME | ||
|
||
# Add Files | ||
COPY ./tofhir-server/target/tofhir-server-standalone.jar . | ||
COPY ./docker/server/docker-entrypoint.sh . | ||
COPY ./tofhir-server/src/main/resources/logback.xml . | ||
RUN chmod +x docker-entrypoint.sh | ||
|
||
RUN chmod +x /tofhir/docker-entrypoint.sh | ||
|
||
ENTRYPOINT ["/tofhir/docker-entrypoint.sh"] | ||
ENTRYPOINT ["./docker-entrypoint.sh"] |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Execute one of the following commands from the project.root.directory (../../) | ||
|
||
docker build -f docker/server/Dockerfile -t srdc/tofhir-server:latest -t srdc/tofhir-server:1.0 . | ||
docker build -f docker/server/Dockerfile -t srdc/tofhir-server:latest . | ||
|
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 |
---|---|---|
@@ -1,23 +1,84 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
JAVA_CMD="java -jar " | ||
JAVA_CMD="java -Xms256m -Xmx3g -jar " | ||
|
||
# Configure application.conf path | ||
if [ ! -z "$APP_CONF_FILE" ]; then | ||
JAVA_CMD+="-Dconfig.file=$APP_CONF_FILE " | ||
JAVA_CMD+="-Dconfig.file=$APP_CONF_FILE " | ||
fi | ||
|
||
if [ ! -z "$FHIR_REPO_URL" ]; then | ||
JAVA_CMD+="-Dfhir.definitions-fhir-endpoint=$FHIR_REPO_URL " | ||
# Configure logback configuration file | ||
if [ ! -z "$LOGBACK_CONF_FILE" ]; then | ||
JAVA_CMD+="-Dlogback.configurationFile=$LOGBACK_CONF_FILE " | ||
fi | ||
|
||
if [ ! -z "$LOG_SERVER_BASE_URL" ]; then | ||
JAVA_CMD+="-webserver.log-server-base-url=$LOG_SERVER_BASE_URL " | ||
# Configure Spark | ||
if [ ! -z "$SPARK_APPNAME" ]; then | ||
JAVA_CMD+="-Dspark.app-name=$SPARK_APPNAME " | ||
fi | ||
if [ ! -z "$SPARK_MASTER" ]; then | ||
JAVA_CMD+="-Dspark.master=$SPARK_MASTER " | ||
fi | ||
|
||
# Finally, tell which jar to run | ||
JAVA_CMD+="/tofhir/tofhir-server-standalone.jar" | ||
# Configure toFHIR mapping-related paths | ||
if [ ! -z "$CONTEXT_PATH" ]; then | ||
JAVA_CMD+="-Dtofhir.context-path=$CONTEXT_PATH " | ||
fi | ||
if [ ! -z "$MAPPINGS_FOLDER" ]; then | ||
JAVA_CMD+="-Dtofhir.mappings.repository.folder-path=$MAPPINGS_FOLDER " | ||
fi | ||
if [ ! -z "$SCHEMAS_FOLDER" ]; then | ||
JAVA_CMD+="-Dtofhir.mappings.schemas.repository.folder-path=$SCHEMAS_FOLDER " | ||
fi | ||
if [ ! -z "$MAPPING_JOB" ]; then | ||
JAVA_CMD+="-Dtofhir.mapping-jobs.initial-job-file-path=$MAPPING_JOB " | ||
fi | ||
if [ ! -z "$FHIR_BATCH_SIZE" ]; then | ||
JAVA_CMD+="-Dtofhir.fhir-writer.batch-group-size=$FHIR_BATCH_SIZE " | ||
fi | ||
if [ ! -z "$DB_PATH" ]; then | ||
JAVA_CMD+="-Dtofhir.db-path=$DB_PATH " | ||
fi | ||
|
||
echo "Running command: $JAVA_CMD" | ||
# Configure the FHIR endpoint to which this toFHIR can connect to retrieve resource definitions etc. | ||
if [ ! -z "$FHIR_DEFINITIONS_ENDPOINT" ]; then | ||
JAVA_CMD+="-Dfhir.definitions-fhir-endpoint=$FHIR_DEFINITIONS_ENDPOINT " | ||
fi | ||
if [ ! -z "$FHIR_DEFINITIONS_ROOT_URL" ]; then | ||
JAVA_CMD+="-Dfhir.definitions-root-urls=$FHIR_DEFINITIONS_ROOT_URL " | ||
fi | ||
if [ ! -z "$FHIR_DEFINITIONS_PROFILES_PATH" ]; then | ||
JAVA_CMD+="-Dfhir.profiles-path=$FHIR_DEFINITIONS_ROOT_URL " | ||
fi | ||
if [ ! -z "$FHIR_DEFINITIONS_VALUESETS_PATH" ]; then | ||
JAVA_CMD+="-Dfhir.valuesets-path=$FHIR_DEFINITIONS_VALUESETS_PATH " | ||
fi | ||
if [ ! -z "$FHIR_DEFINITIONS_CODESYSTEMS_URL" ]; then | ||
JAVA_CMD+="-Dfhir.codesystems-path=$FHIR_DEFINITIONS_CODESYSTEMS_URL " | ||
fi | ||
|
||
# Configure tofhir-server web server | ||
if [ ! -z "$WEBSERVER_HOST" ]; then | ||
JAVA_CMD+="-Dwebserver.host=$WEBSERVER_HOST " | ||
fi | ||
if [ ! -z "$WEBSERVER_PORT" ]; then | ||
JAVA_CMD+="-Dwebserver.port=$WEBSERVER_PORT " | ||
fi | ||
if [ ! -z "$WEBSERVER_BASEURI" ]; then | ||
JAVA_CMD+="-Dwebserver.base-uri=$WEBSERVER_BASEURI " | ||
fi | ||
|
||
# Configure log service | ||
if [ ! -z "$LOG_SERVICE_ENDPOINT" ]; then | ||
JAVA_CMD+="-Dlog-service.endpoint=$LOG_SERVICE_ENDPOINT " | ||
fi | ||
|
||
# Delay the execution for this amount of seconds | ||
if [ ! -z "$DELAY_EXECUTION" ]; then | ||
sleep $DELAY_EXECUTION | ||
fi | ||
|
||
# Finally, tell which jar to run | ||
JAVA_CMD+="tofhir-server-standalone.jar" | ||
|
||
eval $JAVA_CMD | ||
eval $JAVA_CMD "$@" |
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 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 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 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
10 changes: 10 additions & 0 deletions
10
tofhir-server/src/main/scala/io/tofhir/server/config/LogServiceConfig.scala
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,10 @@ | ||
package io.tofhir.server.config | ||
|
||
import com.typesafe.config.Config | ||
|
||
import scala.util.Try | ||
|
||
class LogServiceConfig(logServiceConfig: Config) { | ||
/** Host name/address to start service on. */ | ||
lazy val logServiceEndpoint: String = Try(logServiceConfig.getString("endpoint")).getOrElse("http://localhost:8086/tofhir-log") | ||
} |
Oops, something went wrong.