Migrated TransFAIR start logic from launch file to docker-compose

The start-up logic for TransFAIR is specific to the ECDC/EHDS2 Bridgehead,
and did not belong in the TransFAIR repo. This commit fixes that.

It also honours the change of the TransFAIR branch name for this
project, "ehds2".
This commit is contained in:
Gerhard Salvini 2024-03-26 17:00:42 +01:00
parent 4880c5cc9b
commit 1b82207934
3 changed files with 30 additions and 20 deletions

View File

@ -102,6 +102,12 @@ To get the right Beam certificate for your setup, you will need to edit the foll
- bbmri/modules/ehds2.root.crt.pem
- bbmri/modules/ehds2.test.root.crt.pem
You will also need to edit:
./bbmri/modules/ehds2-setup.sh
and set the broker address correctly for your site.
When you first start the Bridgehead, it will clone two extra repositories into /srv/docker, namely, focus and transfair. It will automatically build local images of these repositories for you. These components have the following functionality that has been customized for ECDC:
- *focus.* This component is responsible for completing the CQL that is used for running queries against the Blaze FHIR store. It uses a set of templates for doing this. Extra templates have been written for the ECDC use case.

View File

@ -46,26 +46,30 @@ services:
#WRITE_BUNDLES_TO_FILE: "true"
AMR_FILE_PATH: "/app/data"
restart: on-failure
#command: sh -c "sleep 60 && rm -rf /app/test/* && ([ ! -f "/app/lock" && ] && java -jar transFAIR.jar && touch "/app/lock) && tail -f /dev/null"
#command: sh -c "sleep 60 && rm -rf /app/test/* && java -jar transFAIR.jar && tail -f /dev/null"
#command: sh -c "echo listing /app/data && ls -la /app/data && /app/launch.sh"
#command: sh -c "echo listing /app/data && ls -la /app/data && [ "$(ls -A /app/data)" ] && [ ! -f "/app/data/lock" ] && /app/launch.sh & tail -f /dev/null"
#command: sh -c "echo listing /app/data && ls -la /app/data && [ ! -z "$(ls -A /app/data)" ] && [ ! -f "/app/data/lock" ] && /app/launch.sh & tail -f /dev/null"
#command: bash -c "echo listing /app/data && ls -la /app/data && [ ! -z "$(ls -A /app/data)" ] && [ ! -f "/app/data/lock" ] && /app/launch.sh & tail -f /dev/null"
#command: bash -c "echo listing /app/data && ls -la /app/data && [ ! -f "/app/data/lock" ] && /app/launch.sh & tail -f /dev/null"
#command: bash -c "echo listing /app/data && ls -la /app/data && [ ! -z "$(find /app/data -mindepth 1 -maxdepth 1)" ] && [ ! -f "/app/data/lock" ] && /app/launch.sh & tail -f /dev/null"
#command: bash -c "echo listing /app/data && ls -la /app/data && [ ! -z $(ls -A /app/data) ] && [ ! -f /app/data/lock ] && /app/launch.sh & tail -f /dev/null"
#command: bash -c "echo listing /app/data && ls -la /app/data && [ ! -f /app/data/lock ] && /app/launch.sh & tail -f /dev/null" # works!
#command: bash -c "echo listing /app/data && ls -la /app/data && [ ! -z `ls -A /app/data` ] && [ ! -f /app/data/lock ] && /app/launch.sh & tail -f /dev/null"
#command: bash -c "echo listing /app/data && ls -la /app/data && [ -f /app/data/*.csv ] && [ ! -f /app/data/lock ] && /app/launch.sh & tail -f /dev/null" # works!
command: bash -c "echo listing /app/data && ls -la /app/data && [ -f /app/data/*.[cC][sS][vV] ] && [ ! -f /app/data/lock ] && /app/launch.sh & tail -f /dev/null"
#command: sh -c "echo listing /app/data && ls -la /app/data && [ ! -z $(ls -A /app/data) ] && [ ! -f /app/data/lock ] && /app/launch.sh & tail -f /dev/null"
#command: sh -c "rm -rf /app/test/* && java -jar transFAIR.jar"
# The start up logic for TransFAIR is kind of complicated for the ECDC/EHDS2
# pilot. This is because we only want to run it if 1. there are source data
# files to be transformed and 2. if there is no lock file. We also need to
# wait for Blaze to start, TransFAIR does not check for this. And finally,
# once TransFAIR has finished loading data, a lock file is created, to stop
# a time-consuming repeat run.
command: bash -c " \
echo listing /app/data && \
ls -la /app/data && \
[ -f /app/data/*.[cC][sS][vV] ] && \
[ ! -f /app/data/lock ] && \
( \
echo 'Wait for Blaze to finish initializing' ; \
sleep 60 ; \
echo 'Remove old output files' ; \
rm -rf /app/test/* ; \
cd /app ; \
echo 'Run TransFAIR' ; \
java -jar transFAIR.jar ; \
echo 'Touching lock file' ; \
touch /app/data/lock \
) & tail -f /dev/null"
# If you put .csv files into ./../ecdc/data, TransFAIR will try to process them.
volumes:
#- /home/gerhard/Projects/EHDS2/PrototypeSpring2024/test/:/app/test/
#- /home/gerhard/Projects/EHDS2/PrototypeSpring2024/Data/:/app/data/
#- ../ecdc/test:/app/test/
#- ../ecdc/data:/app/data/
- ../../ecdc/test:/app/test/
- ../../ecdc/data:/app/data/

View File

@ -267,7 +267,7 @@ function clone_repo_if_nonexistent() {
function clone_transfair_if_nonexistent() {
local base_dir="$1"
clone_repo_if_nonexistent https://github.com/samply/transFAIR.git $base_dir/transfair main_ecdc_amt_prototype
clone_repo_if_nonexistent https://github.com/samply/transFAIR.git $base_dir/transfair ehds2
}
function clone_focus_if_nonexistent() {