Repository navigation
[#3307] Recreated the Solr core from the image config-set on every start so config-set changes reach existing cores. - #3308
AlexSkrypnyk wants to merge 8 commits into
Conversation
… an existing volume.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
📖 Documentation preview for this pull request has been deployed to Netlify: https://6af42782b9013a21238473d1--vortex-docs.netlify.app This preview is rebuilt on every commit and is not the production documentation site. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Code coverage (threshold: 90%) Per-class coverage |
|
Code coverage (threshold: 90%) Per-class coverage |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3308 +/- ##
=======================================
Coverage 92.50% 92.50%
=======================================
Files 116 116
Lines 5240 5240
Branches 49 49
=======================================
Hits 4847 4847
Misses 393 393 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Closes #3307
Summary
The
solrcontainer now starts withsolr-recreate drupal /solr-conf && exec solr-foreground. On every start, thedrupalcore directory on the volume is deleted and rebuilt from the config-set baked into the image, and then Solr starts. The index is kept, because thedataDirrewrite in.docker/solr.dockerfileputs it in/var/solr/drupal, outside the deleted directory.Before this change,
solr-precreatecopied/solr-confinto/var/solr/data/drupalonly when that directory didn't exist yet. On Lagoon,/var/solris a persistent volume, so a core got its config at its first deploy and never again. Any later change to.docker/config/solr/config-set/was silently ignored. A core created byuselagoon/solr-8and then moved touselagoon/solr-9-drupalkept its Solr 8solrconfig.xml. It then failed to load withError loading class 'solr.XSLTResponseWriter', and the site had no search. Local and CI volumes start empty, so this never showed up there.After merge, a config-set change takes effect on the next deployment, and a Solr 8 core on a Solr 9 image loads again. The
RUNstep also fails the build when thedataDirrewrite stops matching a future jump-start config-set. Without that rewrite, the index would sit inside the recreated directory and be wiped on every start. The Drupal side,docker-compose.ymland the Solr image tag are unchanged.Before / After
Changes
Solr image
.docker/solr.dockerfile:CMDrunssolr-recreateand thenexec solr-foreground, both shipped in the base image. Withexec, Solr replacessh, so the Java process is a direct child oftiniand gets SIGTERM on a rollout.solr-foregroundstill runs the/docker-entrypoint-initdb.dscripts thatsolr-precreateran..docker/solr.dockerfile: agrep -qafter thedataDirsedfails the build when the index can't be moved out of the core directory.Tests
.vortex/tests/phpunit/Functional/DockerComposeSolrTest.php(new, groupp5) starts only thesolrservice on a fresh SUT and keeps the volume across container replacements. Each test was first run againstsolr-precreateto confirm it fails for the expected reason:testSolrCoreConfigUpdatechangessolr.mlt.timeAllowedin the SUT config-set, rebuilds and force-recreates the container. It then reads the value back from the running core's Config API (2000before,2345after). It also checks that the indexed document survives and that Java's parent PID is1. Before the fix:'2345'expected,'2000'returned.testSolrCoreIncompatibleConfigReplacedwritessolr.XSLTResponseWriterinto the core'ssolrconfig.xmlon the volume and replaces the container with the same image. This is the Solr 8 leftover from the issue, and also a rollout with no config change. The test asserts that there's noinitFailuresentry and the indexed document is still there. Before the fix:Error loading class 'solr.XSLTResponseWriter'.testSolrBuildFailsWhenDataDirUnmatchedchanges the config-set'sdataDirso the rewrite no longer matches, and asserts thatdocker compose build solrfails. Before the fix, the build succeeded..vortex/installer/tests/Fixtures/handler_process/_baseline/.docker/solr.dockerfile: regenerated snapshot.Documentation
.vortex/docs/content/development/environment/docker.mdx: thesolrservice description says the core is recreated on every start, where the index lives, when the build fails, and how to reindex after a schema change.Upgrade note for consumer projects
The first deployment with this change replaces each existing core's config with the project's current config-set. A core that held a Solr 8 config gets a working core back. Reindex it with
drush search-api:rebuild-trackeranddrush search-api:indexto repopulate it.Screenshots
N/A
Summary by CodeRabbit
Bug Fixes
Documentation