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

Upgrade Solr version to 9.7.0 and other dependencies #59

Draft
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

yvanzo
Copy link
Contributor

@yvanzo yvanzo commented Nov 22, 2024

Upgrade Solr version from 9.6.1 to 9.7.0 released in September (noticeably upgrading Lucene version to 9.11.1).

For references, please see commit message.

It follows the pull request #58.

Besides, it has been checked that neither mmd-schema nor mbsssss need any update to work with this new version.

yvanzo and others added 18 commits June 19, 2024 11:44
Nowadays, those two Solr Docker images don’t just a differ by their base
Docker image, they don’t provide the same Solr binary package. The full
version includes first-party Solr modules such as `prometheus-exporter`.

Reference: https://solr.apache.org/guide/solr/9_6/deployment-guide/solr-in-docker.html#available-images
Upgrade both Docker base image and Maven dependencies.

A noticeable upgrade in library dependencies is Lucene 9.11.1.

References:

- https://solr.apache.org/guide/solr/latest/upgrade-notes/major-changes-in-solr-9.html#solr-9-7
- https://solr.apache.org/docs/9_7_0/changes/Changes.html
It was probably useful to skip and continue during development,
but it is safer to exit for any error when used in production.

It additionally captures errors from subshells and pipes.
The configuration file `solr.xml` was installed under the directory
`/var/solr/data` in the image, however this directory is actually
bound to a volume using Docker Compose.

This patch is threefold:

1. It copies the whole content of `mbsssss` to the image,
   under a directory never looked after by Solr,
   to help with uploading configsets later on.
2. It adds an init script that runs on container startup and installs
   the configuration file if missing under the directory `$SOLR_HOME`
   (`/var/solr/data`).
3. It fixes creating the directory `/var/solr/data` in the image as it
   is used for mounting volume. It would otherwise be created with the
   ownership `root:root` thus failing startup with the following error:

        /opt/solr/docker/scripts/solr-foreground: running /docker-entrypoint-initdb.d/10-install-musicbrainz-conf.sh
        Installing Solr configuration file...
        install: cannot create regular file '/var/solr/data/solr.xml': Permission denied
Some directories under `/var/solr` were created in the image,
and only `/var/solr/data` was mounted to a Docker volume.

However, the directories under `/var/solr` are supposed to be created by
the script `init-var-solr`, they include logs too, and the only example
of Docker volume given in Solr documentation is bound to `/var/solr`.

This patch follows the documentation so as to simplify the Docker image,
to avoid directory ownership issues, and to persistently keep Solr logs.

Reference: https://solr.apache.org/guide/solr/9_7/deployment-guide/solr-in-docker.html#docker-compose
1. Install the command `zip` needed by the script
2. Install the script under a directory part of `$PATH`
3. Make the script use the copy of `mbsssss` from the image
To speed up the container startup, zip the Musicbrainz Solr configsets
directly in the image so that it doesn’t need to be zipped at run time.

The script is still able to zip configsets if needed for development.
These scripts are distributed within the Solr Docker image but they do
not support the SolrCloud mode. The intend of copying these is to make a
derived version to support initializing a Solr instance in SolrCloud
mode using the MusicBrainz Simple Solr Search Server Schema (mbsssss).

* start-local-solrcloud is copied from start-local-solr
* start-musicbrainz-solrcloud is copied from start-create

The license file is updated accordingly with the Apache License 2.0.
Previously, it started locally in standalone mode.
Previously, the script was creating a core in standalone mode.
It assumes that there is no data. To test, run the following commands:

    docker compose down --volumes
    docker compose build
    docker compose up
@yvanzo
Copy link
Contributor Author

yvanzo commented Jan 20, 2025

Thanks for the script @amCap1712. I fixed a few things, including the mounted data volume, and derived your script and Solr helper scripts to create collections on container startup. See the last commit message.
It is still assuming that there is no data (you have to run solr-foreground --cloud otherwise), some checks have to be added to detect obsolete Solr 7 data and expected Solr 9 data after a first run.
There are also a few warnings in the container logs that have to be addressed.

@yvanzo
Copy link
Contributor Author

yvanzo commented Jan 29, 2025

  • Improved creating empty collections at first run only.
  • Cleaned up the output on @mwiencek's request
  • Added the removal of Solr 7 data

I built an image tagged 4.0.0-alpha3 and updated the branch solr9fg of musicbrainz-docker accordingly.

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.

2 participants