From 312f4079117279b52fa2df3f3db4c1d5afae6733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Maciusiak?= <158472457+pmacius@users.noreply.github.com> Date: Fri, 26 Jul 2024 15:24:23 +0200 Subject: [PATCH] OPSEXP-2723 Add ATS SFS image Dockerfile (#8) Co-authored-by: Giovanni Toraldo <71768+gionn@users.noreply.github.com> --- ats/{trouter => }/README.md | 31 ++++++++++++ ats/sfs/Dockerfile | 29 ++++++++++++ ats/sfs/artifacts.json | 14 ++++++ ats/sfs/entrypoint.sh | 3 ++ docker-bake.hcl | 50 ++++++++++++++------ docker-compose/docker-compose-components.yml | 5 +- docker-compose/docker-compose.yml | 5 +- 7 files changed, 114 insertions(+), 23 deletions(-) rename ats/{trouter => }/README.md (59%) create mode 100644 ats/sfs/Dockerfile create mode 100644 ats/sfs/artifacts.json create mode 100755 ats/sfs/entrypoint.sh diff --git a/ats/trouter/README.md b/ats/README.md similarity index 59% rename from ats/trouter/README.md rename to ats/README.md index 4812059f..a9e1b422 100644 --- a/ats/trouter/README.md +++ b/ats/README.md @@ -39,3 +39,34 @@ transform-router: - `LIBREOFFICE_URL` - The URL for the LibreOffice service - `TIKA_URL` - The URL for the Tika service - `MISC_URL` - The URL for Mics service + +## sfs + +```yaml + + shared-file-store: + image: localhost/alfresco-shared-file-store:YOUR-TAG + mem_limit: 512m + environment: + JAVA_OPTS: + scheduler.content.age.millis: 86400000 + scheduler.cleanup.interval: 86400000 + scheduler.contract.path: /tmp/scheduler.json + fileStorePath: /tmp/Alfresco + ports: + - "8099:8099" + volumes: + - shared-file-store-volume:/tmp/Alfresco/sfs +volumes: + shared-file-store-volume: + driver_opts: + type: tmpfs + device: tmpfs + +``` + +- `JAVA_OPTS` - Additional java options +- `scheduler.content.age.millis` - Content retention period. The default value is `86400000` +- `scheduler.cleanup.interval` - Cleanup Scheduler interval. The default value is `86400000` +- `scheduler.contract.path` - Cleanup Scheduler contract path. The default value is `/tmp/scheduler.json` +- `fileStorePath` - Shared File Store content storing path. The default value is `/tmp/Alfresco` diff --git a/ats/sfs/Dockerfile b/ats/sfs/Dockerfile new file mode 100644 index 00000000..1df824ec --- /dev/null +++ b/ats/sfs/Dockerfile @@ -0,0 +1,29 @@ +FROM java_base + +EXPOSE 8099 +ENV JAVA_OPTS_CONTAINER_FLAGS=-XX:MaxRAMPercentage=80 + +ARG ALFRESCO_SFS_GROUP_NAME +ARG ALFRESCO_SFS_GROUP_ID +ARG ALFRESCO_SFS_USER_NAME +ARG ALFRESCO_SFS_USER_ID + +ADD ats/sfs/alfresco-shared-file-store-controller*.jar /opt/app.jar + +# Set default environment args +ARG FILE_STORE_DIR=/tmp/Alfresco + +RUN mkdir -p ${FILE_STORE_DIR} && \ + groupadd -g ${ALFRESCO_SFS_GROUP_ID} ${ALFRESCO_SFS_GROUP_NAME} && \ + useradd -u ${ALFRESCO_SFS_USER_ID} -G ${ALFRESCO_SFS_GROUP_NAME} ${ALFRESCO_SFS_USER_NAME} && \ + chgrp -R ${ALFRESCO_SFS_GROUP_NAME} ${FILE_STORE_DIR} && \ + chmod g+rwx ${FILE_STORE_DIR} && \ + chgrp ${ALFRESCO_SFS_GROUP_NAME} /opt/app.jar + +USER ${ALFRESCO_SFS_USER_NAME} + +HEALTHCHECK --interval=30s --timeout=10s --retries=3 --start-period=1m \ + CMD curl -f http://localhost:8099/actuator/health || exit 1 + +COPY ats/sfs/entrypoint.sh /entrypoint.sh +CMD ["/entrypoint.sh"] diff --git a/ats/sfs/artifacts.json b/ats/sfs/artifacts.json new file mode 100644 index 00000000..0e2ad1e7 --- /dev/null +++ b/ats/sfs/artifacts.json @@ -0,0 +1,14 @@ +{ + "artifacts": { + "acs23": [ + { + "name": "alfresco-shared-file-store-controller", + "version": "4.1.3", + "path": "ats/sfs", + "classifier": ".jar", + "repository": "enterprise-releases", + "group": "org.alfresco" + } + ] + } +} diff --git a/ats/sfs/entrypoint.sh b/ats/sfs/entrypoint.sh new file mode 100755 index 00000000..1f50ab1c --- /dev/null +++ b/ats/sfs/entrypoint.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +exec java $JAVA_OPTS $JAVA_OPTS_CONTAINER_FLAGS -jar /opt/app.jar diff --git a/docker-bake.hcl b/docker-bake.hcl index af80712e..146b2ee0 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -11,7 +11,7 @@ group "enterprise-search" { } group "ats" { - targets = ["ats_trouter"] + targets = ["ats_trouter", "ats_sfs"] } variable "LABEL_VENDOR" { @@ -66,11 +66,11 @@ variable "LIVEINDEXING" { default = "metadata" } -variable "ALFRESCO_REPO_GROUP_ID" { +variable "ALFRESCO_GROUP_ID" { default = "1000" } -variable "ALFRESCO_REPO_GROUP_NAME" { +variable "ALFRESCO_GROUP_NAME" { default = "alfresco" } @@ -166,8 +166,8 @@ target "repository" { tomcat_base = "target:tomcat_base" } args = { - ALFRESCO_REPO_GROUP_ID = "${ALFRESCO_REPO_GROUP_ID}" - ALFRESCO_REPO_GROUP_NAME = "${ALFRESCO_REPO_GROUP_NAME}" + ALFRESCO_REPO_GROUP_ID = "${ALFRESCO_GROUP_ID}" + ALFRESCO_REPO_GROUP_NAME = "${ALFRESCO_GROUP_NAME}" ALFRESCO_REPO_USER_ID = "${ALFRESCO_REPO_USER_ID}" ALFRESCO_REPO_USER_NAME = "${ALFRESCO_REPO_USER_NAME}" } @@ -217,14 +217,6 @@ target "search_liveindexing" { output = ["type=docker"] } -variable "ALFRESCO_TROUTER_GROUP_NAME" { - default = "Alfresco" -} - -variable "ALFRESCO_TROUTER_GROUP_ID" { - default = "1000" -} - variable "ALFRESCO_TROUTER_USER_NAME" { default = "trouter" } @@ -240,8 +232,8 @@ target "ats_trouter" { java_base = "target:java_base" } args = { - ALFRESCO_TROUTER_GROUP_NAME = "${ALFRESCO_TROUTER_GROUP_NAME}" - ALFRESCO_TROUTER_GROUP_ID = "${ALFRESCO_TROUTER_GROUP_ID}" + ALFRESCO_TROUTER_GROUP_NAME = "${ALFRESCO_GROUP_NAME}" + ALFRESCO_TROUTER_GROUP_ID = "${ALFRESCO_GROUP_ID}" ALFRESCO_TROUTER_USER_NAME = "${ALFRESCO_TROUTER_USER_NAME}" ALFRESCO_TROUTER_USER_ID = "${ALFRESCO_TROUTER_USER_ID}" } @@ -252,3 +244,31 @@ target "ats_trouter" { tags = ["localhost/alfresco-transform-router:latest"] output = ["type=docker"] } + +variable "ALFRESCO_SFS_USER_NAME" { + default = "sfs" +} + +variable "ALFRESCO_SFS_USER_ID" { + default = "33030" +} + +target "ats_sfs" { + dockerfile = "./ats/sfs/Dockerfile" + inherits = ["java_base"] + contexts = { + java_base = "target:java_base" + } + args = { + ALFRESCO_SFS_GROUP_NAME = "${ALFRESCO_GROUP_NAME}" + ALFRESCO_SFS_GROUP_ID = "${ALFRESCO_GROUP_ID}" + ALFRESCO_SFS_USER_NAME = "${ALFRESCO_SFS_USER_NAME}" + ALFRESCO_SFS_USER_ID = "${ALFRESCO_SFS_USER_ID}" + } + labels = { + "org.opencontainers.image.title" = "${PRODUCT_LINE} ATS Shared File Store" + "org.opencontainers.image.description" = "Alfresco Transform Service ATS Shared File Store" + } + tags = ["localhost/alfresco-shared-file-store:latest"] + output = ["type=docker"] +} diff --git a/docker-compose/docker-compose-components.yml b/docker-compose/docker-compose-components.yml index 39f343ec..17817adb 100644 --- a/docker-compose/docker-compose-components.yml +++ b/docker-compose/docker-compose-components.yml @@ -74,12 +74,9 @@ services: depends_on: - activemq shared-file-store: - image: quay.io/alfresco/alfresco-shared-file-store:4.1.2 + image: localhost/alfresco-shared-file-store:latest mem_limit: 512m environment: - JAVA_OPTS: >- - -XX:MinRAMPercentage=50 - -XX:MaxRAMPercentage=80 scheduler.content.age.millis: 86400000 scheduler.cleanup.interval: 86400000 ports: diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index 7cd4eee5..a1a06440 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -74,12 +74,9 @@ services: depends_on: - activemq shared-file-store: - image: quay.io/alfresco/alfresco-shared-file-store:4.1.2 + image: localhost/alfresco-shared-file-store:latest mem_limit: 512m environment: - JAVA_OPTS: >- - -XX:MinRAMPercentage=50 - -XX:MaxRAMPercentage=80 scheduler.content.age.millis: 86400000 scheduler.cleanup.interval: 86400000 ports: