Skip to content

Custom dt environment prep#1303

Open
jr-rk wants to merge 4 commits intocustom_dtfrom
custom_dt_environment_prep
Open

Custom dt environment prep#1303
jr-rk wants to merge 4 commits intocustom_dtfrom
custom_dt_environment_prep

Conversation

@jr-rk
Copy link
Copy Markdown

@jr-rk jr-rk commented Apr 13, 2026

Problem description

BE environment prep

@jr-rk jr-rk self-assigned this Apr 13, 2026
@jr-rk jr-rk requested a review from Copilot April 13, 2026 21:00
Copy link
Copy Markdown

Copilot AI left a comment

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 set of local development / environment-prep scripts and introduces a new REST endpoint + scheduler to serve a cached, transformed Shibboleth DiscoFeed (IdP discovery feed) from the DSpace backend.

Changes:

  • Add numerous Windows/Linux helper scripts for building, restarting, indexing, and Docker (Matomo) management.
  • Add DiscoFeed backend implementation (controller + scheduler + download/transform service) plus sample response JSON.
  • Add an implementation guide describing the DiscoFeed setup and expected configuration.

Reviewed changes

Copilot reviewed 35 out of 35 changed files in this pull request and generated 32 comments.

Show a summary per file
File Description
scripts/sourceversion.py Prints build timestamp + git hash and outputs a build link from CLI args
scripts/run.delete.dspace.parent.bat Wrapper to load env vars and delete/rebuild dspace-parent from local Maven repo
scripts/run.build.bat Wrapper to load env vars and build/install DSpace into Tomcat/webapps
scripts/restart_debug/undebug.sh Removes debug flag file and runs shutdown
scripts/restart_debug/redebug.sh Creates debug flag file and runs shutdown
scripts/restart_debug/custom_run.sh Starts Tomcat with/without JPDA based on a flag file
scripts/pre-commit/checkstyle.py Pre-commit hook to run Maven Checkstyle
scripts/log4j2.solr.xml Alternate Solr Log4j2 config (stdout WARN+, file logs info)
scripts/index-scripts/indexhandle.sh Helper to run dspace filter-media for a handle and capture output/error
scripts/index-scripts/autoindexf.sh Background wrapper around indexhandle + output management
scripts/fast-build/update-solr-configsets.bat Batch helper to refresh Solr configsets from DSpace application
scripts/fast-build/tomcat/stop.bat Stops Tomcat (fast-build tooling)
scripts/fast-build/tomcat/start.bat Starts Tomcat with JPDA (fast-build tooling)
scripts/fast-build/oai-pmh-package-update.bat Rebuilds and copies the dspace-oai jar into Tomcat
scripts/fast-build/dspace-api-package-update.bat Rebuilds and copies the dspace-api jar into Tomcat and DSpace lib
scripts/fast-build/crosswalks-update.bat Copies crosswalk configs and triggers OAI reindex
scripts/fast-build/config-update.bat Copies full config directory into DSpace application
scripts/fast-build/cfg-update.bat Copies selected cfg files into DSpace application
scripts/envs/__dspace.parent.basic.example.bat Example env template for dspace-parent cleanup script
scripts/envs/__dspace.parent.basic.bat Env file for dspace-parent cleanup script
scripts/envs/__basic.example.bat Example env template for build/fast-build scripts
scripts/envs/__basic.bat Env file for build/fast-build scripts
scripts/docker/matomo/startContainers.sh Starts Matomo + DB stack via docker-compose
scripts/docker/matomo/startContainers.bat Windows variant to start Matomo + DB stack
scripts/docker/matomo/matomo-w-db.yml Docker Compose definition for Matomo + MariaDB + phpMyAdmin
scripts/docker/matomo/deleteContainers.sh Stops/removes Matomo stack
scripts/docker/matomo/deleteContainers.bat Windows variant to stop/remove Matomo stack
scripts/delete.dspace.parent.bat Deletes dspace-parent directory and runs mvn install
scripts/build.dspace.bat Runs Maven build + ant fresh_install + deploys webapps to Tomcat
scripts/__tests.yaml Template YAML for generating test-run batch scripts
dspace-server-webapp/src/main/resources/org/dspace/app/rest/discofeedResponse.json Sample DiscoFeed JSON response payload
dspace-server-webapp/src/main/java/org/dspace/app/rest/DiscoFeedsUpdateScheduler.java Scheduled cache refresher for DiscoFeed content
dspace-server-webapp/src/main/java/org/dspace/app/rest/DiscoFeedsDownloadService.java Downloads/transforms DiscoFeed JSON (with optional SSL bypass)
dspace-server-webapp/src/main/java/org/dspace/app/rest/DiscoFeedsController.java Public REST endpoint serving cached DiscoFeed JSON
DISCOFEED-IMPLEMENTATION.md Detailed guide for DiscoFeed endpoint architecture/configuration

Comment on lines +3 to +4
echo going to index handle $1 with "-f"
./dspace filter-media -f -i $1 > $1idx.out 2> $1idx.err
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

The shell redirections and argument uses are unquoted ($1, $1idx.out, etc.). If the handle contains spaces or shell metacharacters, this can break the command or write to unexpected paths. Quote the variable expansions when invoking dspace and when forming output filenames.

Suggested change
echo going to index handle $1 with "-f"
./dspace filter-media -f -i $1 > $1idx.out 2> $1idx.err
echo going to index handle "$1" with "-f"
./dspace filter-media -f -i "$1" > "${1}idx.out" 2> "${1}idx.err"

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,3 @@
#!/bin/bash
rm do_debug.txt
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

rm do_debug.txt will exit non-zero if the file doesn’t exist, which may break automated workflows that use this script. Use rm -f (or guard with test -f) to make it idempotent.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,2 @@
docker-compose -f matomo-w-db.yml down
docker compose -f matomo-w-db.yml rm
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

docker-compose and docker compose are mixed across these scripts. Standardize on one to avoid failures on machines that only have one of them installed.

Suggested change
docker compose -f matomo-w-db.yml rm
docker-compose -f matomo-w-db.yml rm

Copilot uses AI. Check for mistakes.
Comment on lines +23 to +37
@RestController
@RequestMapping("/api/discojuice/feeds")
public class DiscoFeedsController {

@Autowired
private DiscoFeedsUpdateScheduler discoFeedsUpdateScheduler;

/**
* Returns the cached IdP feed as a JSON array.
*
* @return HTTP 200 with the JSON feed, or HTTP 503 if the feed is not yet available.
*/
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("permitAll()")
public ResponseEntity<String> getDiscoFeeds() {
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

The PR title/description focuses on “environment prep”, but this change set also introduces a new public REST endpoint and scheduled background fetch with optional SSL validation bypass. Please update the PR description/scope so reviewers understand and can assess the functional/security impact.

Copilot uses AI. Check for mistakes.
Comment thread scripts/run.build.bat
Comment on lines +1 to +10
rem set those to your local paths in .gitignored file /envs/__basic.bat.
rem you HAVE TO CREATE /envs/__basic.bat with following variables in the same directory

rem start of variables expected in /envs/__basic.bat
set dspace_source=
set tomcat=
set dspace_application=
rem end of variables expected in /envs/__basic.bat

call envs\__basic.bat
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

The file scripts/envs/__basic.bat is committed, but scripts/run.build.bat comments imply the env file should be gitignored and user-specific. Please either remove the committed env file or adjust the script/documentation so the repository doesn’t include local machine settings.

Copilot uses AI. Check for mistakes.
Comment on lines +60 to +63
public String downloadAndTransformFeeds() {
disableSSL = configurationService.getBooleanProperty(
"disable.ssl.check.specific.requests", false);
String feedUrl = configurationService.getProperty("shibboleth.discofeed.url");
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

The config key disable.ssl.check.specific.requests is referenced here but does not appear to be defined/documented in the standard DSpace config files. Please either document it alongside the new DiscoFeed settings or switch to a DiscoFeed-specific key to avoid an undocumented global toggle.

Copilot uses AI. Check for mistakes.
Comment on lines +9 to +12

rem copy created jar into tomcat/webapps/server
xcopy /e /h /i /q /y %dspace_source%\dspace-api\target\dspace-api-7.6.1.jar %tomcat%\webapps\server\WEB-INF\lib\
xcopy /e /h /i /q /y %dspace_source%\dspace-api\target\dspace-api-7.6.1.jar %dspace_application%\lib\
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

The jar filename is hardcoded to dspace-api-7.6.1.jar, which is unlikely to exist for this repo/version and will cause the copy step to fail. Use the Maven project version (or a wildcard) when copying the built jar.

Suggested change
rem copy created jar into tomcat/webapps/server
xcopy /e /h /i /q /y %dspace_source%\dspace-api\target\dspace-api-7.6.1.jar %tomcat%\webapps\server\WEB-INF\lib\
xcopy /e /h /i /q /y %dspace_source%\dspace-api\target\dspace-api-7.6.1.jar %dspace_application%\lib\
set "DSPACE_API_JAR_PATTERN=dspace-api-*.jar"
rem copy created jar into tomcat/webapps/server
xcopy /e /h /i /q /y %dspace_source%\dspace-api\target\%DSPACE_API_JAR_PATTERN% %tomcat%\webapps\server\WEB-INF\lib\
xcopy /e /h /i /q /y %dspace_source%\dspace-api\target\%DSPACE_API_JAR_PATTERN% %dspace_application%\lib\

Copilot uses AI. Check for mistakes.
Comment thread scripts/__tests.yaml
# optional
# debug: true - optional, use for debug
# comment - optional
# methondName - optional -use if want to run only one method
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

Typo in comment key name: methondName should be methodName (to match the actual YAML key used below).

Suggested change
# methondName - optional -use if want to run only one method
# methodName - optional -use if want to run only one method

Copilot uses AI. Check for mistakes.

private static final Logger log = LogManager.getLogger(DiscoFeedsUpdateScheduler.class);

private String feedsContent;
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

feedsContent is written by the scheduled task thread and read by web request threads, but it’s not volatile and no synchronization is used. This can lead to stale reads under the Java memory model. Use volatile (or an AtomicReference) for the cached value.

Suggested change
private String feedsContent;
private volatile String feedsContent;

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +14
[
{
"entityID": "https://idp.example.org/idp/shibboleth",
"DisplayNames": [
{"value": "Example University", "lang": "en"}
]
},
{
"entityID": "https://idp2.example.org/idp/shibboleth",
"DisplayNames": [
{"value": "Test University", "lang": "en"}
]
}
]
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

This JSON file looks like sample/test data, but it is added under src/main/resources and will be shipped with the production webapp. If it’s only for the TEST: classpath mode or for tests/docs, move it to src/test/resources (or otherwise document why it must be in the main artifact).

Suggested change
[
{
"entityID": "https://idp.example.org/idp/shibboleth",
"DisplayNames": [
{"value": "Example University", "lang": "en"}
]
},
{
"entityID": "https://idp2.example.org/idp/shibboleth",
"DisplayNames": [
{"value": "Test University", "lang": "en"}
]
}
]
[]

Copilot uses AI. Check for mistakes.
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