Skip to content

feat(docker): tunable Solr heap via SOLR_HEAP (jcu, 9.3)#1347

Merged
milanmajchrak merged 1 commit into
customer/jcufrom
feat/solr-heap-jcu
Jul 3, 2026
Merged

feat(docker): tunable Solr heap via SOLR_HEAP (jcu, 9.3)#1347
milanmajchrak merged 1 commit into
customer/jcufrom
feat/solr-heap-jcu

Conversation

@jr-rk

@jr-rk jr-rk commented Jul 2, 2026

Copy link
Copy Markdown

Problem

On DSpace 9.x (customer/jcu, 9.3) the Solr container has no heap knob. It launches via
runuser -u solr -- solr-foreground with no -m flag, so Solr falls back to the image default
heap (512m) and operators can't tune it without editing this tracked compose file. The whole
7.x customer fleet runs 4g (source PR #1309); 9.x had no equivalent.

Carved out of dataquest-dev/dspace-customers#746, which marked the 9.x branches N/A for the
-m 4g backport (no anchor to translate) and flagged a tunable heap as a separate feature.

Root cause

The 9.x Solr entrypoint never passed a heap argument, and solr-foreground runs under a runuser
user switch, so no SOLR_HEAP reached Solr's start scripts.

Change set

One line in docker/docker-compose-rest.yml, the Solr entrypoint's final command:

-      runuser -u solr -- solr-foreground
+      runuser -u solr -- env SOLR_HEAP="${SOLR_HEAP:-4g}" solr-foreground
  • env SOLR_HEAP=… forwards the value explicitly through runuser into the solr user's
    environment, where solr-foreground honours it natively — no dependence on runuser env passing.
  • Compose interpolates ${SOLR_HEAP:-4g} from the host/.env at parse time; quoted to survive
    word-splitting.
  • Default decision: 4g when unset — aligns 9.x with the 7.x fleet and Make Solr heap tunable via SOLR_HEAP (default 4g, no behavior change) #1309. This is a
    deliberate behavior change on 9.x (image default 512m → 4g). Override with SOLR_HEAP=1g
    in .env. No other line changed.

Test evidence

docker compose config renders the interpolated entrypoint correctly:

# unset  -> default 4g
$ SOLR_HEAP= docker compose -f docker/docker-compose.yml -f docker/docker-compose-rest.yml config | grep solr-foreground
        runuser -u solr -- env SOLR_HEAP="4g" solr-foreground

# override
$ SOLR_HEAP=1g docker compose ... config | grep solr-foreground
        runuser -u solr -- env SOLR_HEAP="1g" solr-foreground

Risk & rollback

Low. Infra-only, single line. Default heap rises 512m → 4g on 9.x (intended; matches fleet). If a
host lacks 4g, set SOLR_HEAP lower in .env. Rollback = revert this commit.

Notes / assumptions

DSpace 9.x launches Solr with `runuser -u solr -- solr-foreground` and no
`-m` flag, so the heap was pinned to the image default (512m) with no runtime
knob. Forward SOLR_HEAP through runuser so the solr user's environment carries
it into solr-foreground, which honours it natively.

Default is 4g when SOLR_HEAP is unset, aligning 9.x with the 7.x fleet and
source PR #1309. Deliberate default change on 9.x
(512m -> 4g). Set SOLR_HEAP in .env to override (e.g. SOLR_HEAP=1g).

New feature carved out of the 9.x N/A branches in
dataquest-dev/dspace-customers#746.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d16d66bc-04c2-496c-8312-1a7b0da7fcfe

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jr-rk jr-rk self-assigned this Jul 2, 2026
@jr-rk jr-rk requested a review from Copilot July 2, 2026 15:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a configurable JVM heap setting for the Solr container in the REST Docker Compose stack, allowing operators to tune Solr memory without modifying tracked compose files (defaulting to 4g when unset).

Changes:

  • Updates the Solr entrypoint command to explicitly forward SOLR_HEAP through runuser via env.
  • Introduces a default heap value of 4g when SOLR_HEAP is not provided (intentional behavior change vs image default).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docker/docker-compose-rest.yml
@jr-rk jr-rk requested a review from milanmajchrak July 2, 2026 15:51
@milanmajchrak milanmajchrak merged commit 91df103 into customer/jcu Jul 3, 2026
7 checks passed
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