diff --git a/helm/alfresco-content-services/7.3.N_values.yaml b/helm/alfresco-content-services/7.3.N_values.yaml index 4e31f9074..917e0f711 100644 --- a/helm/alfresco-content-services/7.3.N_values.yaml +++ b/helm/alfresco-content-services/7.3.N_values.yaml @@ -3,6 +3,24 @@ repository: image: tag: 7.3.1 + modules: + - name: alfresco-share-services-18.15 + type: amp + url: >- + https://nexus.alfresco.com/nexus/service/local/repositories/releases/content/org/alfresco/alfresco-share-services/18.15 + - name: alfresco-googledrive-repo-enterprise-3.3.0 + type: amp + url: >- + https://nexus.alfresco.com/nexus/service/local/repositories/enterprise-releases/content/org/alfresco/integrations/alfresco-googledrive-repo-enterprise/3.3.0 + - name: alfresco-governance-services-enterprise-repo-18.15 + type: amp + url: >- + https://nexus.alfresco.com/nexus/service/local/repositories/enterprise-releases/content/org/alfresco/alfresco-governance-services-enterprise-repo/18.15 + - name: alfresco-script-root-object-1.0.0 + type: jar + url: >- + https://github.com/aborroy/alfresco-script-root-object/releases/download/1.0.0 + command: ["catalina.sh", "run"] ooiService: image: tag: 1.1.3 @@ -38,6 +56,15 @@ filestore: share: image: tag: 7.3.1 + modules: + - name: alfresco-googledrive-share-3.3.0 + type: amp + url: >- + https://nexus.alfresco.com/nexus/service/local/repositories/releases/content/org/alfresco/integrations/alfresco-googledrive-share/3.3.0 + - name: alfresco-governance-services-enterprise-share-18.19 + type: amp + url: >- + https://nexus.alfresco.com/nexus/service/local/repositories/enterprise-releases/content/org/alfresco/alfresco-governance-services-enterprise-share/18.19 activemq: image: tag: diff --git a/helm/alfresco-content-services/templates/_helpers-amps.tpl b/helm/alfresco-content-services/templates/_helpers-amps.tpl new file mode 100644 index 000000000..8aeccf24b --- /dev/null +++ b/helm/alfresco-content-services/templates/_helpers-amps.tpl @@ -0,0 +1,64 @@ +{{/* +generate an ephemral volume name +*/}} +{{- define "alfresco.amps.vols" -}} +{{ toYaml .modules | sha1sum }} +{{- end -}} + +{{/* +Alfresco modules initContainers +*/}} +{{- define "alfresco.amps.init" -}} +- name: get-amps + image: curlimages/curl:8.00.1 + #image: "{{ .image.repository }}:{{ .image.tag }}" + imagePullPolicy: {{ .image.pullPolicy }} + {{- template "component-security-context" . }} + resources: + limits: + cpu: "0.25" + memory: "10Mi" + command: + - curl + args: + - --output-dir + - /amps + - -O + - -Lv + - >- + {{- $urls := list }} + {{- range .modules }} + {{- $urls = append $urls (printf "%s/%s.%s" .url .name .type) }} + {{- end }} + { + {{- join "," $urls -}} + } + volumeMounts: + - mountPath: /amps + name: {{ template "alfresco.amps.vols" . }} +- name: repack-amps + image: alfresco/alfresco-base-java:jdk17-rockylinux8 + {{- template "component-security-context" . }} + resources: {{- toYaml .resources | nindent 4 }} + command: + - /bin/bash + - -xec + args: + - | + cd /amps + [ -d jars ] || mkdir jars + [ ! -f *.jar ] || mv *.jar jars + for AMP in $(ls /amps/*.amp); do + mkdir amp && cd $_ + jar xf $AMP + module_id=$(grep 'module\.id' module.properties | cut -d= -f 2 | tr -d '[:cntrl:]') + echo "repackaging $module_id..." + [ -d "config/alfresco/module/${module_id}" ] || mkdir -p "config/alfresco/module/${module_id}" + mv module.properties config/alfresco/module/${module_id} + jar -c -f ${AMP%.amp}-classes.jar -C config/ . + cd ../ && rm -rf amp + done + volumeMounts: + - mountPath: /amps + name: {{ template "alfresco.amps.vols" . }} +{{- end -}} diff --git a/helm/alfresco-content-services/templates/config-alfresco-context.yaml b/helm/alfresco-content-services/templates/config-alfresco-context.yaml new file mode 100644 index 000000000..fe1dbbcef --- /dev/null +++ b/helm/alfresco-content-services/templates/config-alfresco-context.yaml @@ -0,0 +1,12 @@ +{{- if .Values.repository.modules }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: alfresco-context + labels: + {{- include "repository.labels" . | nindent 4 }} +data: + alfresco.xml: |- + {{- tpl (.Files.Get "webapp-context.xml") (dict "Template" $.Template "webapp" .Values.repository) | nindent 4 }} +{{- end }} diff --git a/helm/alfresco-content-services/templates/config-share-context.yaml b/helm/alfresco-content-services/templates/config-share-context.yaml new file mode 100644 index 000000000..83100fac0 --- /dev/null +++ b/helm/alfresco-content-services/templates/config-share-context.yaml @@ -0,0 +1,12 @@ +{{- if .Values.share.modules }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: share-context + labels: + {{- include "share.labels" . | nindent 4 }} +data: + share.xml: |- + {{- tpl (.Files.Get "webapp-context.xml") (dict "Template" $.Template "webapp" .Values.share) | nindent 4 }} +{{- end }} diff --git a/helm/alfresco-content-services/templates/deployment-repository.yaml b/helm/alfresco-content-services/templates/deployment-repository.yaml index df8ec8b0a..c2ac7b3f2 100644 --- a/helm/alfresco-content-services/templates/deployment-repository.yaml +++ b/helm/alfresco-content-services/templates/deployment-repository.yaml @@ -41,7 +41,7 @@ spec: imagePullPolicy: {{ .Values.repository.image.pullPolicy }} {{- if .Values.repository.command }} command: -{{ tpl .Values.repository.command . | indent 12 }} + {{ toYaml .Values.repository.command | nindent 12 }} {{- end }} {{- include "component-security-context" .Values.repository | indent 8 }} envFrom: @@ -75,14 +75,20 @@ spec: {{- end }} resources: {{- toYaml .Values.repository.resources | nindent 12 }} volumeMounts: + - name: data + mountPath: {{ .Values.repository.persistence.data.mountPath }} + subPath: {{ .Values.repository.persistence.data.subPath }} + {{- if .Values.repository.modules }} + - name: alfresco-context + mountPath: /usr/local/tomcat/conf/Catalina/localhost/ + {{- end }} {{- if and (index .Values "alfresco-search" "enabled") (eq .Values.global.tracking.auth "secret") }} - name: repository-properties mountPath: /usr/local/tomcat/shared/classes/alfresco-global.properties subPath: alfresco-global.properties {{- end }} - - name: data - mountPath: {{ .Values.repository.persistence.data.mountPath }} - subPath: {{ .Values.repository.persistence.data.subPath }} + - mountPath: /amps + name: {{ template "alfresco.amps.vols" .Values.repository }} {{- if .Values.repository.licenseSecret }} - mountPath: /usr/local/tomcat/shared/classes/alfresco/extension/license/ name: acs-license @@ -122,6 +128,9 @@ spec: exec: command: ["/bin/bash", "-c", "sleep 20"] initContainers: + {{- if .Values.repository.modules }} + {{- include "alfresco.amps.init" .Values.repository | nindent 8 }} + {{- end }} {{- if .Values.repository.extraInitContainers }} {{- toYaml .Values.repository.extraInitContainers | nindent 8 }} {{- end }} @@ -188,6 +197,8 @@ spec: {{- end }} volumes: {{- include "data_volume" .Values.repository | nindent 8 }} + - name: {{ template "alfresco.amps.vols" .Values.repository }} + emptyDir: {{- if and (index .Values "alfresco-search" "enabled") (eq .Values.global.tracking.auth "secret") }} - name: repository-properties secret: @@ -203,6 +214,11 @@ spec: secretName: {{ .Values.repository.licenseSecret }} defaultMode: 0400 {{- end }} + {{- if .Values.repository.modules }} + - name : alfresco-context + configMap: + name: alfresco-context + {{- end }} {{- if .Values.repository.extraLogStatements }} - name : repository-logging-properties-volume configMap: diff --git a/helm/alfresco-content-services/templates/deployment-share.yaml b/helm/alfresco-content-services/templates/deployment-share.yaml index 9d7f384ed..6439fec3d 100644 --- a/helm/alfresco-content-services/templates/deployment-share.yaml +++ b/helm/alfresco-content-services/templates/deployment-share.yaml @@ -39,7 +39,7 @@ spec: {{- include "component-security-context" .Values.share | indent 8 }} {{- if .Values.share.command }} command: -{{ tpl .Values.share.command . | indent 12 }} + {{ toYaml .Values.share.command | nindent 12 }} {{- end }} ports: - containerPort: {{ .Values.share.image.internalPort }} @@ -47,8 +47,14 @@ spec: envFrom: - configMapRef: name: {{ template "content-services.shortname" . }}-share-configmap - {{- if .Values.share.extraVolumeMounts }} volumeMounts: + - mountPath: /amps + name: {{ template "alfresco.amps.vols" .Values.share }} + {{- if .Values.share.modules }} + - mountPath: /usr/local/tomcat/conf/Catalina/localhost/ + name: share-context + {{- end }} + {{- if .Values.share.extraVolumeMounts }} {{ toYaml .Values.share.extraVolumeMounts | indent 10 }} {{- end }} readinessProbe: @@ -70,11 +76,21 @@ spec: preStop: exec: command: ["/bin/bash", "-c", "sleep 20"] - {{- if .Values.share.extraInitContainers }} initContainers: + {{- if .Values.share.modules }} + {{- include "alfresco.amps.init" .Values.share | nindent 8 }} + {{- end }} + {{- if .Values.share.extraInitContainers }} {{ tpl .Values.share.extraInitContainers . | indent 8 }} {{- end }} - {{- if .Values.share.extraVolumes }} volumes: + - name: {{ template "alfresco.amps.vols" .Values.share }} + emptyDir: + {{- if .Values.share.modules }} + - name : share-context + configMap: + name: share-context + {{- end }} + {{- if .Values.share.extraVolumes }} {{ toYaml .Values.share.extraVolumes | indent 6 }} {{- end }} diff --git a/helm/alfresco-content-services/webapp-context.xml b/helm/alfresco-content-services/webapp-context.xml new file mode 100644 index 000000000..4cb9f8602 --- /dev/null +++ b/helm/alfresco-content-services/webapp-context.xml @@ -0,0 +1,24 @@ + + + + + {{- range .webapp.modules }} + {{- if eq .type "amp" }} + {{- $packedClasses := printf "%s-classes.jar" .name }} + + + + {{- end }} + {{- end }} + + diff --git a/test/community-integration-test-values.yaml b/test/community-integration-test-values.yaml index d8cc26e18..9f1dd9536 100644 --- a/test/community-integration-test-values.yaml +++ b/test/community-integration-test-values.yaml @@ -1,5 +1,30 @@ --- repository: + image: + repository: alxgomz/alfresco-community-repo-base + tag: 7.3.1-hackathon.1 + modules: + - name: alfresco-share-services-18.15 + type: amp + url: >- + https://nexus.alfresco.com/nexus/service/local/repositories/releases/content/org/alfresco/alfresco-share-services/18.15 + - name: alfresco-googledrive-repo-community-3.3.0 + type: amp + url: >- + https://nexus.alfresco.com/nexus/service/local/repositories/releases/content/org/alfresco/integrations/alfresco-googledrive-repo-community/3.3.0 + - name: alfresco-governance-services-community-repo-18.15 + type: amp + url: >- + https://nexus.alfresco.com/nexus/service/local/repo_groups/public/content/org/alfresco/alfresco-governance-services-community-repo/18.15 + - name: support-tools-repo-1.2.0.0-amp + type: amp + url: >- + https://repo1.maven.org/maven2/org/orderofthebee/support-tools/support-tools-repo/1.2.0.0 + - name: alfresco-script-root-object-1.0.0 + type: jar + url: >- + https://github.com/aborroy/alfresco-script-root-object/releases/download/1.0.0 + command: ["catalina.sh", "run"] resources: requests: cpu: "0.01" @@ -11,9 +36,19 @@ repository: persistence: accessModes: - ReadWriteOnce - image: - repository: alfresco/alfresco-content-repository-community share: + image: + repository: alxgomz/alfresco-share-community-base + tag: 7.3.1-noamps.1 + modules: + - name: alfresco-googledrive-share-3.3.0 + type: amp + url: >- + https://nexus.alfresco.com/nexus/service/local/repositories/releases/content/org/alfresco/integrations/alfresco-googledrive-share/3.3.0 + - name: alfresco-governance-services-community-share-18.19 + type: amp + url: >- + https://nexus.alfresco.com/nexus/service/local/repo_groups/public/content/org/alfresco/alfresco-governance-services-community-share/18.19 resources: requests: cpu: "0.01" @@ -21,8 +56,6 @@ share: limits: memory: "512Mi" replicaCount: 1 - image: - repository: alfresco/alfresco-share pdfrenderer: resources: requests: