FHIR icon indicating copy to clipboard operation
FHIR copied to clipboard

change where default datasource.xml looks for the derby db

Open lmsurpre opened this issue 3 years ago • 3 comments
trafficstars

Is your feature request related to a problem? Please describe. our default datasources.xml has this: <variable name="DB_LOC" defaultValue="derby"/> which is relative to the running server (e.g. /opt/wlp/usr/servers/defaultServer/derby).

our build/boostrap_derby.sh defaults to ${WORKSPACE}/derby but you can pass a specific path to bootstrap there instead.

Describe the solution you'd like Find a more consistent location to put the derby db by default.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Acceptance Criteria

  1. GIVEN [a precondition] AND [another precondition] WHEN [test step] AND [test step] THEN [verification step] AND [verification step]

Additional context Add any other context or screenshots about the feature request here.

lmsurpre avatar Jun 20 '22 16:06 lmsurpre

/opt/wlp/usr/servers/defaultServer is the default server.output.dir in liberty, so its not an unreasonable default.

the reason I made build/boostrap_derby.sh default to ${WORKSPACE}/derby (where WORKSPACE is the directory you've cloned/extracted the project repo to) is because i felt like having all the derby-related files under the server directory was slowing down some eclipse actions (when using the eclipse WTP which adds the server directory to your workspace).

a few ideas:

A. keep these two locations as the default but document the use of ${WORKSPACE}/derby for local development and make it simpler to use that during development... is there some way to get the resolved path so that we can just set that value directly in fhir-server-webapp/src/test/liberty/configDropins/overrides/datasource-derby.xml? With the Maven Liberty Plugin, we can accomplish that by adding a <liberty.var.DB_LOC>${project.basedir}/../derby</liberty.var.DB_LOC> property in the pom, but we don't have anything quite like that when using eclipse WTP

B. set DB_LOC to some other relative location / variable that exists further up in the tree. for example wlp.install.dir should be the root of the liberty installation and so we could probably have access to that reliably. see https://www.ibm.com/docs/en/was-liberty/base?topic=liberty-directory-locations-properties

C. set the default to something totally different like /opt/derby and use that all over. not sure what to do for windows in this case though...

lmsurpre avatar Jul 19 '22 19:07 lmsurpre

In the container image, the liberty output directory is actually at /opt/ol/wlp/output/defaultServer (and thus this is where derby will live on the container), so maybe it makes the most sense to use that location for dev env derby dbs as well?

the issue is that this directory doesn't exist by default? idea: maybe create it from our install script? can we set server.output.dir to that dir in our server.xml (or bootstrap.properties) and then use that variable from the datasource configDropins?

lmsurpre avatar Jul 22 '22 02:07 lmsurpre

from our install script, we create a directory called 'wlp'.

current behavior:

  • if invoked like ./install.sh dir1 it creates the server under dir1/wlp
  • if invoked like ./install.sh it creates the server under server-runtime/wlp

what we'd like:

use dir1/data as our default location for the database root (e.g. dir1/data/derby/fhirDB)

maybe have the install script create this data directory...although it will be empty at this point.

also update docs to steer folks to use build/bootstrap_db.sh [install_dir]/data when bootstrapping derby

lmsurpre avatar Oct 04 '22 13:10 lmsurpre