Skip to content

Commit

Permalink
fixes, better db checks andtolerance
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Roeder CUAnschutz committed Jan 24, 2023
1 parent 08933f8 commit 78ce182
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,20 @@ The defaults are set up to run against a postgres database on the localhost at p

## Install, start and load:
- set environment variables for the database (PG* in the case of postgres) and the URL for htting the server (HAPI_R4)
- `$ source profile.sh`
- `$ source bin/profile.sh`
- fetch the HAPI CLI, a `ROOT.war` of the server, the aehrc fhir-owl converter and the TimsUI content
- `$ bin/install.sh`
- start the server
- `$ config/start-hapi.sh`
- `$ bin/start-hapi.sh`
- load the vocabularies
- `$ bin/loaders.sh`
- test with the Jupyter notebooks available at https://github.com/HOT-Ecosystem/TSDemoBoard
- assuming defaults, the `BASE_URL` there should be set in accord with values here, `BASE_URL =\"http://localhost:8001/fhir/"`
- test also with the TimsUI, installed as part of this installation, accessable at http://<server>:8001/static/index.html
- track server's progress by following the log
- `tail -f hapi.log`
- When necessary, stop with script that will stop all hapi servers on this server.
- `$ bin/stop-hapi.sh`

### Running things manually
This project is set up to run things automatically. However, it is possible to run some things manually, which may be useful for troubleshooting.
Expand Down
3 changes: 2 additions & 1 deletion bin/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ cd $TIMS_DIR/hapi
# DOWNLOAD the static content from TimsUI, put in $TIMS_DIR/static-files
if [[ ! -f TimsUI.tar ]] ; then
wget -q https://github.com/HOT-Ecosystem/TimsUI/releases/download/Jan_Connectathon/TimsUI_Jan_Connectathon.tar 2> /dev/null
mv TimsUI_Jan_Connectathon.tar TimsUI.tar
mkdir $TIMS_DIR/static-files
cd $TIMS_DIR/static-files
tar xvf $TIMS_DIR/hapi/TimsUI.tar
Expand Down Expand Up @@ -63,7 +64,7 @@ fi
#fi
# Edit application.yaml to point to $TIMS_DIR/static-files, and copy at the same time
cd $TIMS_DIR
cat $TIMS_DIR/hapi/application_pg.yaml | sed "s|XXstatic-filesXX|$TIMS_DIR/static-files/|g" >> $TIMS_DIR/hapi/application.yaml
cat $TIMS_DIR/hapi/application_pg.yaml | sed "s|XXstatic-filesXX|$TIMS_DIR/static-files/|g" > $TIMS_DIR/hapi/application.yaml

cd $TIMS_DIR/hapi

Expand Down
15 changes: 11 additions & 4 deletions bin/start-hapi.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail
set -uo pipefail

env | grep PG_
env | grep PG
if (( $? )) ; then
echo "ERROR:missing PG_* environment variables used in the applicaiton.yaml"
echo "These are distinct from the PG variables postgres uses that do not have underscores."
echo "ERROR:missing PG* environment variables used in the application.yaml"
exit 1
fi

psql -lqt | awk '{ print $1 }' | grep $PGDATABASE
if (( $? )) ; then
echo "INFO: databse \"$PGDATABASE\" does not exist, creating."
createdb $PGDATABASE
else
echo "INFO: found databse \"$PGDATABASE\"."
fi

# RUN
exec java -Xmx10G -jar "${TIMS_DIR}/hapi/ROOT.war" --spring.config.location="${TIMS_DIR}/hapi/" >> ${TIMS_DIR}/hapi.log &

0 comments on commit 78ce182

Please sign in to comment.