Skip to content

Commit fb51b80

Browse files
committed
BNPPFSLA-1125 [Fix] Double JAR files in docker-solr container
* Core-issue is that imported docker-solr container contains an old SOLR-BACKUP. * This has to be removed on docker level. * Build itself does need to include the jackson/joda libraries.
1 parent f25c808 commit fb51b80

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+51
-36
lines changed

integration-tests/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ createDockerFile {
4646
dependsOn(configurations.backupJar)
4747

4848
if (flavor == "solr6") {
49+
// Remove the old imported solr-backup from docker-solr:
50+
// Resolves DOUBLE library issues!
51+
runCommand 'rm /opt/alfresco-search-services/solrhome/lib/solr-backup-0.0.11.jar'
52+
runCommand 'rm /opt/alfresco-search-services/solrhome/lib/aws-java-sdk*'
53+
runCommand 'rm /opt/alfresco-search-services/solrhome/lib/jackson-*'
54+
4955
smartCopy "${project.projectDir}/src/test/resources/solr.xml", "/opt/alfresco-search-services/solrhome/solr.xml"
5056
smartCopy configurations.backupJar, "/opt/alfresco-search-services/solrhome/lib/"
5157
}

integration-tests/src/test/java/eu/xenit/solr/backup/s3/SolrBackupTest.java

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,13 @@ public void setup() {
9393
.build();
9494
restoreFixedSnapshotRequestSpec = new RequestSpecBuilder()
9595
.setBaseUri(baseURISolr)
96-
.setPort(8081)
96+
.setPort(solrPort)
9797
.setBasePath(basePathSolrBackup)
98-
.addParam("command", "restorestatus")
99-
.addParam("wt", "json")
98+
.addParam("command", "restore")
99+
.addParam("repository", "s3")
100+
.addParam("location", "bucket")
101+
.addParam("name", "my-alfresco-backup-20251006")
100102
.build();
101-
102103
// wait for solr to track
103104
try {
104105
sleep(30000);
@@ -111,11 +112,23 @@ public void setup() {
111112
@Order(3)
112113
void testRestorePointInTimeScriptEndpoint() {
113114
System.out.println("Restore triggered at solr-startup after health-check succeeded, will wait maximum 3 minutes");
115+
// Check logs for restore at startup... (Solr doesnt remember by the time we reach our test).
116+
// Retrigger a restore from the backup
117+
String responseBody = given()
118+
.spec(restoreFixedSnapshotRequestSpec)
119+
.when()
120+
.get()
121+
.then()
122+
.statusCode(200)
123+
.extract()
124+
.body() // Extract the whole body
125+
.asString(); // as a simple string
126+
System.out.println("RAW RESPONSE: " + responseBody); // Print it!
114127
long startTime = System.currentTimeMillis();
115-
await().atMost(360, TimeUnit.SECONDS)
128+
await().atMost(180, TimeUnit.SECONDS)
116129
.pollInterval(1, TimeUnit.SECONDS).until(() -> {
117130
String status = given()
118-
.spec(restoreFixedSnapshotRequestSpec)
131+
.spec(restoreStatusRequestSpec)
119132
.when()
120133
.get()
121134
.then()

integration-tests/src/test/resources/compose/aws/script.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@ echo "--- Creating S3 bucket for Solr backups ---"
33
awslocal s3 mb s3://bucket
44

55
echo "--- Uploading Solr snapshot 'my-test-name-x' to S3 ---"
6-
awslocal s3 sync /backups/snapshot.my-test-name-1 s3://bucket/snapshot.my-test-name-1/
7-
awslocal s3 sync /backups/snapshot.my-test-name-0 s3://bucket/snapshot.my-test-name-0/
8-
awslocal s3 sync /backups/snapshot.my-test-name-2 s3://bucket/snapshot.my-test-name-2/
6+
awslocal s3 sync /backups/snapshot s3://bucket/opt/alfresco-search-services/data/solr6Backup/alfresco/snapshot.my-alfresco-backup-20251006

integration-tests/src/test/resources/compose/docker-compose.yml

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,6 @@ services:
3838
ports:
3939
- "8080:8080"
4040
- "8000:8000"
41-
volumes:
42-
- ./solr_backups:/opt/alfresco-search-services/data/solr6Backup/alfresco
43-
environment:
44-
- ALFRESCO_SSL=secret
45-
- DEBUG=true
46-
- JMX_ENABLED=true
47-
- JAVA_XMX=1024M
48-
- ALFRESCO_SECRET=mysolrsecret
49-
- S3_ENDPOINT=http://localstack:4566
50-
- S3_REGION=us-east-1
51-
- S3_BUCKET_NAME=bucket
52-
- S3_ACCESS_KEY=access_key
53-
- S3_SECRET_KEY=secret_key
54-
- S3_PATH_STYLE_ACCESS_ENABLED=true
55-
solr-fixed-snapshot-restore:
56-
image: "${DOCKER_IMAGE:-local}"
57-
restart: unless-stopped
58-
hostname: solr-fixed-snapshot-restore
59-
networks:
60-
- solr-backup-local-network
61-
ports:
62-
- "8081:8080"
63-
- "8001:8000"
6441
environment:
6542
- ALFRESCO_SSL=secret
6643
- DEBUG=true
@@ -73,9 +50,30 @@ services:
7350
- S3_ACCESS_KEY=access_key
7451
- S3_SECRET_KEY=secret_key
7552
- S3_PATH_STYLE_ACCESS_ENABLED=true
76-
- RESTORE_FROM_BACKUP=true
77-
- RESTORE_BACKUP_NAME=snapshot.my-test-name-1
78-
- RESTORE_BACKUP_PATH=bucket
53+
# solr-fixed-snapshot-restore:
54+
# image: "${DOCKER_IMAGE:-local}"
55+
# restart: unless-stopped
56+
# hostname: solr-fixed-snapshot-restore
57+
# networks:
58+
# - solr-backup-local-network
59+
# ports:
60+
# - "8081:8080"
61+
# - "8001:8000"
62+
# environment:
63+
# - ALFRESCO_SSL=secret
64+
# - DEBUG=true
65+
# - JMX_ENABLED=true
66+
# - JAVA_XMX=1024M
67+
# - ALFRESCO_SECRET=mysolrsecret
68+
# - S3_ENDPOINT=http://localstack:4566
69+
# - S3_REGION=us-east-1
70+
# - S3_BUCKET_NAME=bucket
71+
# - S3_ACCESS_KEY=access_key
72+
# - S3_SECRET_KEY=secret_key
73+
# - S3_PATH_STYLE_ACCESS_ENABLED=true
74+
# - RESTORE_FROM_BACKUP=true
75+
# - RESTORE_BACKUP_NAME=my-alfresco-backup-20251006
76+
# - RESTORE_BACKUP_PATH=bucket
7977
localstack:
8078
container_name: localstack
8179
image: localstack/localstack:2.3.2
@@ -90,7 +88,7 @@ services:
9088
- AWS_DEFAULT_REGION=us-east-1
9189
volumes:
9290
- ./aws:/etc/localstack/init/ready.d
93-
- ./solr_backups:/backups
91+
- ./solr-snapshot:/backups
9492
networks:
9593
solr-backup-local-network:
9694
driver: bridge
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)