Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jan 12, 2023

Conversation

kaladay
Copy link
Contributor

@kaladay kaladay commented Jan 12, 2023

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.

  • New feature (non-breaking change which adds functionality)

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

  • Manual

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

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 .
```
@coveralls
Copy link

Coverage Status

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

@kaladay kaladay merged commit b9bca09 into staging Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants