diff --git a/Dockerfile b/Dockerfile index 04a9e568c..2c275e098 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:24.04 as builder +FROM ubuntu:24.04 AS builder ENV DEBIAN_FRONTEND=noninteractive @@ -46,8 +46,8 @@ RUN mkdir -p /work/fhirserver/exec/install/bin && \ mkdir -p /work/fhirserver/exec/install/x86_64 && \ mkdir -p /work/fhirserver/exec/install/content && \ mkdir -p /work/fhirserver/exec/install/config && \ - mkdir -p /work/fhirserver/exec/install/config/config && \ - mkdir -p /work/fhirserver/exec/install/config/default_config && \ + # mkdir -p /work/fhirserver/exec/install/config/config && \ + mkdir -p /work/fhirserver/exec/install/default_config && \ mkdir -p /work/fhirserver/exec/install/web RUN cd /work/fhirserver && \ @@ -56,18 +56,26 @@ RUN cd /work/fhirserver && \ cp /work/fhirserver/exec/64/FHIRConsole /work/fhirserver/exec/install/bin && \ cp /work/fhirserver/exec/pack/linux/*so* /work/fhirserver/exec/install/x86_64 -RUN cp /work/fhirserver/exec/pack/linux/start_bare.sh /work/fhirserver/exec/install/bin/start.sh && \ +RUN cp /work/fhirserver/exec/pack/linux/start.sh /work/fhirserver/exec/install/bin/start.sh && \ cp /work/fhirserver/exec/pack/linux/install.sh /work/fhirserver/exec/install && \ cp /work/fhirserver/exec/pack/linux/get-openssl.sh /work/fhirserver/exec/install && \ cp /tmp/openssl-1.1.1w/*.so* /work/fhirserver/exec/install/x86_64 && \ cp /work/fhirserver/exec/pack/*.properties /work/fhirserver/exec/install/content && \ cp /work/fhirserver/exec/pack/*.dat /work/fhirserver/exec/install/content && \ + cp /work/fhirserver/exec/pack/fhirserver.cfg /work/fhirserver/exec/install/config && \ cp /work/fhirserver/exec/pack/web.ini /work/fhirserver/exec/install/config && \ - cp /work/fhirserver/config/config.ini /work/fhirserver/exec/install/config/config && \ - cp /work/fhirserver/config/config_bare.json /work/fhirserver/exec/install/config/config/config.json && \ - cp /work/fhirserver/config/config.ini /work/fhirserver/exec/install/config/default_config && \ - cp /work/fhirserver/config/config_bare.json /work/fhirserver/exec/install/config/default_config/config.json && \ + + + cp /work/fhirserver/exec/pack/web.ini /work/fhirserver/exec/install/default_config && \ + cp /work/fhirserver/exec/pack/fhirserver.cfg /work/fhirserver/exec/install/default_config && \ + cp /work/fhirserver/config/config.ini /work/fhirserver/exec/install/default_config/config.ini && \ + cp /work/fhirserver/config/config.json /work/fhirserver/exec/install/default_config/config.json && \ + # cp /work/fhirserver/config/config.ini /work/fhirserver/exec/install/config/config.ini && \ + + # cp /work/fhirserver/config/config_bare.json /work/fhirserver/exec/install/default_config/config.json && \ + # cp /work/fhirserver/config/config.ini /work/fhirserver/exec/install/config/default_config && \ + mkdir -p /work/fhirserver/exec/install/web && \ cp -r /work/fhirserver/server/web/* /work/fhirserver/exec/install/web && \ cd /work/fhirserver/exec && tar -czvf ./install.tgz ./install/ && ls -la /work/fhirserver/exec @@ -78,9 +86,9 @@ HEALTHCHECK --interval=1m --timeout=10s --retries=5 \ CMD curl -f http://localhost:${PORT}/fhir/metadata || exit 1 # Set the environment variables -ENV DISPLAY :99 -ENV PORT 80 -ENV TERMINOLOGY_CACHE /terminology +ENV DISPLAY=:99 +ENV PORT=80 +ENV TERMINOLOGY_CACHE=/terminology VOLUME /terminology ENV DEBIAN_FRONTEND= @@ -92,7 +100,7 @@ ENV DEBIAN_FRONTEND= # Runtime stage -FROM ubuntu:24.04 as runtime +FROM ubuntu:24.04 AS runtime ENV DEBIAN_FRONTEND=noninteractive ENV TZ=UTC @@ -132,7 +140,7 @@ WORKDIR /fhirserver/install ## # 1. Run the installation script for a blank, clean install -RUN chmod a+x ./install.sh && ./install.sh -nodaemon +RUN chmod a+x ./install.sh && ./install.sh # OR @@ -144,6 +152,7 @@ RUN chmod a+x ./install.sh && ./install.sh -nodaemon ## #################################################################### +WORKDIR /root/fhirserver # Define entrypoint and command CMD ["bash", "-c", "cd ~/fhirserver/ && ./start.sh"] diff --git a/Dockerfile prev b/Dockerfile prev new file mode 100644 index 000000000..5a2816485 --- /dev/null +++ b/Dockerfile prev @@ -0,0 +1,152 @@ +FROM ubuntu:22.04 as builder + +ENV DEBIAN_FRONTEND=noninteractive + + +RUN apt update && apt install -y tzdata wget git unixodbc-dev libgtk2.0-dev xvfb sqlite3 libsqlite3-dev build-essential curl binutils + +# Download and build OpenSSL 1.1.1w +WORKDIR /tmp +RUN wget https://www.openssl.org/source/openssl-1.1.1w.tar.gz \ + && tar -xf openssl-1.1.1w.tar.gz \ + && cd openssl-1.1.1w \ + && ./config \ + && make \ + && make test \ + && make install + +RUN ls -la /usr/local/lib/ + +# Set the timezone +RUN echo "UTC" > /etc/timezone + +RUN cd /tmp && \ + wget https://dev.mysql.com/get/Downloads/Connector-ODBC/8.0/mysql-connector-odbc-8.0.26-linux-glibc2.12-x86-64bit.tar.gz && \ + tar -xzvf mysql-connector-odbc-8.0.26-linux-glibc2.12-x86-64bit.tar.gz && \ + cp -r mysql-connector-odbc-8.0.26-linux-glibc2.12-x86-64bit/lib/* /usr/local/lib && \ + cp -r mysql-connector-odbc-8.0.26-linux-glibc2.12-x86-64bit/bin/* /usr/local/bin && \ + rm -rf mysql-connector-odbc-8.0.26-linux-glibc2.12-x86-64bit && \ + rm -rf mysql-connector-odbc-8.0.26-linux-glibc2.12-x86-64bit.tar.gz && \ + myodbc-installer -a -d -n "MySQL ODBC 8.0 Driver" -t "Driver=/usr/local/lib/libmyodbc8w.so" && \ + myodbc-installer -a -d -n "MySQL ODBC 8.0" -t "Driver=/usr/local/lib/libmyodbc8a.so" + +COPY build/linux-toolchain.sh build/linux-libraries.sh /work/bootstrap/ +RUN /work/bootstrap/linux-toolchain.sh /work/bootstrap + +WORKDIR /work/fhirserver +COPY . /work/fhirserver + +RUN /work/bootstrap/linux-libraries.sh /work/bootstrap +RUN cp /usr/local/lib/*.so* /usr/lib/ +RUN /work/fhirserver/build/linux-fhirserver.sh /work/bootstrap +RUN cp exec/pack/*.properties exec/64 +# RUN cp exec/install/* exec/64 + +RUN mkdir -p /work/fhirserver/exec/install/bin +RUN mkdir -p /work/fhirserver/exec/install/x86_64 +RUN mkdir -p /work/fhirserver/exec/install/content +RUN mkdir -p /work/fhirserver/exec/install/config +RUN mkdir -p /work/fhirserver/exec/install/config/config +RUN mkdir -p /work/fhirserver/exec/install/web + +RUN cd /work/fhirserver +RUN cp /work/fhirserver/exec/64/fhirserver /work/fhirserver/exec/install/bin +RUN cp /work/fhirserver/exec/64/FHIRToolkit /work/fhirserver/exec/install/bin +RUN cp /work/fhirserver/exec/64/FHIRConsole /work/fhirserver/exec/install/bin +RUN cp /work/fhirserver/exec/pack/linux/*so* /work/fhirserver/exec/install/x86_64 +RUN cp /work/fhirserver/exec/pack/linux/start.sh /work/fhirserver/exec/install/bin +RUN cp /work/fhirserver/exec/pack/linux/install.sh /work/fhirserver/exec/install +RUN cp /work/fhirserver/exec/pack/linux/get-openssl.sh /work/fhirserver/exec/install +RUN cp /tmp/openssl-1.1.1w/*.so* /work/fhirserver/exec/install/x86_64 +RUN cp /work/fhirserver/exec/pack/*.properties /work/fhirserver/exec/install/content +RUN cp /work/fhirserver/exec/pack/*.dat /work/fhirserver/exec/install/content +RUN cp /work/fhirserver/exec/pack/fhirserver.cfg /work/fhirserver/exec/install/config +RUN cp /work/fhirserver/exec/64/web.ini /work/fhirserver/exec/install/config +RUN cp /work/fhirserver/config/config.ini /work/fhirserver/exec/install/config/config +RUN mkdir -p /work/fhirserver/exec/install/web +RUN cp -r /work/fhirserver/server/web/* /work/fhirserver/exec/install/web + +RUN cd /work/fhirserver/exec && tar -czvf ./install.tgz ./install/ && ls -la /work/fhirserver/exec + + +# Set the health check +HEALTHCHECK --interval=1m --timeout=10s --retries=5 \ + CMD curl -f http://localhost:${PORT}/fhir/metadata || exit 1 + +# Set the environment variables +ENV DISPLAY :99 +ENV PORT 80 +ENV TERMINOLOGY_CACHE /terminology +VOLUME /terminology + +ENV DEBIAN_FRONTEND= + +RUN printf '#!/bin/bash \n\ + set -e \n\ + start_xvfb() { \n\ + Xvfb :99 -screen 0 1024x768x8 -nolisten tcp & \n\ + } \n\ + stop_xvfb() { \n\ + killall Xvfb || true \n\ + } \n\ + trap stop_xvfb SIGTERM \n\ + rm -f /tmp/.X99-lock \n\ + start_xvfb \n\ + echo "[web]" > /work/fhirserver/exec/64/web.ini; \n\ + echo "http=${PORT}" >> /work/fhirserver/exec/64/web.ini; \n\ + /work/fhirserver/exec/64/fhirserver $(eval echo "$@")' > /bin/entrypoint.sh && \ + chmod +x /bin/entrypoint.sh + + +# ENTRYPOINT ["/bin/entrypoint.sh"] + +# CMD ["-cmd", "exec", "-cfg", "/config/config.ini", "-local", "$TERMINOLOGY_CACHE"] + + + +# Runtime stage +FROM ubuntu:22.04 as runtime + +ENV DEBIAN_FRONTEND=noninteractive +ENV TZ=UTC +# Set up environment variables +# ENV HOME=~/ +ENV DISPLAY=:99 +ENV PORT=80 +ENV TERMINOLOGY_CACHE=/var/cache/txcache + +# Install runtime dependencies +RUN apt-get update && apt-get install -y wget tzdata xvfb libgtk2.0-0 libsqlite3-dev \ + && rm -rf /var/lib/apt/lists/* \ + && mkdir -p $HOME/fhirserver/config $TERMINOLOGY_CACHE /fhirserver \ + && chmod -R 777 $TERMINOLOGY_CACHE \ + && chmod -R 777 /fhirserver + +# Copy necessary files from the builder stage +COPY --from=builder /work/fhirserver/exec/install.tgz /fhirserver/install.tgz + +# RUN cd /fhirserver \ +# && tar -xzvf install.tgz \ +# && cd ./install \ +# && ./install.sh > install.log 2>&1 + +# Assuming /fhirserver is your working directory +WORKDIR /fhirserver + +# Extract the contents of the tar file +RUN tar -xzvf install.tgz + +# Change working directory to the extracted folder +WORKDIR /fhirserver/install + +# Run the installation script +RUN ./install.sh -nodaemon + # -zero=https://storage.googleapis.com/tx-fhir-org/config.json +### Uncomment and append this line above to the install script, to allow the initial tx config to be loaded + + +# Define entrypoint and command +CMD ["bash", "-c", "cd ~/fhirserver/ && ./start.sh"] + +# Expose the necessary port +EXPOSE 80 \ No newline at end of file diff --git a/FastMM4_AVX512.obj b/FastMM4_AVX512.obj new file mode 100644 index 000000000..25a677b75 Binary files /dev/null and b/FastMM4_AVX512.obj differ diff --git a/config/config.ini b/config/config.ini index cc86ee603..a051cb8a6 100644 --- a/config/config.ini +++ b/config/config.ini @@ -1,5 +1,5 @@ [config] -zero=file:/root/fhirserver/config +zero=file:/root/fhirserver/default_config version=* local=/var/cache/txcache user=gg diff --git a/config/config.json b/config/config.json new file mode 100644 index 000000000..302dc0314 --- /dev/null +++ b/config/config.json @@ -0,0 +1,19 @@ +{ + "content" : { + "uv" : { + "packages" : { + "r4" : [ + "hl7.terminology.r4", + "fhir.tx.support.r4" + ] + } + } + }, + "endpoints" : { + "cache" : { + "path" : "/post/tx-cache", + "type" : "folder", + "folder": "/var/cache/txcache" + } + } +} diff --git a/config/config_bare.json b/config/config_bare.json deleted file mode 100644 index 1149b3fa7..000000000 --- a/config/config_bare.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "history" : [ - ], - "content" : { - "uv" : { - "files" : { - }, - "packages" : { - "r5" : [ - "hl7.terminology.r4", - "fhir.tx.support.r4", - "ihe.formatcode.fhir", - "fhir.dicom" - ], - "r4" : [ - "hl7.terminology.r4", - "fhir.tx.support.r4", - "ihe.formatcode.fhir", - "fhir.dicom" - ], - "r3" : [ - "hl7.terminology.r3#4.0.0", - "fhir.tx.support.r3" - ], - "r2" : [ - "fhir.tx.support.r2" - ] - } - } - }, - "endpoints" : { - "sct" : { - "path" : "/snomed", - "type" : "snomed" - }, - "ln" : { - "path" : "/loinc", - "type" : "loinc" - }, - "cache" : { - "path" : "/post/tx-cache", - "type" : "folder", - "folder" : "/var/cache/txcache" - } - } - } - \ No newline at end of file diff --git a/exec/pack/fhirserver.web b/exec/pack/fhirserver.web deleted file mode 100644 index 1e7d4cd0c..000000000 Binary files a/exec/pack/fhirserver.web and /dev/null differ diff --git a/exec/pack/linux/install.sh b/exec/pack/linux/install.sh index 9c77e33d4..47f6130e1 100644 --- a/exec/pack/linux/install.sh +++ b/exec/pack/linux/install.sh @@ -20,15 +20,6 @@ run_as_root() { fi } -INSTALL_AS_DAEMON=1 -CONFIG_URL="" -for arg in "$@"; do - case $arg in - -nodaemon ) INSTALL_AS_DAEMON=0 ;; - -zero=* ) CONFIG_URL="${arg#*=}" ;; - esac -done - run_as_root apt update && run_as_root apt install -y wget tzdata xvfb libgtk2.0-0 libsqlite3-dev curl mkdir -p $INSTALL_PATH @@ -39,19 +30,13 @@ run_as_root chmod 1777 $CACHE_FOLDER cp bin/* $INSTALL_PATH cp content/* $INSTALL_PATH -cp -r config/* $INSTALL_PATH -cp -r config/config/* $INSTALL_PATH/config -cp -r config/config/* $INSTALL_PATH/default_config +# cp -r config/* $INSTALL_PATH +# cp -r config/config/* $INSTALL_PATH/config +cp -r config/* $INSTALL_PATH/config +cp -r default_config/* $INSTALL_PATH/default_config cp -r web $INSTALL_PATH -# Download and place the configuration file -if [ -n "$CONFIG_URL" ]; then - wget "$CONFIG_URL" -O "$INSTALL_PATH/config/config.json" -else - cp "$INSTALL_PATH/default_config/config.json" "$INSTALL_PATH/config/config.json" -fi - -# Copy files based on architecture +# Files based on architecture case $ARCH in x86_64) cp $X86_64_FILES/* $INSTALL_PATH @@ -65,15 +50,15 @@ case $ARCH in ;; esac -# Create a symlink to the executable -ln -s $INSTALL_PATH/fhirserver/start.sh /usr/local/bin/fhirserver +# Create link so that the server can be started from anywhere +ln -s $INSTALL_PATH/start.sh /usr/local/bin/fhirserver + +# Copy the default configuration file +cp "$INSTALL_PATH/default_config/config.json" "$INSTALL_PATH/default_config/config.json" -# Install as a daemon if not contained -if [ "$INSTALL_AS_DAEMON" -eq 1 ]; then - # Create a systemd service file or equivalent - echo "Installing as a daemon..." - SERVICE_FILE="/etc/systemd/system/fhirserver.service" - echo "[Unit] +# Prepare and install the systemd service file but do not enable or start it +SERVICE_FILE="/etc/systemd/system/fhirserver.service" +echo "[Unit] Description=FHIR Server [Service] @@ -81,12 +66,8 @@ ExecStart=$INSTALL_PATH/fhirserver # Add other service configurations as needed [Install] -WantedBy=multi-user.target" > $SERVICE_FILE +WantedBy=multi-user.target" | run_as_root tee $SERVICE_FILE > /dev/null - systemctl enable fhirserver.service - systemctl start fhirserver.service -else - echo "Skipping daemon installation." -fi +echo "Installation to $INSTALL_PATH completed." -echo "Installation to $INSTALL_PATH completed." \ No newline at end of file +cd $INSTALL_PATH \ No newline at end of file diff --git a/exec/pack/linux/start.sh b/exec/pack/linux/start.sh index 70a4a87c4..f7e4aedba 100644 --- a/exec/pack/linux/start.sh +++ b/exec/pack/linux/start.sh @@ -1,16 +1,17 @@ #!/bin/bash set -e +# Determine the directory where this script is located (this will be $HOME/fhirserver) +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +SERVICE_FILE="/etc/systemd/system/fhirserver.service" + +# Function to start Xvfb start_xvfb() { Xvfb :99 -screen 0 1024x768x8 -nolisten tcp & sleep 2 # Give some time for Xvfb to start } -# get the default config if the config folder is empty (e.g. when mounted as a volume) -if [ -z "$(ls -A /root/fhirserver/config)" ]; then - cp /root/fhirserver/default_config/* /root/fhirserver/config/ -fi - +# Function to stop Xvfb stop_xvfb() { pkill Xvfb || true } @@ -21,4 +22,40 @@ rm -f /tmp/.X99-lock start_xvfb export DISPLAY=:99 -./fhirserver -cmd exec -cfg $HOME/fhirserver/config/config.ini \ No newline at end of file +# Parse command-line arguments +DAEMON_MODE="" + +for arg in "$@"; do + case $arg in + -daemon) + DAEMON_MODE="enable" + ;; + -nodaemon) + DAEMON_MODE="disable" + ;; + esac +done + +# Determine which config.ini to use +if [ -f "$SCRIPT_DIR/config/config.ini" ]; then + CONFIG_FILE="$SCRIPT_DIR/config/config.ini" +else + CONFIG_FILE="$SCRIPT_DIR/default_config/config.ini" +fi + +if [ ! -f "$SCRIPT_DIR/config/config.json" ]; then + cp "$SCRIPT_DIR/default_config/config.json" "$SCRIPT_DIR/config/config.json" + echo "File copied successfully." +fi + +# Handle daemon management +if [ "$DAEMON_MODE" == "enable" ]; then + sudo systemctl enable fhirserver.service + sudo systemctl start fhirserver.service +elif [ "$DAEMON_MODE" == "disable" ]; then + sudo systemctl stop fhirserver.service || true + sudo systemctl disable fhirserver.service || true +fi + +# Start the FHIR server using the determined config file +exec "$SCRIPT_DIR/fhirserver" -cmd exec -cfg "$CONFIG_FILE" diff --git a/exec/pack/linux/start_bare.sh b/exec/pack/linux/start_bare.sh deleted file mode 100644 index 70a4a87c4..000000000 --- a/exec/pack/linux/start_bare.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -set -e - -start_xvfb() { - Xvfb :99 -screen 0 1024x768x8 -nolisten tcp & - sleep 2 # Give some time for Xvfb to start -} - -# get the default config if the config folder is empty (e.g. when mounted as a volume) -if [ -z "$(ls -A /root/fhirserver/config)" ]; then - cp /root/fhirserver/default_config/* /root/fhirserver/config/ -fi - -stop_xvfb() { - pkill Xvfb || true -} - -trap stop_xvfb EXIT - -rm -f /tmp/.X99-lock -start_xvfb -export DISPLAY=:99 - -./fhirserver -cmd exec -cfg $HOME/fhirserver/config/config.ini \ No newline at end of file diff --git a/library/fhir3/fhir3_utilities.pas b/library/fhir3/fhir3_utilities.pas index ee6508277..c6afefc48 100644 --- a/library/fhir3/fhir3_utilities.pas +++ b/library/fhir3/fhir3_utilities.pas @@ -6905,7 +6905,4 @@ function TFHIRPractitionerRoleHelper.summary: String; begin result := '??'; end; - end. - - diff --git a/library/fhir4/fhir4_utilities.pas b/library/fhir4/fhir4_utilities.pas index f1d619051..fd9832e95 100644 --- a/library/fhir4/fhir4_utilities.pas +++ b/library/fhir4/fhir4_utilities.pas @@ -7597,4 +7597,3 @@ function TFhirBundleEntryListHelper.append(url: String): TFHIRBundleEntry; end; end. - diff --git a/library/fhir4b/fhir4b_utilities.pas b/library/fhir4b/fhir4b_utilities.pas index d6a512bf8..200a89ac0 100644 --- a/library/fhir4b/fhir4b_utilities.pas +++ b/library/fhir4b/fhir4b_utilities.pas @@ -7491,6 +7491,4 @@ function TFhirBundleEntryListHelper.append(url: String): TFHIRBundleEntry; result := append; result.fullUrl := url; end; - end. - diff --git a/library/fhir5/fhir5_utilities.pas b/library/fhir5/fhir5_utilities.pas index 3d9d1c897..bb7ee41e3 100644 --- a/library/fhir5/fhir5_utilities.pas +++ b/library/fhir5/fhir5_utilities.pas @@ -7082,5 +7082,6 @@ function TFHIRPractitionerRoleHelper.summary: String; result := '??'; end; + end. diff --git a/library/web/fsl_npm_cache.pas b/library/web/fsl_npm_cache.pas index 8ad59c426..92b81fbee 100644 --- a/library/web/fsl_npm_cache.pas +++ b/library/web/fsl_npm_cache.pas @@ -98,7 +98,6 @@ TFHIRPackageManager = class (TFslObject) FCache : TFslMap; FTaskDesc : String; FCaching : boolean; - function PathForPackage(id, ver : String; allowed : TSemanticVersionLevel = semverMinor) : String; function loadArchive(content : TBytes; description : String) : TDictionary; procedure clearCache; @@ -106,7 +105,6 @@ TFHIRPackageManager = class (TFslObject) procedure work(pct : integer; done : boolean; desc : String); procedure progress(sender : TObject; pct : integer); function check(desc : String) : boolean; - function loadPackageFromCache(folder : String) : TNpmPackage; procedure buildPackageIndex(folder : String); function latestPackageVersion(id: String): String; function isIgnored(s : String): boolean; @@ -134,9 +132,11 @@ TFHIRPackageManager = class (TFslObject) procedure ListAllPackages(list : TFslList); overload; function packageExists(id, ver : String; allowed : TSemanticVersionLevel = semverMinor) : boolean; overload; + function PathForPackage(id, ver : String; allowed : TSemanticVersionLevel = semverMinor) : String; function autoInstallPackage(id, ver : String) : boolean; overload; function latestPublishedVersion(id : String) : String; + function loadPackageFromCache(folder : String) : TNpmPackage; function loadPackage(id : String) : TNpmPackage; overload; function loadPackage(id, ver : String) : TNpmPackage; overload; procedure loadPackage(id, ver : String; resources : Array of String; loadInfo : TPackageLoadingInformation); overload; diff --git a/server/endpoint_txsvr.pas b/server/endpoint_txsvr.pas index cd868495e..a652716ad 100644 --- a/server/endpoint_txsvr.pas +++ b/server/endpoint_txsvr.pas @@ -263,12 +263,13 @@ TTerminologyServerWebServer = class (TStorageWebEndpoint) TTerminologyServerEndPoint = class (TStorageEndPoint) private - FStore : TTerminologyFhirServerStorage; +// FStore : TTerminologyFhirServerStorage; UTGFolder : String; FWeb : TTerminologyServerWebServer; FLoadThread : TTerminologyServerDataLoadThread; function version : TFHIRVersion; public + FStore : TTerminologyFhirServerStorage; constructor Create(config : TFHIRServerConfigSection; settings : TFHIRServerSettings; db : TFDBManager; common : TCommonTerminologies; pcm : TFHIRPackageManager; i18n : TI18nSupport); destructor Destroy; override; function summary : String; override; @@ -1414,10 +1415,25 @@ procedure TTerminologyFhirServerStorage.loadPackage(pid: String; ignoreEmptyCode i : integer; list : TFslList; pi : TNpmPackageResource; + fileToLoad: string; begin i := 0; - npm := FServerContext.pcm.loadPackage(pid); + +// FEndPoint. +fileToLoad := filePath([FServerContext.pcm.folder,pid]) ; + + + if (FileExists(fileToLoad)) then + try + npm := FServerContext.pcm.loadPackageFromCache(fileToLoad) + except + on e : Exception do + Logging.log('Error loading package from file '+fileToLoad+': '+e.message); + end + else + npm := FServerContext.pcm.loadPackage(pid); + try Logging.start('Load package '+npm.name+'#'+npm.version); try diff --git a/server/fhirserver.lpi b/server/fhirserver.lpi index 51f521a65..c5bb8285d 100644 --- a/server/fhirserver.lpi +++ b/server/fhirserver.lpi @@ -21,7 +21,6 @@ - diff --git a/server/fhirserver.lpr b/server/fhirserver.lpr index d06adcb2c..f752eda08 100644 --- a/server/fhirserver.lpr +++ b/server/fhirserver.lpr @@ -32,7 +32,7 @@ uses {$IFDEF WINDOWS} - FastMM4, + //FastMM4, {$ELSE} cmem, cthreads, diff --git a/server/kernel.pas b/server/kernel.pas index 30bc5ed38..41c9ef5e7 100644 --- a/server/kernel.pas +++ b/server/kernel.pas @@ -33,7 +33,7 @@ interface Uses - {$IFDEF WINDOWS} Windows, ActiveX, FastMM4, {$ENDIF} + {$IFDEF WINDOWS} Windows, ActiveX, {$ENDIF} SysUtils, StrUtils, Classes, IniFiles, Forms, {$IFDEF FPC} gui_lcl, Interfaces, {$ELSE} gui_vcl, {$ENDIF} @@ -936,7 +936,7 @@ procedure ExecuteFhirServer(params : TCommandLineParameters); else begin {$IFDEF WINDOWS} - noFMMLeakMessageBox := true; + //noFMMLeakMessageBox := true; {$ENDIF} SuppressLeakDialog := true; end;