Repository navigation
[dtq-dev-93] Run the backend images as dspace and report SEO problems as UP_WITH_ISSUES - #1775
Open
milanmajchrak wants to merge 10 commits into
Open
milanmajchrak wants to merge 10 commits into
milanmajchrak wants to merge 10 commits into
Conversation
The image runs DSpace as dspace (uid 1100, as in the 7.x image) instead of root. The assetstore and sitemaps folders exist in the image, so new named volumes get the same owner. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copy of the upstream DSpace 9.4 change: a missing sitemap, robots.txt or SSR no longer makes the whole health endpoint DOWN. Adds the upstream SEOHealthIndicatorTest. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The CLI shares the assetstore volume with the backend, so it uses the same uid 1100. Otherwise folders it creates there are root-owned and the backend cannot write into them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The test image uses 8000 for the Java debugger, which every JVM in the container opens. Same port as in the 7.x image. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Crawlers read robots.txt only at the root of the site, so the SEO check no longer reports it missing when the UI runs under a path. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Handle server JVM takes JAVA_OPTS_HANDLE (256 MB by default) instead of the webapp JAVA_OPTS, and drops JAVA_TOOL_OPTIONS so the debug port of the test image stays free for DSpace. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The robots.txt URL is built inside the try, so a missing or invalid dspace.ui.url reports robots.txt as missing instead of DOWN. An HTML page at /robots.txt also counts as missing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
spring-ldap-core brings in Spring Boot's LDAP indicator. It does not use authentication-ldap.cfg, so it fails on localhost:389 and turns /actuator/health DOWN. Tests now use the shipped setting. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
References
useradd -u 1100,COPY --chown,USER dspace), from dtq-dev 3dc5f08 and cecb1e4. Upstream DSpace has the same idea in its open PR "[Docker] Switch DSpace to Ubuntu user and set /dspace directory ownership".JAVA_OPTS_HANDLE, same asmake-handle-configandstart-handle-serveron dtq-dev (c999c5d).LogAnalyser).application-test.properties(cfe0215), so real installs still get it./dspace/sitemapsin the image, like PR 1507. Both merge cleanly; with this PR, themkdirof 1507 does nothing.93/fe-docker-ops(compose settings, volume owners in the deploy). Merge this one first.Description
The backend and CLI containers run as
dspace(uid 1100), not root./server/actuator/healthis no longer DOWN for SEO problems (nowUP_WITH_ISSUES, as in DSpace 9.4) or for Spring Boot's LDAP check, anddspace health-reportruns its Log Analyser section again.Instructions for Reviewers
List of changes in this PR:
Dockerfile,Dockerfile.cli: the ant stage creates the volume folders ant does not create (assetstore, andsitemapsfor the backend). The final stage adds thedspaceuser, copies/dspacewith--chown=dspace:dspaceand ends withUSER dspace. A new named volume on these folders is owned bydspace.make-handle-config: the Handle server HTTP port is 8010. Port 8000 is the debug port ofDockerfile.test.EXPOSEfollows.start-handle-server: dropsJAVA_TOOL_OPTIONS, likebin/dspacedoes, so the Handle JVM does not take the debug port the webapp needs. The heap comes fromJAVA_OPTS_HANDLE(256 MB), not from the webappJAVA_OPTS.SEOHealthIndicator:builder.down()becomesbuilder.status(UP_WITH_ISSUES_STATUS), the texts become constants, and the config service is injected. Same code as upstream 9.4.SEOHealthIndicatoralso reads robots.txt from the site root (scheme://host/robots.txt). Crawlers only look there. Upstream reads it underdspace.ui.url, which is wrong when the UI runs under a path like/repository./robots.txt(a catch-all route of the site) counts as missing. A missingdspace.ui.urlgives robots.txt missing, not DOWN.SEOHealthIndicatorTest: the 4 upstream cases, plus one each for a UI under a path, an HTML page as robots.txt, and a missingdspace.ui.url.LogAnalyser.getNumItems: the Solr date range uses full timestamps, from the start of the first day to the end of the last. Before,dspace health-reportstopped in "Log Analyser Check" withInvalid Date String:'2026-11-19'. Upstream code, unchanged.actuator.cfg: newmanagement.health.ldap.enabled = false.spring-ldap-corebrings in Spring Boot's LDAP check. It does not readauthentication-ldap.cfgand fails onlocalhost:389, so health was DOWN on every install. LDAP login does not use it. The same line goes out ofapplication-test.properties, so the ITs use the shipped setting.HealthIndicatorsIT.testLdapIndicatorIsOff: an admin sees noldapcomponent.Boxes that already ran the root image have root-owned volumes. Give them to uid 1100 once:
docker exec -u root dspace<INSTANCE> chown -R dspace:dspace /dspace/assetstore, and the same for any other volume or bind mount under/dspace. The 8603 deploy does this itself after the dspace-angular PR.How to test:
docker build -t dspace-nonroot .anddocker run --rm --entrypoint id dspace-nonrootprintsuid=1100(dspace) gid=1100(dspace) groups=1100(dspace). The same forDockerfile.cli.docker run --rm -v t_assets:/dspace/assetstore -v t_maps:/dspace/sitemaps -v t_logs:/dspace/log -v t_handle:/dspace/handle-server --entrypoint sh dspace-nonroot -c 'touch /dspace/assetstore/x /dspace/sitemaps/x /dspace/log/x /dspace/handle-server/x && echo writable'printswritable.docker run --rm -e "JAVA_TOOL_OPTIONS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8000" --entrypoint sh dspace-nonroot -c '/dspace/bin/make-handle-config; /dspace/bin/start-handle-server; sleep 15; grep -A2 "HTTP handle" /dspace/log/handle-server.log; java -version'. The log showsport: 8010, and the last JVM printsListening for transport dt_socket at address: 8000. Before this PR it fails withbind failed: Address already in use.mvn test -pl dspace-server-webapp -DskipUnitTests=false -Dtest=SEOHealthIndicatorTest: 7 tests pass. Withbuilder.down()back, 3 fail. With robots.txt read underdspace.ui.url, the path case fails.mvn verify -pl dspace-api,dspace-server-webapp,dspace -am -DskipIntegrationTests=false -Dit.test=HealthIndicatorsIT: 4 tests pass. Without theactuator.cfgline all 4 fail: health isDOWNand the admin seesldapwithCommunicationException: localhost:389.dspace health-reportprintsItems added since [...]in the "Log Analyser Check" section, notInvalid Date String./server/actuator/healthshould answerUP_WITH_ISSUESinstead ofDOWN, as long as the database and Solr are up.Codex review (gpt-6.2-sol, high), 2 rounds on the Docker, Handle and SEO commits: 1 finding fixed (an HTML page at
/robots.txtcounted as a valid robots.txt). Left as they are:chownabove.Dockerfile.teststill runs as root, as on dtq-dev.make-handle-configwrites port 8010 andstart-handle-serverreadsJAVA_OPTS_HANDLE, as on dtq-dev. It also dropsJAVA_TOOL_OPTIONS, asbin/dspacedoes.The last round also found that a BOM before an HTML page at
/robots.txtstill counts as valid. Not changed.Codex review: not run (usage limit) on the last 3 commits, the
LogAnalysercherry-picks and the LDAP check.Checklist
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).pom.xml), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.🤖 Generated with Claude Code