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 all 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
27 changes: 26 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,30 @@ 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("Note: the source code of the alfresco-search-*.jar will be overridden with code from (${project.solrSourceSetOverride}).")
}

// 1. Copy the classes from the sourceSet to a temp directory.
project.solrSourceSetOverride.classesDirs.each { classesDir ->
smartCopy(classesDir, "/tmp/alfresco-search-jar-source-override/")
}

// 2. Copy the classes from the temp directory to the alfresco-search-*.jar.
// Find the JAR.
runCommand('alfresco_search_jar_location=$(ls /opt/alfresco-search-services/solr/server/solr-webapp/webapp/WEB-INF/lib/alfresco-search*.jar) && ' +
// Fail if the JAR is not found.
'if [ -z "$alfresco_search_jar_location" ]; then echo "The alfresco-search-*.jar was not found."; exit 1; else echo "Found alfresco-search-*.jar at ($alfresco_search_jar_location)."; fi && ' +
// Copy the classes from the temp directory to the JAR.
'cd /tmp/alfresco-search-jar-source-override && ' +
'for file in $(find /tmp/alfresco-search-jar-source-override -name "*.class"); do ' +
'echo "Copying ($file) to ($alfresco_search_jar_location)."; ' +
'jar uf "$alfresco_search_jar_location" "${file##/tmp/alfresco-search-jar-source-override/}"; ' +
'done')
// Leave the adjusted classes in the temp directory. It gives a clear overview of the changes.
}
}

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