Skip to content

Commit

Permalink
turn env vars to global-properties file
Browse files Browse the repository at this point in the history
  • Loading branch information
alxgomz committed Sep 14, 2023
1 parent 33778d4 commit eae948a
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 112 deletions.
1 change: 1 addition & 0 deletions helm/alfresco-content-services/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Please refer to the [documentation](https://github.com/Alfresco/acs-deployment/b
| alfresco-repository.configuration.db.existingSecret.name | string | `"alfresco-cs-database"` | |
| alfresco-repository.configuration.messageBroker.existingConfigMap.name | string | `"alfresco-infrastructure"` | |
| alfresco-repository.configuration.messageBroker.existingSecret.name | string | `"alfresco-cs-database"` | |
| alfresco-repository.configuration.repository.existingConfigMap | string | `"repository"` | |
| alfresco-repository.configuration.search.existingConfigMap.name | string | `"alfresco-infrastructure"` | |
| alfresco-repository.configuration.search.existingSecret.name | string | `"solr-shared-secret"` | |
| alfresco-repository.configuration.search.flavor | string | `"solr6"` | |
Expand Down
26 changes: 13 additions & 13 deletions helm/alfresco-content-services/templates/_helpers-ats.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
Local transformers config
*/}}
{{- define "alfresco-content-service.localTransformConfig" -}}
-DlocalTransform.core-aio.url=
-DlocalTransform.pdfrenderer.url=http://{{ template "alfresco-transform-service.deployment-pdfrenderer.name" . }}
-DlocalTransform.imagemagick.url=http://{{ template "alfresco-transform-service.deployment-imagemagick.name" . }}
-DlocalTransform.libreoffice.url=http://{{ template "alfresco-transform-service.deployment-libreoffice.name" . }}
-DlocalTransform.tika.url=http://{{ template "alfresco-transform-service.deployment-tika.name" . }}
-DlocalTransform.misc.url=http://{{ template "alfresco-transform-service.deployment-transform-misc.name" . }}
localTransform.core-aio.url=
localTransform.pdfrenderer.url=http://{{ template "alfresco-transform-service.deployment-pdfrenderer.name" . }}
localTransform.imagemagick.url=http://{{ template "alfresco-transform-service.deployment-imagemagick.name" . }}
localTransform.libreoffice.url=http://{{ template "alfresco-transform-service.deployment-libreoffice.name" . }}
localTransform.tika.url=http://{{ template "alfresco-transform-service.deployment-tika.name" . }}
localTransform.misc.url=http://{{ template "alfresco-transform-service.deployment-transform-misc.name" . }}
{{- end -}}

{{/*
ATS Tengines config
*/}}
{{- define "alfresco-content-service.tengineConfig" -}}
-Dalfresco-pdf-renderer.url=http://{{ template "alfresco-transform-service.deployment-pdfrenderer.name" . }}
-Dimg.url=http://{{ template "alfresco-transform-service.deployment-imagemagick.name" . }}
-Djodconverter.url=http://{{ template "alfresco-transform-service.deployment-libreoffice.name" . }}
-Dtika.url=http://{{ template "alfresco-transform-service.deployment-tika.name" . }}
-Dtransform.misc.url=http://{{ template "alfresco-transform-service.deployment-transform-misc.name" . }}
alfresco-pdf-renderer.url=http://{{ template "alfresco-transform-service.deployment-pdfrenderer.name" . }}
img.url=http://{{ template "alfresco-transform-service.deployment-imagemagick.name" . }}
jodconverter.url=http://{{ template "alfresco-transform-service.deployment-libreoffice.name" . }}
tika.url=http://{{ template "alfresco-transform-service.deployment-tika.name" . }}
transform.misc.url=http://{{ template "alfresco-transform-service.deployment-transform-misc.name" . }}
{{- end -}}

{{/*
Expand All @@ -30,8 +30,8 @@ Get Alfresco Content Service configuration for Alfresco Transform Service
{{- if and $atsCtx.Values.filestore.enabled $atsCtx.Values.transformrouter.enabled }}
{{- $routerCtx := (dict "Values" (dict "nameOverride" "router" ) "Chart" .Chart "Release" .Release) }}
{{- $sfsCtx := (dict "Values" (dict "nameOverride" "filestore" ) "Chart" .Chart "Release" .Release) }}
-Dtransform.service.url=http://{{ template "alfresco-transform-service.deployment-transform-router.name" $atsCtx }}
-Dsfs.url=http://{{ template "alfresco-transform-service.deployment-filestore.name" $atsCtx }}
transform.service.url=http://{{ template "alfresco-transform-service.deployment-transform-router.name" $atsCtx }}
sfs.url=http://{{ template "alfresco-transform-service.deployment-filestore.name" $atsCtx }}
{{ template "alfresco-content-service.tengineConfig" $atsCtx }}
{{- end }}
{{- end }}
21 changes: 21 additions & 0 deletions helm/alfresco-content-services/templates/_helpers-legacy.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{/*
Create a default fully qualified name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "alfresco-content-services.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "content-services.fullname" -}}
{{- template "alfresco-content-services.fullname" . }}
{{- end -}}

{{- define "content-services.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" -}}
{{- end }}

{{- define "content-services.activemq.fullname" -}}
{{- $data := dict "Release" .Release "Values" .Values.activemq "Chart" (dict "Name" "activemq") }}
{{- include "activemq.fullname" $data }}
{{- end }}
65 changes: 53 additions & 12 deletions helm/alfresco-content-services/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,21 +1,62 @@
{{/*
Create a default fully qualified name.
Expand the name of the chart.
*/}}
{{- define "alfresco-content-services.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "alfresco-content-services.fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "alfresco-content-services.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{- define "content-services.fullname" -}}
{{- template "alfresco-content-services.fullname" . }}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "alfresco-content-services.labels" -}}
helm.sh/chart: {{ include "alfresco-content-services.chart" . }}
{{ include "alfresco-content-services.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{- define "content-services.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" -}}
{{/*
Selector labels
*/}}
{{- define "alfresco-content-services.selectorLabels" -}}
app.kubernetes.io/name: {{ include "alfresco-content-services.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "content-services.activemq.fullname" -}}
{{- $data := dict "Release" .Release "Values" .Values.activemq "Chart" (dict "Name" "activemq") }}
{{- include "activemq.fullname" $data }}
{{/*
Create the name of the service account to use
*/}}
{{- define "alfresco-content-services.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "alfresco-content-services.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
153 changes: 66 additions & 87 deletions helm/alfresco-content-services/templates/config-repository.yaml
Original file line number Diff line number Diff line change
@@ -1,125 +1,104 @@
# Defines the properties required by the content repository
apiVersion: v1
kind: ConfigMap
metadata:
# the name of the config map
name: {{ template "content-services.shortname" . }}-repository-configmap
name: repository
labels:
{{- include "repository.labels" . | nindent 4 }}
{{- include "alfresco-content-services.labels" . | nindent 4 }}
data:
# The JAVA_OPTS defined in the values.yaml file for the "repository" are set here using proper quotes
{{- if .Values.repository.environment }}
{{- range $key, $val := .Values.repository.environment }}
{{ $key }}: {{ tpl $val $ | quote }}
{{- end }}
{{- end }}
RELEASE_NAME: {{ .Release.Name }}
{{- $alfUrl := include "alfresco-common.external.url" . }}
CATALINA_OPTS: >-
-Ddeployment.method=HELM_CHART
-Dalfresco.cluster.enabled={{ gt (.Values.repository.replicaCount | int) 1 }}
{{- if .Values.repository.licenseSecret }}
-Ddir.license.external=/usr/local/tomcat/shared/classes/alfresco/extension/license/
{{- end }}
-Dalfresco.host={{ template "alfresco-common.external.host" . }}
-Dalfresco.protocol={{ template "alfresco-common.external.scheme" . }}
-Dalfresco.port={{ template "alfresco-common.external.port" . }}
-Daos.baseUrlOverwrite={{ $alfUrl }}/alfresco/aos
-Dcsrf.filter.origin={{ $alfUrl }}
-Dcsrf.filter.referer={{ $alfUrl }}/.*
alfresco-global.properties: |
{{- $alfUrl := include "alfresco-common.external.url" . }}
deployment.method=HELM_CHART
alfresco.cluster.enabled={{ gt (.Values.repository.replicaCount | int) 1 }}
alfresco.host={{ template "alfresco-common.external.host" . }}
alfresco.protocol={{ template "alfresco-common.external.scheme" . }}
alfresco.port={{ template "alfresco-common.external.port" . }}
aos.baseUrlOverwrite={{ $alfUrl }}/alfresco/aos
csrf.filter.origin={{ $alfUrl }}
csrf.filter.referer={{ $alfUrl }}/.*
{{- if .Values.share.enabled }}
-Dshare.protocol={{ template "alfresco-common.external.scheme" . }}
-Dshare.host={{ template "alfresco-common.external.host" . }}
-Dshare.port={{ template "alfresco-common.external.port" . }}
{{- end }}
{{- $subsys := include "repository.indexSubsystem" . -}}
{{- if ne $subsys "none" }}
{{- include "repository.indexConfig" . | indent 4 }}
share.protocol={{ template "alfresco-common.external.scheme" . }}
share.host={{ template "alfresco-common.external.host" . }}
share.port={{ template "alfresco-common.external.port" . }}
{{- end }}
-Dindex.subsystem.name={{ $subsys }}
-Dlocal.transform.service.enabled={{ index .Values "alfresco-transform-service" "enabled" }}
alfresco_user_store.adminpassword={{ .Values.repository.adminPassword }}
local.transform.service.enabled={{ index .Values "alfresco-transform-service" "enabled" }}
{{- with (index .Values "alfresco-transform-service") }}
{{- $ats_for_enterprise := and .filestore.enabled .transformrouter.enabled }}
-Dtransform.service.enabled={{ and .enabled $ats_for_enterprise }}
transform.service.enabled={{ and .enabled $ats_for_enterprise }}
{{- end }}
{{- if index .Values "alfresco-transform-service" "enabled" }}
{{- include "alfresco-content-service.atsConfig" . | indent 4 }}
{{- end }}
{{/*
{{- if .Values.s3connector.enabled }}
{{- range $key, $val := .Values.s3connector.config }}
-Ds3.{{ $key }}={{ $val }}
s3.{{ $key }}={{ $val }}
{{- end }}
{{- end }}
{{- if .Values.email.server.enabled }}
-Demail.server.enabled={{ .Values.email.server.enabled }}
-Demail.server.port={{ .Values.email.server.port }}
-Demail.server.domain={{ .Values.email.server.domain }}
-Demail.server.enableTLS={{ .Values.email.server.enableTLS }}
-Demail.server.hideTLS={{ .Values.email.server.hideTLS }}
-Demail.server.requireTLS={{ .Values.email.server.requireTLS }}
-Demail.server.auth.enabled={{ .Values.email.server.auth.enabled }}
-Demail.server.connections.max={{ .Values.email.server.connections.max }}
-Demail.server.allowed.senders={{ .Values.email.server.allowed.senders }}
-Demail.server.blocked.senders={{ .Values.email.server.blocked.senders }}
-Demail.inbound.enabled={{ .Values.email.inbound.enabled }}
-Demail.inbound.unknownUser={{ .Values.email.inbound.unknownUser }}
-Demail.inbound.emailContributorsAuthority={{ .Values.email.inbound.emailContributorsAuthority }}
-Demail.handler.folder.overwriteDuplicates={{ .Values.email.handler.folder.overwriteDuplicates }}
-Dimap.server.enabled={{ .Values.imap.server.enabled }}
-Dimap.server.port={{ .Values.imap.server.port }}
-Dimap.server.host={{ .Values.imap.server.host }}
-Dimap.server.imap.enabled={{ .Values.imap.server.imap.enabled }}
-Dimap.server.imaps.enabled={{ .Values.imap.server.imaps.enabled }}
-Dimap.server.imaps.port={{ .Values.imap.server.imaps.port }}
-Dimap.mail.from.default={{ .Values.imap.mail.from.default }}
-Dimap.mail.to.default={{ .Values.imap.mail.to.default }}
-Dsystem.usages.enabled=true
-Dnotification.email.siteinvite=true
email.server.enabled={{ .Values.email.server.enabled }}
email.server.port={{ .Values.email.server.port }}
email.server.domain={{ .Values.email.server.domain }}
email.server.enableTLS={{ .Values.email.server.enableTLS }}
email.server.hideTLS={{ .Values.email.server.hideTLS }}
email.server.requireTLS={{ .Values.email.server.requireTLS }}
email.server.auth.enabled={{ .Values.email.server.auth.enabled }}
email.server.connections.max={{ .Values.email.server.connections.max }}
email.server.allowed.senders={{ .Values.email.server.allowed.senders }}
email.server.blocked.senders={{ .Values.email.server.blocked.senders }}
email.inbound.enabled={{ .Values.email.inbound.enabled }}
email.inbound.unknownUser={{ .Values.email.inbound.unknownUser }}
email.inbound.emailContributorsAuthority={{ .Values.email.inbound.emailContributorsAuthority }}
email.handler.folder.overwriteDuplicates={{ .Values.email.handler.folder.overwriteDuplicates }}
imap.server.enabled={{ .Values.imap.server.enabled }}
imap.server.port={{ .Values.imap.server.port }}
imap.server.host={{ .Values.imap.server.host }}
imap.server.imap.enabled={{ .Values.imap.server.imap.enabled }}
imap.server.imaps.enabled={{ .Values.imap.server.imaps.enabled }}
imap.server.imaps.port={{ .Values.imap.server.imaps.port }}
imap.mail.from.default={{ .Values.imap.mail.from.default }}
imap.mail.to.default={{ .Values.imap.mail.to.default }}
system.usages.enabled=true
notification.email.siteinvite=true
{{- if .Values.email.server.enableTLS }}
-Djavax.net.ssl.keyStore=/var/run/secrets/java.io/keystores/keystore.jks -Djavax.net.ssl.keyStorePassword=changeit
javax.net.ssl.keyStore=/var/run/secrets/java.io/keystores/keystore.jks -Djavax.net.ssl.keyStorePassword=changeit
{{- end }}
{{- end }}
{{- if .Values.mail.host }}
-Dmail.encoding={{ .Values.mail.encoding }}
-Dmail.host={{ .Values.mail.host }}
-Dmail.port={{ .Values.mail.port }}
-Dmail.protocol={{ .Values.mail.protocol }}
-Dmail.username={{ .Values.mail.username }}
-Dmail.from.default={{ .Values.mail.from.default }}
-Dmail.from.enabled={{ .Values.mail.from.enabled }}
-Dmail.smtp.auth={{ .Values.mail.smtp.auth }}
-Dmail.smtp.debug={{ .Values.mail.smtp.debug }}
-Dmail.smtp.starttls.enable={{ .Values.mail.smtp.starttls.enable }}
-Dmail.smtp.timeout={{ .Values.mail.smtp.timeout }}
-Dmail.smtps.auth={{ .Values.mail.smtps.auth }}
-Dmail.smtps.starttls.enable={{ .Values.mail.smtps.starttls.enable }}
mail.encoding={{ .Values.mail.encoding }}
mail.host={{ .Values.mail.host }}
mail.port={{ .Values.mail.port }}
mail.protocol={{ .Values.mail.protocol }}
mail.username={{ .Values.mail.username }}
mail.from.default={{ .Values.mail.from.default }}
mail.from.enabled={{ .Values.mail.from.enabled }}
mail.smtp.auth={{ .Values.mail.smtp.auth }}
mail.smtp.debug={{ .Values.mail.smtp.debug }}
mail.smtp.starttls.enable={{ .Values.mail.smtp.starttls.enable }}
mail.smtp.timeout={{ .Values.mail.smtp.timeout }}
mail.smtps.auth={{ .Values.mail.smtps.auth }}
mail.smtps.starttls.enable={{ .Values.mail.smtps.starttls.enable }}
{{- end }}
{{- if index .Values "alfresco-sync-service" "enabled" }}
-Ddsync.service.uris={{ $alfUrl }}/syncservice
dsync.service.uris={{ $alfUrl }}/syncservice
{{- else }}
-Devents.subsystem.autoStart=false
events.subsystem.autoStart=false
{{- end }}
{{- if and .Values.mail.host (or .Values.mail.password .Values.mail.existingSecretName) }}
-Dmail.password=$MAIL_PASSWORD
mail.password=$MAIL_PASSWORD
{{- end }}
{{- if .Values.s3connector.enabled }}
{{- if .Values.s3connector.secrets.accessKey }}
-Ds3.accessKey=$ACCESSKEY
s3.accessKey=$ACCESSKEY
{{- end }}
{{- if .Values.s3connector.secrets.secretKey }}
-Ds3.secretKey=$SECRETKEY
s3.secretKey=$SECRETKEY
{{- end }}
{{- if .Values.s3connector.secrets.encryption }}
-Ds3.encryption=$ENCRYPTION
s3.encryption=$ENCRYPTION
{{- end }}
{{- if .Values.s3connector.secrets.awsKmsKeyId }}
-Ds3.awsKmsKeyId=$KMSKEYID
s3.awsKmsKeyId=$KMSKEYID
{{- end }}
{{- end }}
-Dmetadata-keystore.password=$METADATA_KEYSTORE_PASSWORD
-Dmetadata-keystore.metadata.password=$METADATA_KEY_PASSWORD
-Dmessaging.broker.url=$BROKER_URL
-Dmessaging.broker.username=$BROKER_USERNAME
-Dmessaging.broker.password=$BROKER_PASSWORD
-Dencryption.ssl.truststore.location=$JAVA_HOME/lib/security/cacerts
-Dalfresco_user_store.adminpassword=$REPO_ADMIN_PASSWORD
*/}}
2 changes: 2 additions & 0 deletions helm/alfresco-content-services/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ search:
alfresco-repository:
nameOverride: alfresco-repository
configuration:
repository:
existingConfigMap: repository
db:
existingConfigMap:
name: *infrastructure_cmName
Expand Down

0 comments on commit eae948a

Please sign in to comment.