From 523c26b206f9bcb22213f27bcba2e2d3be4ecf9c Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 3 Oct 2024 11:26:39 +0200 Subject: [PATCH 01/21] add mediation component to the liveindex matrixed target --- docker-bake.hcl | 4 ++++ search/enterprise/common/artifacts.json | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/docker-bake.hcl b/docker-bake.hcl index b97e0b9b..b06e9205 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -210,6 +210,10 @@ target "repository" { target "search_liveindexing" { matrix = { liveindexing = [ + { + artifact = "alfresco-elasticsearch-live-indexing-mediation", + name = "mediation" + }, { artifact = "alfresco-elasticsearch-live-indexing-metadata", name = "metadata" diff --git a/search/enterprise/common/artifacts.json b/search/enterprise/common/artifacts.json index 092bc8d9..f4ef5e6b 100644 --- a/search/enterprise/common/artifacts.json +++ b/search/enterprise/common/artifacts.json @@ -1,6 +1,14 @@ { "artifacts": { "acs23": [ + { + "name": "alfresco-elasticsearch-live-indexing-mediation", + "version": "4.0.1", + "path": "search/enterprise/common", + "classifier": "-app.jar", + "repository": "enterprise-releases", + "group": "org.alfresco" + }, { "name": "alfresco-elasticsearch-live-indexing-metadata", "version": "4.0.1", From fe0062ffeb53dd8773d560c3cfd7989100d6e0e9 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 3 Oct 2024 12:32:31 +0200 Subject: [PATCH 02/21] add reindeixng image support --- docker-bake.hcl | 18 +++++++++++++++++- search/enterprise/reindexing/Dockerfile | 5 +++++ search/enterprise/reindexing/artifacts.json | 14 ++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 search/enterprise/reindexing/Dockerfile create mode 100644 search/enterprise/reindexing/artifacts.json diff --git a/docker-bake.hcl b/docker-bake.hcl index b06e9205..cfa1387f 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -7,7 +7,7 @@ group "content_service" { } group "enterprise-search" { - targets = ["search_liveindexing"] + targets = ["search_liveindexing", "search_reindexing"] } group "ats" { @@ -251,6 +251,22 @@ target "search_liveindexing" { platforms = split(",", "${TARGETARCH}") } +target "search_reindexing" { + context = "./search/enterprise/reindexing" + dockerfile = "Dockerfile" + inherits = ["java_base"] + contexts = { + java_base = "target:java_base" + } + labels = { + "org.opencontainers.image.title" = "${PRODUCT_LINE} Enterprise Search - reindexing" + "org.opencontainers.image.description" = "${PRODUCT_LINE} Enterprise Search - reindexing component" + } + tags = ["${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-elasticsearch-reindexing:${TAG}"] + output = ["type=docker"] + platforms = split(",", "${TARGETARCH}") +} + variable "ALFRESCO_TROUTER_USER_NAME" { default = "trouter" } diff --git a/search/enterprise/reindexing/Dockerfile b/search/enterprise/reindexing/Dockerfile new file mode 100644 index 00000000..4f126264 --- /dev/null +++ b/search/enterprise/reindexing/Dockerfile @@ -0,0 +1,5 @@ +FROM java_base + +ADD *-app.jar /opt/app.jar + +ENTRYPOINT java $JAVA_OPTS -jar /opt/app.jar diff --git a/search/enterprise/reindexing/artifacts.json b/search/enterprise/reindexing/artifacts.json new file mode 100644 index 00000000..1adf47a9 --- /dev/null +++ b/search/enterprise/reindexing/artifacts.json @@ -0,0 +1,14 @@ +{ + "artifacts": { + "acs23": [ + { + "name": "alfresco-elasticsearch-reindexing", + "version": "4.0.1", + "path": "search/enterprise/reindexing", + "classifier": "-app.jar", + "repository": "enterprise-releases", + "group": "org.alfresco" + } + ] + } +} From efa4f8f8ea9c079afca58b2fab0c683f5a910d38 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 3 Oct 2024 12:40:08 +0200 Subject: [PATCH 03/21] reintroduce the search api postman test --- .../acs-test-docker-compose-collection.json | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/test/postman/docker-compose/acs-test-docker-compose-collection.json b/test/postman/docker-compose/acs-test-docker-compose-collection.json index 81147e92..bf0875bb 100644 --- a/test/postman/docker-compose/acs-test-docker-compose-collection.json +++ b/test/postman/docker-compose/acs-test-docker-compose-collection.json @@ -1423,6 +1423,56 @@ }, "response": [] }, + { + "name": "search-api-validation", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "pm.globals.get(\"url\");", + "", + "pm.test(\"canUseSearchAPITest\", function () {", + " pm.response.to.have.status(200);", + "});", + "", + "pm.environment.set(\"totalItems\", pm.response.json().list.pagination.totalItems);", + "", + "console.log(\"Total Items:\"+pm.environment.get(\"totalItems\"));", + "", + "pm.test(\"totalItems\", function () {", + " pm.expect(pm.environment.get(\"totalItems\")).not.eql(0)", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "basic", + "basic": [ + { + "key": "username", + "value": "admin", + "type": "string" + }, + { + "key": "password", + "value": "admin", + "type": "string" + }, + { + "key": "saveHelperData", + "type": "any" + }, + { + "key": "showPassword", + "value": false, + "type": "boolean" + } + ] + }, { "name": "search-cmis-validation", "event": [ From ca2c2c2cb66c810d1f17c9d89fca01674c4efa5a Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 3 Oct 2024 12:44:51 +0200 Subject: [PATCH 04/21] add mediation & reindex images to helm tests --- test/helm/test-overrides.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/helm/test-overrides.yaml b/test/helm/test-overrides.yaml index 3ef76115..2df6a689 100644 --- a/test/helm/test-overrides.yaml +++ b/test/helm/test-overrides.yaml @@ -8,6 +8,10 @@ share: repository: localhost/alfresco-share tag: latest alfresco-search-enterprise: + reindexing: + image: + repository: localhost/alfresco-elasticsearch-reindexing + tag: latest liveIndexing: content: image: @@ -21,6 +25,10 @@ alfresco-search-enterprise: image: repository: localhost/alfresco-elasticsearch-live-indexing-path tag: latest + mediation: + image: + repository: localhost/alfresco-elasticsearch-live-indexing-mediation + tag: latest alfresco-transform-service: pdfrenderer: image: From 986c755add8d137ae62456fb3b5b91ecef6f9695 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 3 Oct 2024 16:50:52 +0200 Subject: [PATCH 05/21] refactor liveindexing targets to aoi really IS aoi --- docker-bake.hcl | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/docker-bake.hcl b/docker-bake.hcl index cfa1387f..3c057490 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -212,23 +212,28 @@ target "search_liveindexing" { liveindexing = [ { artifact = "alfresco-elasticsearch-live-indexing-mediation", - name = "mediation" + name = "mediation", + context = "common" }, { artifact = "alfresco-elasticsearch-live-indexing-metadata", - name = "metadata" + name = "metadata", + context = "common" }, { artifact = "alfresco-elasticsearch-live-indexing-path", - name = "path" + name = "path", + context = "common" }, { artifact = "alfresco-elasticsearch-live-indexing-content", - name = "content" + name = "content", + context = "common" }, { artifact = "alfresco-elasticsearch-live-indexing", - name = "all-in-one" + name = "all-in-one", + context = "all-in-one" } ] } @@ -236,7 +241,7 @@ target "search_liveindexing" { args = { LIVEINDEXING = "${liveindexing.artifact}" } - context = "./search/enterprise/common" + context = "./search/enterprise/${liveindexing.context}" dockerfile = "Dockerfile" inherits = ["java_base"] contexts = { From b9e2691d3e78379e97eb651a0a33dc4e70fb4404 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 3 Oct 2024 16:51:40 +0200 Subject: [PATCH 06/21] add liveindexing required vars in compose --- test/enterprise-docker-compose.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test/enterprise-docker-compose.yml b/test/enterprise-docker-compose.yml index 3f9bd02d..019046b1 100644 --- a/test/enterprise-docker-compose.yml +++ b/test/enterprise-docker-compose.yml @@ -176,11 +176,12 @@ services: ports: - "9090:9090" live-indexing: - image: ${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-elasticsearch-live-indexing:${TAG} - environment: - SPRING_ELASTICSEARCH_REST_URIS: http://elasticsearch:9200 - SPRING_ACTIVEMQ_BROKERURL: nio://activemq:61616 - ALFRESCO_SHAREDFILESTORE_BASEURL: http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file/ + image: ${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-elasticsearch-live-indexing:${TAG} + environment: + ALFRESCO_ACCEPTED_CONTENT_MEDIA_TYPES_CACHE_BASE_URL: http://transform-router:8095/transform/config + SPRING_ELASTICSEARCH_REST_URIS: http://elasticsearch:9200 + SPRING_ACTIVEMQ_BROKERURL: nio://activemq:61616 + ALFRESCO_SHAREDFILESTORE_BASEURL: http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file/ volumes: shared-file-store-volume: driver_opts: From 801b81f59c4a665427f4e40447febda4a876a034 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 3 Oct 2024 17:15:05 +0200 Subject: [PATCH 07/21] reintroduce the search api postman test --- .../acs-test-docker-compose-collection.json | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/postman/docker-compose/acs-test-docker-compose-collection.json b/test/postman/docker-compose/acs-test-docker-compose-collection.json index bf0875bb..517ea1c4 100644 --- a/test/postman/docker-compose/acs-test-docker-compose-collection.json +++ b/test/postman/docker-compose/acs-test-docker-compose-collection.json @@ -1473,6 +1473,32 @@ } ] }, + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\r\n \"query\": {\r\n \"query\": \"name:alfresco\"\r\n }\r\n}" + }, + "url": { + "raw": "{{protocol}}://{{url}}/alfresco/api/-default-/public/search/versions/1/search", + "protocol": "{{protocol}}", + "host": [ + "{{url}}" + ], + "path": [ + "alfresco", + "api", + "-default-", + "public", + "search", + "versions", + "1", + "search" + ] + } + }, + "response": [] + }, { "name": "search-cmis-validation", "event": [ From 9e5ede2cac31b22e6986e9068fbec571365c323b Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 3 Oct 2024 17:53:42 +0200 Subject: [PATCH 08/21] add reindexing to enterprise compose --- test/enterprise-docker-compose.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/enterprise-docker-compose.yml b/test/enterprise-docker-compose.yml index 019046b1..85ba2f34 100644 --- a/test/enterprise-docker-compose.yml +++ b/test/enterprise-docker-compose.yml @@ -182,6 +182,30 @@ services: SPRING_ELASTICSEARCH_REST_URIS: http://elasticsearch:9200 SPRING_ACTIVEMQ_BROKERURL: nio://activemq:61616 ALFRESCO_SHAREDFILESTORE_BASEURL: http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file/ + depends_on: + elasticsearch: + condition: service_started + reindexing: + condition: service_completed_successfully + reindexing: + image: ${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-elasticsearch-reindexing:${TAG} + mem_limit: 1g + restart: on-failure:10 + environment: + ALFRESCO_ACCEPTED_CONTENT_MEDIA_TYPES_CACHE_BASE_URL: >- + http://transform-core-aio:8090/transform/config + SPRING_ACTIVEMQ_BROKERURL: nio://activemq:61616 + SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/alfresco + SPRING_DATASOURCE_USERNAME: alfresco + SPRING_DATASOURCE_PASSWORD: alfresco + SPRING_ELASTICSEARCH_REST_URIS: http://elasticsearch:9200 + depends_on: + postgres: + condition: service_started + elasticsearch: + condition: service_started + alfresco: + condition: service_healthy volumes: shared-file-store-volume: driver_opts: From 9ef98f6fe22ed0942d7a9a2e6738eb10340afc5c Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 3 Oct 2024 18:06:46 +0200 Subject: [PATCH 09/21] add search enterprise all-in-one context --- search/enterprise/all-in-one/Dockerfile | 13 +++++++++++++ search/enterprise/all-in-one/artifacts.json | 14 ++++++++++++++ search/enterprise/all-in-one/entrypoint.sh | 3 +++ 3 files changed, 30 insertions(+) create mode 100644 search/enterprise/all-in-one/Dockerfile create mode 100644 search/enterprise/all-in-one/artifacts.json create mode 100755 search/enterprise/all-in-one/entrypoint.sh diff --git a/search/enterprise/all-in-one/Dockerfile b/search/enterprise/all-in-one/Dockerfile new file mode 100644 index 00000000..af9c5669 --- /dev/null +++ b/search/enterprise/all-in-one/Dockerfile @@ -0,0 +1,13 @@ +FROM java_base + +ARG LIVEINDEXING +ENV PORT=8080 +EXPOSE 8080 + +ADD ${LIVEINDEXING}*-app.jar /opt/app.jar + +HEALTHCHECK --interval=30s --timeout=3s --retries=3 --start-period=1m \ + CMD curl -f http://localhost:8080/actuator/health || exit 1 + +COPY entrypoint.sh /entrypoint.sh +CMD ["/entrypoint.sh"] diff --git a/search/enterprise/all-in-one/artifacts.json b/search/enterprise/all-in-one/artifacts.json new file mode 100644 index 00000000..cfcb4427 --- /dev/null +++ b/search/enterprise/all-in-one/artifacts.json @@ -0,0 +1,14 @@ +{ + "artifacts": { + "acs23": [ + { + "name": "alfresco-elasticsearch-live-indexing", + "version": "4.0.1", + "path": "search/enterprise/all-in-one", + "classifier": "-app.jar", + "repository": "enterprise-releases", + "group": "org.alfresco" + } + ] + } +} diff --git a/search/enterprise/all-in-one/entrypoint.sh b/search/enterprise/all-in-one/entrypoint.sh new file mode 100755 index 00000000..618a57dc --- /dev/null +++ b/search/enterprise/all-in-one/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +exec java $JAVA_OPTS -jar /opt/app.jar From 41748ff0862f8b29c8bad6a8b3930408043b9d5b Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Thu, 3 Oct 2024 19:54:57 +0200 Subject: [PATCH 10/21] try a bigger runner? --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 97b6ecf8..032dd612 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -128,7 +128,7 @@ jobs: compose-test: name: compose-test needs: build-test - runs-on: ubuntu-latest + runs-on: alfrescoPub-ubuntu2204-16G-4CPU strategy: fail-fast: false matrix: From 7d3454dd1cab6319619bed57564a8bd9f5248af3 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Fri, 4 Oct 2024 09:07:29 +0200 Subject: [PATCH 11/21] Revert "try a bigger runner?" This reverts commit 41748ff0862f8b29c8bad6a8b3930408043b9d5b. --- .github/workflows/build_and_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 032dd612..97b6ecf8 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -128,7 +128,7 @@ jobs: compose-test: name: compose-test needs: build-test - runs-on: alfrescoPub-ubuntu2204-16G-4CPU + runs-on: ubuntu-latest strategy: fail-fast: false matrix: From 244b112f38e55e0825a8294ca718c60f3891d19b Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Fri, 4 Oct 2024 09:28:37 +0200 Subject: [PATCH 12/21] give acs more time before declaring unhealthy --- test/enterprise-docker-compose.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/enterprise-docker-compose.yml b/test/enterprise-docker-compose.yml index 85ba2f34..d79be879 100644 --- a/test/enterprise-docker-compose.yml +++ b/test/enterprise-docker-compose.yml @@ -45,8 +45,8 @@ services: - http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/probes/-ready- interval: 30s timeout: 3s - retries: 3 - start_period: 1m + retries: 5 + start_period: 2m transform-router: mem_limit: 512m image: ${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-transform-router:${TAG} @@ -183,10 +183,10 @@ services: SPRING_ACTIVEMQ_BROKERURL: nio://activemq:61616 ALFRESCO_SHAREDFILESTORE_BASEURL: http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file/ depends_on: + activemq: + condition: service_started elasticsearch: condition: service_started - reindexing: - condition: service_completed_successfully reindexing: image: ${REGISTRY}/${REGISTRY_NAMESPACE}/alfresco-elasticsearch-reindexing:${TAG} mem_limit: 1g @@ -200,6 +200,8 @@ services: SPRING_DATASOURCE_PASSWORD: alfresco SPRING_ELASTICSEARCH_REST_URIS: http://elasticsearch:9200 depends_on: + activemq: + condition: service_started postgres: condition: service_started elasticsearch: From 7ee0e471fca770c2901a076cd6c61898f95eba83 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Fri, 4 Oct 2024 10:38:05 +0200 Subject: [PATCH 13/21] add liveindexing images a dedicated user --- docker-bake.hcl | 28 ++++++++++++++++++++-------- search/enterprise/common/Dockerfile | 8 +++++++- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/docker-bake.hcl b/docker-bake.hcl index 3c057490..f5a564aa 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -98,14 +98,6 @@ variable "ALFRESCO_GROUP_NAME" { default = "alfresco" } -variable "ALFRESCO_REPO_USER_ID" { - default = "33000" -} - -variable "ALFRESCO_REPO_USER_NAME" { - default = "alfresco" -} - target "java_base" { context = "./java" dockerfile = "Dockerfile" @@ -185,6 +177,14 @@ target "tomcat_base" { output = ["type=cacheonly"] } +variable "ALFRESCO_REPO_USER_ID" { + default = "33000" +} + +variable "ALFRESCO_REPO_USER_NAME" { + default = "alfresco" +} + target "repository" { context = "./repository" dockerfile = "Dockerfile" @@ -207,6 +207,14 @@ target "repository" { platforms = split(",", "${TARGETARCH}") } +variable "ALFRESCO_LIVEINDEX_USER_ID" { + default = "33011" +} + +variable "ALFRESCO_LIVEINDEX_USER_NAME" { + default = "liveindexer" +} + target "search_liveindexing" { matrix = { liveindexing = [ @@ -240,6 +248,10 @@ target "search_liveindexing" { name = "${liveindexing.artifact}" args = { LIVEINDEXING = "${liveindexing.artifact}" + ALFRESCO_LIVEINDEX_GROUP_ID = "${ALFRESCO_GROUP_ID}" + ALFRESCO_LIVEINDEX_GROUP_NAME = "${ALFRESCO_GROUP_NAME}" + ALFRESCO_LIVEINDEX_USER_ID = "${ALFRESCO_LIVEINDEX_USER_ID}" + ALFRESCO_LIVEINDEX_USER_NAME = "${ALFRESCO_LIVEINDEX_USER_NAME}" } context = "./search/enterprise/${liveindexing.context}" dockerfile = "Dockerfile" diff --git a/search/enterprise/common/Dockerfile b/search/enterprise/common/Dockerfile index af9c5669..abab3ba6 100644 --- a/search/enterprise/common/Dockerfile +++ b/search/enterprise/common/Dockerfile @@ -4,10 +4,16 @@ ARG LIVEINDEXING ENV PORT=8080 EXPOSE 8080 -ADD ${LIVEINDEXING}*-app.jar /opt/app.jar +COPY ${LIVEINDEXING}*-app.jar /opt/app.jar HEALTHCHECK --interval=30s --timeout=3s --retries=3 --start-period=1m \ CMD curl -f http://localhost:8080/actuator/health || exit 1 COPY entrypoint.sh /entrypoint.sh + +RUN groupadd -g ${ALFRESCO_LIVEINDEX_GROUP_ID} ${ALFRESCO_LIVEINDEX_GROUP_NAME} && \ + useradd -lu ${ALFRESCO_LIVEINDEX_USER_ID} -g ${ALFRESCO_LIVEINDEX_GROUP_NAME} ${ALFRESCO_LIVEINDEX_USER_NAME} + +USER ${ALFRESCO_LIVEINDEX_USER_NAME} + CMD ["/entrypoint.sh"] From 8f0c267068910d8066941b0a69c2082f27a2348f Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Fri, 4 Oct 2024 10:42:59 +0200 Subject: [PATCH 14/21] add reindexing image a dedicated user --- docker-bake.hcl | 14 ++++++++++++++ search/enterprise/reindexing/Dockerfile | 7 ++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/docker-bake.hcl b/docker-bake.hcl index f5a564aa..feb509c8 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -268,6 +268,14 @@ target "search_liveindexing" { platforms = split(",", "${TARGETARCH}") } +variable "ALFRESCO_REINDEX_USER_ID" { + default = "33011" +} + +variable "ALFRESCO_REINDEX_USER_NAME" { + default = "liveindexer" +} + target "search_reindexing" { context = "./search/enterprise/reindexing" dockerfile = "Dockerfile" @@ -275,6 +283,12 @@ target "search_reindexing" { contexts = { java_base = "target:java_base" } + args = { + ALFRESCO_REINDEX_GROUP_ID = "${ALFRESCO_GROUP_ID}" + ALFRESCO_REINDEX_GROUP_NAME = "${ALFRESCO_GROUP_NAME}" + ALFRESCO_REINDEX_USER_ID = "${ALFRESCO_REINDEX_USER_ID}" + ALFRESCO_REINDEX_USER_NAME = "${ALFRESCO_REINDEX_USER_NAME}" + } labels = { "org.opencontainers.image.title" = "${PRODUCT_LINE} Enterprise Search - reindexing" "org.opencontainers.image.description" = "${PRODUCT_LINE} Enterprise Search - reindexing component" diff --git a/search/enterprise/reindexing/Dockerfile b/search/enterprise/reindexing/Dockerfile index 4f126264..87b41b0a 100644 --- a/search/enterprise/reindexing/Dockerfile +++ b/search/enterprise/reindexing/Dockerfile @@ -1,5 +1,10 @@ FROM java_base -ADD *-app.jar /opt/app.jar +COPY *-app.jar /opt/app.jar + +RUN groupadd -g ${ALFRESCO_REINDEX_GROUP_ID} ${ALFRESCO_REINDEX_GROUP_NAME} && \ + useradd -lu ${ALFRESCO_REINDEX_USER_ID} -g ${ALFRESCO_REINDEX_GROUP_NAME} ${ALFRESCO_REINDEX_USER_NAME} + +USER ${ALFRESCO_REINDEX_USER_NAME} ENTRYPOINT java $JAVA_OPTS -jar /opt/app.jar From e2ab72e3801001dd15a26fdaaa5ef6b40f190a3e Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Fri, 4 Oct 2024 10:46:30 +0200 Subject: [PATCH 15/21] add aio liveindexing image a dedicated user --- search/enterprise/all-in-one/Dockerfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/search/enterprise/all-in-one/Dockerfile b/search/enterprise/all-in-one/Dockerfile index af9c5669..72bf6d8d 100644 --- a/search/enterprise/all-in-one/Dockerfile +++ b/search/enterprise/all-in-one/Dockerfile @@ -4,10 +4,16 @@ ARG LIVEINDEXING ENV PORT=8080 EXPOSE 8080 -ADD ${LIVEINDEXING}*-app.jar /opt/app.jar +COPY *-app.jar /opt/app.jar HEALTHCHECK --interval=30s --timeout=3s --retries=3 --start-period=1m \ CMD curl -f http://localhost:8080/actuator/health || exit 1 COPY entrypoint.sh /entrypoint.sh + +RUN groupadd -g ${ALFRESCO_LIVEINDEX_GROUP_ID} ${ALFRESCO_LIVEINDEX_GROUP_NAME} && \ + useradd -lu ${ALFRESCO_LIVEINDEX_USER_ID} -g ${ALFRESCO_LIVEINDEX_GROUP_NAME} ${ALFRESCO_LIVEINDEX_USER_NAME} + +USER ${ALFRESCO_LIVEINDEX_USER_NAME} + CMD ["/entrypoint.sh"] From e37ff5c5c88376662925eb9df1806e2b5fac7561 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Fri, 4 Oct 2024 11:04:41 +0200 Subject: [PATCH 16/21] add missing ARG statements --- search/enterprise/all-in-one/Dockerfile | 5 +++++ search/enterprise/common/Dockerfile | 5 +++++ search/enterprise/reindexing/Dockerfile | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/search/enterprise/all-in-one/Dockerfile b/search/enterprise/all-in-one/Dockerfile index 72bf6d8d..d1ba154e 100644 --- a/search/enterprise/all-in-one/Dockerfile +++ b/search/enterprise/all-in-one/Dockerfile @@ -1,6 +1,11 @@ FROM java_base ARG LIVEINDEXING +ARG ALFRESCO_LIVEINDEX_USER_ID +ARG ALFRESCO_LIVEINDEX_GROUP_ID +ARG ALFRESCO_LIVEINDEX_GROUP_NAME +ARG ALFRESCO_LIVEINDEX_USER_NAME + ENV PORT=8080 EXPOSE 8080 diff --git a/search/enterprise/common/Dockerfile b/search/enterprise/common/Dockerfile index abab3ba6..17f6292b 100644 --- a/search/enterprise/common/Dockerfile +++ b/search/enterprise/common/Dockerfile @@ -1,6 +1,11 @@ FROM java_base ARG LIVEINDEXING +ARG ALFRESCO_LIVEINDEX_USER_ID +ARG ALFRESCO_LIVEINDEX_GROUP_ID +ARG ALFRESCO_LIVEINDEX_GROUP_NAME +ARG ALFRESCO_LIVEINDEX_USER_NAME + ENV PORT=8080 EXPOSE 8080 diff --git a/search/enterprise/reindexing/Dockerfile b/search/enterprise/reindexing/Dockerfile index 87b41b0a..88a18061 100644 --- a/search/enterprise/reindexing/Dockerfile +++ b/search/enterprise/reindexing/Dockerfile @@ -1,5 +1,10 @@ FROM java_base +ARG ALFRESCO_REINDEX_USER_ID +ARG ALFRESCO_REINDEX_GROUP_ID +ARG ALFRESCO_REINDEX_GROUP_NAME +ARG ALFRESCO_REINDEX_USER_NAME + COPY *-app.jar /opt/app.jar RUN groupadd -g ${ALFRESCO_REINDEX_GROUP_ID} ${ALFRESCO_REINDEX_GROUP_NAME} && \ From 23afc4bc2ef3ef2e4e4cb980ab4b281f11ba4723 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Fri, 4 Oct 2024 12:34:10 +0200 Subject: [PATCH 17/21] autodetect produced images for cleanup --- .github/workflows/cleanup_images.yml | 32 ++++++++++++---------------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/.github/workflows/cleanup_images.yml b/.github/workflows/cleanup_images.yml index 9bd077e2..a5e0eea3 100644 --- a/.github/workflows/cleanup_images.yml +++ b/.github/workflows/cleanup_images.yml @@ -8,7 +8,7 @@ on: workflow_dispatch: inputs: dry-run: - description: 'Disable to really delete images' + description: Dry run (do not delete images) required: false type: boolean default: true @@ -21,24 +21,20 @@ jobs: cleanup: runs-on: ubuntu-latest steps: - - name: Set package names + - name: Checkout repository + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + with: + fetch-depth: 0 + - name: Get package names from bake definition + env: + JQ_FILTER: >- + .target + | map(select(has("output"))) + | select(map(.output | index("type=docker")))[].tags[] + | split("/")[-1] + | split(":")[0] run: | - echo "PACKAGE_NAMES=alfresco-transform-router,\ - alfresco-shared-file-store,\ - alfresco-content-repository,\ - alfresco-imagemagick,\ - alfresco-misc,\ - alfresco-libreoffice,\ - alfresco-pdf-renderer,\ - alfresco-tika,\ - alfresco-elasticsearch-live-indexing-content,\ - alfresco-elasticsearch-live-indexing-path,\ - alfresco-elasticsearch-live-indexing-metadata,\ - alfresco-transform-core-aio,\ - alfresco-elasticsearch-live-indexing,\ - alfresco-share,\ - alfresco-ooi-service,\ - alfresco-ms-teams-service" >> $GITHUB_ENV + echo PACKAGE_NAMES=$(docker buildx bake --print | jq '${{ env.JQ_FILTER }}' | jq -rn '[inputs] | join(",")') >> $GITHUB_ENV - name: Remove tag ${{format('pr-{0}', github.event.pull_request.number)}} after PR is closed uses: dataaxiom/ghcr-cleanup-action@98b4022383d6ddb70ccbf6a378b4d8c67a60f066 # v1.0.13 if: github.event_name == 'pull_request' From 972be784d588d12ed6541fefe2d13ee4d3b7408c Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Fri, 4 Oct 2024 17:01:34 +0200 Subject: [PATCH 18/21] debug --- .github/workflows/cleanup_images.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cleanup_images.yml b/.github/workflows/cleanup_images.yml index a5e0eea3..98f614a8 100644 --- a/.github/workflows/cleanup_images.yml +++ b/.github/workflows/cleanup_images.yml @@ -28,9 +28,8 @@ jobs: - name: Get package names from bake definition env: JQ_FILTER: >- - .target - | map(select(has("output"))) - | select(map(.output | index("type=docker")))[].tags[] + .target[] + | select(.output | index("type=docker")).tags[] | split("/")[-1] | split(":")[0] run: | From f117b9490e085c85de1649d46b38bf98f7a968de Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Fri, 4 Oct 2024 17:52:09 +0200 Subject: [PATCH 19/21] improved jq filter --- .github/workflows/cleanup_images.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cleanup_images.yml b/.github/workflows/cleanup_images.yml index 98f614a8..a992aa97 100644 --- a/.github/workflows/cleanup_images.yml +++ b/.github/workflows/cleanup_images.yml @@ -28,12 +28,12 @@ jobs: - name: Get package names from bake definition env: JQ_FILTER: >- - .target[] - | select(.output | index("type=docker")).tags[] - | split("/")[-1] - | split(":")[0] + .target + | map(select(.output | index("type=docker"))) + | map(.tags[] | split("/")[-1] | split(":")[0]) + | join(",") run: | - echo PACKAGE_NAMES=$(docker buildx bake --print | jq '${{ env.JQ_FILTER }}' | jq -rn '[inputs] | join(",")') >> $GITHUB_ENV + echo PACKAGE_NAMES=$(docker buildx bake --print | jq -r '${{ env.JQ_FILTER }}') >> $GITHUB_ENV - name: Remove tag ${{format('pr-{0}', github.event.pull_request.number)}} after PR is closed uses: dataaxiom/ghcr-cleanup-action@98b4022383d6ddb70ccbf6a378b4d8c67a60f066 # v1.0.13 if: github.event_name == 'pull_request' From 71b3821564256bab504eb14b4cf982c9e9480312 Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Mon, 7 Oct 2024 11:00:43 +0200 Subject: [PATCH 20/21] allow passing additionnal cli params as CMD --- search/enterprise/all-in-one/entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/search/enterprise/all-in-one/entrypoint.sh b/search/enterprise/all-in-one/entrypoint.sh index 618a57dc..90938a28 100755 --- a/search/enterprise/all-in-one/entrypoint.sh +++ b/search/enterprise/all-in-one/entrypoint.sh @@ -1,3 +1,3 @@ #!/bin/bash -exec java $JAVA_OPTS -jar /opt/app.jar +exec java $JAVA_OPTS -jar /opt/app.jar $@ From 90f6d54369c935d2b0e9af514404b991b9d4b32d Mon Sep 17 00:00:00 2001 From: Alexandre Chapellon Date: Mon, 7 Oct 2024 11:22:09 +0200 Subject: [PATCH 21/21] use entrypoint for consistency --- search/enterprise/reindexing/Dockerfile | 3 ++- search/enterprise/reindexing/entrypoint.sh | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100755 search/enterprise/reindexing/entrypoint.sh diff --git a/search/enterprise/reindexing/Dockerfile b/search/enterprise/reindexing/Dockerfile index 88a18061..9bdb5bf8 100644 --- a/search/enterprise/reindexing/Dockerfile +++ b/search/enterprise/reindexing/Dockerfile @@ -6,10 +6,11 @@ ARG ALFRESCO_REINDEX_GROUP_NAME ARG ALFRESCO_REINDEX_USER_NAME COPY *-app.jar /opt/app.jar +COPY entrypoint.sh /entrypoint.sh RUN groupadd -g ${ALFRESCO_REINDEX_GROUP_ID} ${ALFRESCO_REINDEX_GROUP_NAME} && \ useradd -lu ${ALFRESCO_REINDEX_USER_ID} -g ${ALFRESCO_REINDEX_GROUP_NAME} ${ALFRESCO_REINDEX_USER_NAME} USER ${ALFRESCO_REINDEX_USER_NAME} -ENTRYPOINT java $JAVA_OPTS -jar /opt/app.jar +ENTRYPOINT ["/entrypoint.sh"] diff --git a/search/enterprise/reindexing/entrypoint.sh b/search/enterprise/reindexing/entrypoint.sh new file mode 100755 index 00000000..90938a28 --- /dev/null +++ b/search/enterprise/reindexing/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +exec java $JAVA_OPTS -jar /opt/app.jar $@