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

[NYS2AWS-172] fix broken Solr rollback mechanism for Solr 2.0.9.1 com… #116

Merged
merged 4 commits into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ env:
GRADLE_OPTS: >-
-Dorg.gradle.project.eu.xenit.cloudsmith.username=${{ secrets.CLOUDSMITH_USER }}
-Dorg.gradle.project.eu.xenit.cloudsmith.password=${{ secrets.CLOUDSMITH_APIKEY }}
-Dorg.gradle.project.org.alfresco.maven.nexus.username=${{ secrets.ALFRESCO_NEXUS_USERNAME }}
-Dorg.gradle.project.org.alfresco.maven.nexus.password=${{ secrets.ALFRESCO_NEXUS_PASSWORD }}
jobs:
integration-test:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## Unreleased
### Added
* [NYS2AWS-172] manually fixed rollback bug in Solr6 2.0.9.1 community edition [#116]
* [NYS2AWS-156] added support for customizing the `log4j.properties` file based upon `LOG_`-prefixed environmental variables. [#113]
* [DOCKER-456] upgrade solr from 2.0.8.1 to 2.0.9.1 [#108]
* [DOCKER-441] improve solr backup documentation and add new env variable for backup and ALFRESCO_SECRET [#97]
* [DOCKER-440] replace 2.0.8.1 with 2.0.8.2 [#96]
* [DOCKER-438] DOCKER-438 add back solr 2.0.6 [#95]
* [DOCKER-438] upgrade solr from 2.0.6 to 2.0.8.1 [#91]

[#116]: https://github.com/xenit-eu/docker-solr/pull/116
[#113]: https://github.com/xenit-eu/docker-solr/pull/113
[#108]: https://github.com/xenit-eu/docker-solr/pull/108
[#96]: https://github.com/xenit-eu/docker-solr/pull/97
Expand Down
26 changes: 25 additions & 1 deletion xenit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ subprojects {
tests_use_ssl = false
composeFiles = ["$composeDir/docker-compose-alfresco-non-ssl.yml",
"$composeDir/docker-compose-solr-non-ssl.yml",
"$composeDir/docker-compose-db.yml"];
"$composeDir/docker-compose-db.yml"]
solrSourceSetOverride = null
}

dependencies {
Expand Down Expand Up @@ -79,6 +80,29 @@ subprojects {
smartCopy files(configurations.backup.files), "/opt/alfresco-search-services/solrhome/lib/"
smartCopy("${project.projectDir}/../local/93-restore-from-backup.sh", "/docker-entrypoint.d/")
smartCopy("${project.projectDir}/../local/solr.xml", "/opt/alfresco-search-services/solrhome/solr.xml")

if (project.solrSourceSetOverride != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can't you just put the relevant classes in webapp/WEB-INF/classes/.... ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@thijslemmens I looked into this since this would have been a more clean approach, however, I couldn't find the classes dir. in the image. The only classes I can find are the onces I introduced myself. All other code seems to be packaged as JAR files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

root@50c520b84bee:/opt/alfresco-search-services/solr/server/solr-webapp/webapp/WEB-INF# ls
lib  web.xml  weblogic.xml

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also ran some find commands on *classes* and *.class

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ignore my comments, this is actually possible.

doFirst {
println("The source code of the alfresco-search-*.jar will be overridden with code from (${project.solrSourceSetOverride}).")
}
runCommand('apt-get update -y && apt-get install zip -y')
// Fail if the alfresco-search-*.jar is not found.
runCommand('if [ -z $(ls /opt/alfresco-search-services/solr/server/solr-webapp/webapp/WEB-INF/lib/alfresco-search-*.jar) ]; then echo "Error: Alfresco Search jar not found"; exit 1; fi')
// Unzip the alfresco-search-*.jar to /tmp/alfresco-search, so we can override the classes.
runCommand('mkdir -p /tmp/alfresco-search')
runCommand('cp /opt/alfresco-search-services/solr/server/solr-webapp/webapp/WEB-INF/lib/alfresco-search-*.jar /tmp/alfresco-search/temp.jar')
runCommand('unzip -o /tmp/alfresco-search/temp.jar -d /tmp/alfresco-search')
runCommand('rm -f /tmp/alfresco-search/temp.jar')
// Override the classes in the alfresco-search-*.jar with the classes from the project. Custom source sets can be provided.
project.solrSourceSetOverride.classesDirs.each { classesDir ->
smartCopy(classesDir, "/tmp/alfresco-search/")
}
// Cleanup & copy the temp.jar to the original location.
// Do not clean up the /tmp/alfresco-search directory, as it can be used to double-check the actual classes in the jar.
runCommand('cd /tmp/alfresco-search && zip -r temp.jar *')
runCommand('cp /tmp/alfresco-search/temp.jar $(ls /opt/alfresco-search-services/solr/server/solr-webapp/webapp/WEB-INF/lib/alfresco-search-*.jar)')
runCommand('apt-get remove zip -y')
}
}

task integrationTestXenitEndpoints(type: Test, group: "verification") {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
apply plugin: 'java'

ext {
tests = true
// since s.s. 2.0.3 SSL is required
tests_use_ssl = true
composeFiles = ["$composeDir/docker-compose-alfresco.yml",
"$composeDir/docker-compose-solr.yml",
"$composeDir/docker-compose-db.yml"];

solrSourceSetOverride = sourceSets.main.output
}

repositories {
mavenCentral()
maven {
url 'https://artifacts.alfresco.com/nexus/content/groups/private'
credentials {
username project.property('org.alfresco.maven.nexus.username') ?: ''
password project.property('org.alfresco.maven.nexus.password') ?: ''
}
}
}

createDockerFile.dependsOn(compileJava)

dependencies {
compileOnly 'org.alfresco:alfresco-search:2.0.9.1'
compileOnly 'org.apache.solr:solr-core:6.6.5-patched.11@jar'
telemetry group: 'eu.xenit.alfred.telemetry', name: 'alfred-telemetry-solr6', version: "${alfredTelemetryVersion}"
}
Loading