TAMULib / SAGE

Search Aggregation Engine
MIT License
6 stars 2 forks source link

Enable support for multiple SOLR cores via Docker build arguments. #499

Closed kaladay closed 1 year ago

kaladay commented 1 year ago

Description

Adding additional cores for development and testing should be easier. The goal here is to make this easier by utilizing docker arguments.

The solr user is also abstracted into an argument for possible arg-based changes, if ever.

The default core is abstracted into MAIN_CORE docker build argument, with a default of sage-discovery. The additional cores are abstracted into EXTRA_CORES docker build argument. This is done primarily because docker has very poor (non-existent) loop and conditional handling. The COPY command needs to be performed in a loop or in conditions but such support is unavailable.

This takes the approach of checking if EXTRA_CORES is empty and if not loop over space separated core names. The MAIN_CORE must be pre-created so that the configuration can be copied. The copying of the configuration in this way avoids needing to use COPY and instead uses the system cp command.

The loops can continue on even in error so &&, ||, and exit 1 are used to guarantee that the loop fails on any error.

The two chmod commands are merged into a single command.

Example docker build usage:

docker build --build-arg=EXTRA_CORES="extra1 extra2" -t local_solr .
docker run -p 8983:8983 -it local_solr

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Checklist:

coveralls commented 1 year ago

Coverage Status

Coverage: 45.217% (-0.02%) from 45.24% when pulling 457550a8933b463166d34c669a5e17a2dac7e866 on additional_solr_cores into f55ca6e8b480efad415c6a60a2a31d20c2ff29a5 on staging.