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

[FEATURE] Introduce TYPO3_SOLR_ENABLED_CORES docker env variable #3503

Merged

Conversation

christophlehmann
Copy link
Contributor

@christophlehmann christophlehmann commented Feb 19, 2023

This adds a startup script which disables all unneeded cores.

Usage:

docker run -e 'TYPO3_SOLR_ENABLED_CORES=english german' -it typo3solr/ext-solr

This enables only the english and german core (core_en, core_de) during startup.

If the env variable is not set, then all cores are enabled (= default behaviour).

Resolves: #3502


Maintainers comments:

  • move all disabled cores to enabled, if TYPO3_SOLR_ENABLED_CORES is not specified.
  • Provide the docs
  • implement tests See dkd-kaehm comment
  • backport to
    • release-11.5.x
    • release-11.2.x
    • release-11.0.x

Copy link
Collaborator

@dkd-kaehm dkd-kaehm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@christophlehmann
Thanks for this nice feature.
Didn't know about docker-entrypoint-initdb.d/ possibility.

@dkd-kaehm
Copy link
Collaborator

The script of solr-ddev-site

https://github.com/TYPO3-Solr/solr-ddev-site/blob/dd776dad79d3ca405652124bb91e5b5d1fd732be/.ddev/solr/docker-overrides-entrypoint.sh

overrideSolrUnixUidAndGidAndSetPermissions ()
{
  if [[ -v SOLR_OVERRIDE_UID ]] && grep -E -q '^[0-9]+$' <<<"${SOLR_OVERRIDE_UID:-}"; then
    usermod --non-unique --uid "$SOLR_OVERRIDE_UID" solr
  fi

  if [[ -v SOLR_OVERRIDE_GID ]] && grep -E -q '^[0-9]+$' <<<"${SOLR_OVERRIDE_GID:-}"; then
    groupmod --non-unique --gid "$SOLR_OVERRIDE_GID" solr
  fi

  chown -R solr:solr /var/solr
}

overrideSolrUnixUidAndGidAndSetPermissions

can be adapted and moved there as well.

@brandung-sjorek
Copy link
Contributor

@christophlehmann In think the cibuild_docker.sh should be updated accordingly; or the github-action workflow which uses this script.

@dkd-kaehm Right?

@dkd-kaehm
Copy link
Collaborator

@christophlehmann In think the cibuild_docker.sh should be updated accordingly; or the github-action workflow which uses this script.

@dkd-kaehm Right?

The scripts inside of /docker-entrypoint-initdb.d are executed automatically, no needs to do something else as provided there.
See: https://github.com/apache/solr-docker/blob/3a61966de4da0ef7a3e9f2d29959d6bcb2ea117e/8.11/scripts/run-initdb

Also not more than the Docker-Image tests could be enriched for this stuff.

@brandung-sjorek
Copy link
Contributor

brandung-sjorek commented Feb 20, 2023

@dkd-kaehm Sorry, maybe I got you wrong. You want (as I suggested) @christophlehmann to implement a test in cibuild_docker.sh, to check if disabling cores works as expected. Correct?

@dkd-kaehm
Copy link
Collaborator

dkd-kaehm commented Feb 20, 2023

@dkd-kaehm Sorry, maybe I got you wrong. You want (as I suggested) @christophlehmann to implement a test in cibuild_docker.sh, to check if disabling cores works as expected. Correct?

Yes, if possible it would be nice to cover it with test cases.
For example:
First start with "de" and "en" and check that they only are enabled,
then remove "de" and add "da" and restart then check if "de" is gone and "da" is there.


PS: @brandung-sjorek I thought, your suggestion was for enabling this feature in image at all, not about test scenarios in build process.

@baschny
Copy link
Contributor

baschny commented Mar 13, 2023

👍 great feature, thx!

This adds a startup script which disables all unneeded cores.

Usage:

`docker run -e 'TYPO3_SOLR_ENABLED_CORES=english german' -it typo3solr/ext-solr`

This enables only the english and german core (core_en, core_de) during startup.

If the env variable is not set, then all cores are enabled (= default behaviour).

The additional cores can be enabled afterwards by adding them to the TYPO3_SOLR_ENABLED_CORES env. variable.

Fixes: TYPO3-Solr#3502
@dkd-kaehm dkd-kaehm merged commit 3d7bb1d into TYPO3-Solr:main Jun 7, 2023
@dkd-kaehm dkd-kaehm mentioned this pull request Oct 13, 2023
1 task
dkd-friedrich pushed a commit to dkd-friedrich/ext-solr that referenced this pull request Mar 13, 2024
This adds a startup script which disables all unneeded cores.

Usage:

`docker run -e 'TYPO3_SOLR_ENABLED_CORES=english german' -it typo3solr/ext-solr`

This enables only the english and german core (core_en, core_de) during startup.

If the env variable is not set, then all cores are enabled (= default behaviour).

The additional cores can be enabled afterwards by adding them to the TYPO3_SOLR_ENABLED_CORES env. variable.

Ports: TYPO3-Solr#3503
dkd-kaehm pushed a commit that referenced this pull request Apr 5, 2024
This adds a startup script which disables all unneeded cores.

Usage:

`docker run -e 'TYPO3_SOLR_ENABLED_CORES=english german' -it typo3solr/ext-solr`

This enables only the english and german core (core_en, core_de) during startup.

If the env variable is not set, then all cores are enabled (= default behaviour).

The additional cores can be enabled afterwards by adding them to the TYPO3_SOLR_ENABLED_CORES env. variable.

Ports: #3503
dkd-friedrich pushed a commit to dkd-friedrich/ext-solr that referenced this pull request Oct 30, 2024
This adds a startup script which disables all unneeded cores.

Usage:

`docker run -e 'TYPO3_SOLR_ENABLED_CORES=english german' -it typo3solr/ext-solr`

This enables only the english and german core (core_en, core_de) during startup.

If the env variable is not set, then all cores are enabled (= default behaviour).

The additional cores can be enabled afterwards by adding them to the TYPO3_SOLR_ENABLED_CORES env. variable.

Ports: TYPO3-Solr#3503
dkd-friedrich pushed a commit to dkd-friedrich/ext-solr that referenced this pull request Oct 30, 2024
This adds a startup script which disables all unneeded cores.

Usage:

`docker run -e 'TYPO3_SOLR_ENABLED_CORES=english german' -it typo3solr/ext-solr`

This enables only the english and german core (core_en, core_de) during startup.

If the env variable is not set, then all cores are enabled (= default behaviour).

The additional cores can be enabled afterwards by adding them to the TYPO3_SOLR_ENABLED_CORES env. variable.

Ports: TYPO3-Solr#3503
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.

[FEATURE] Disable cores in docker image easily
5 participants