From edb6e4e741faef6d4e262b3798f3bbf1d0771a79 Mon Sep 17 00:00:00 2001 From: Sergiu-Alexandru Vidrascu Date: Thu, 22 Feb 2018 11:07:24 +0200 Subject: [PATCH 1/4] DEPLOY-377: Add pvc for saving database data --- .../templates/NOTES.txt | 6 +++- .../templates/pvc.yaml | 34 +++++++++++++++++++ helm/alfresco-content-services/values.yaml | 19 ++++++++--- 3 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 helm/alfresco-content-services/templates/pvc.yaml diff --git a/helm/alfresco-content-services/templates/NOTES.txt b/helm/alfresco-content-services/templates/NOTES.txt index ee8e33d798..58384621ca 100644 --- a/helm/alfresco-content-services/templates/NOTES.txt +++ b/helm/alfresco-content-services/templates/NOTES.txt @@ -12,4 +12,8 @@ echo "http://$IP:$PORT/share" DNSNAME=$(kubectl get services {{ .Release.Name }}-nginx-ingress-controller -o jsonpath={.status.loadBalancer.ingress[0].hostname}) echo "http://$DNSNAME/share" -5. Note: if you deployed on a different namespace than the default one, then the kubectl commands should also specify the namespace to run in with --namespace \ No newline at end of file +5. Note: if you deployed on a different namespace than the default one, then the kubectl commands should also specify the namespace to run in with --namespace + +6. Depending on the storage you use for volumes you should be able to access the persisted db data in the following locations: + - On minikube the usual location is /tmp/hostpath-provisioning + - With docker-for-desktop the usual location is /Users/YourUser/.docker/Volumes/ \ No newline at end of file diff --git a/helm/alfresco-content-services/templates/pvc.yaml b/helm/alfresco-content-services/templates/pvc.yaml new file mode 100644 index 0000000000..b0248bde70 --- /dev/null +++ b/helm/alfresco-content-services/templates/pvc.yaml @@ -0,0 +1,34 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +{{- if .Values.persistence.efs.enabled -}} +apiVersion: v1 +kind: PersistentVolume +metadata: + name: "{{ .Release.Namespace }}-alfresco-volume" +spec: + capacity: + storage: {{ .Values.persistence.baseSize | quote }} + accessModes: + - ReadWriteMany + nfs: + server: "{{ .Values.persistence.efs.dns }}" + path: "{{ .Values.persistence.efs.path }}" + storageClassName: efs +--- +{{- end -}} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: content-services-database-data +spec: + accessModes: + {{ if .Values.persistence.efs.enabled }} + - ReadWriteMany + volumeName: "{{ .Release.Namespace }}-alfresco-volume" + storageClassName: efs + {{ else }} + - ReadWriteOnce + {{ end }} + resources: + requests: + storage: {{ .Values.database.persistence.size | quote }} +{{- end }} diff --git a/helm/alfresco-content-services/values.yaml b/helm/alfresco-content-services/values.yaml index 45a0d66753..84da8a7a3f 100644 --- a/helm/alfresco-content-services/values.yaml +++ b/helm/alfresco-content-services/values.yaml @@ -67,6 +67,19 @@ solr: limits: memory: "500Mi" +persistence: + enabled: true + baseSize: 10Gi + efs: + enabled: false + dns: fs-example.efs.us-east-1.amazonaws.com + path: "/" + +database: + type: postgresql + persistence: + size: 2Gi + postgresql: ## If true, install the postgresql chart alongside Alfresco Content Services enabled: true @@ -76,7 +89,8 @@ postgresql: postgresPassword: alfresco postgresDatabase: alfresco persistence: - enabled: false + existingClaim: "content-services-database-data" + subPath: "alfresco-content-services/database-data" resources: requests: memory: "250Mi" @@ -84,7 +98,4 @@ postgresql: memory: "500Mi" driver: org.postgresql.Driver -database: - type: postgresql - replicaCount: 1 From bd6dffb8efb68f03648131d1936c6b4dff75a734 Mon Sep 17 00:00:00 2001 From: Sergiu-Alexandru Vidrascu Date: Tue, 27 Feb 2018 11:44:28 +0200 Subject: [PATCH 2/4] DEPLOY-377: Renamed pvs and set default reclaim policy --- helm/alfresco-content-services/templates/pvc.yaml | 12 ++++++------ helm/alfresco-content-services/values.yaml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helm/alfresco-content-services/templates/pvc.yaml b/helm/alfresco-content-services/templates/pvc.yaml index b0248bde70..478d9acf8d 100644 --- a/helm/alfresco-content-services/templates/pvc.yaml +++ b/helm/alfresco-content-services/templates/pvc.yaml @@ -1,14 +1,15 @@ {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} -{{- if .Values.persistence.efs.enabled -}} +{{- if and .Values.persistence.efs.enabled -}} apiVersion: v1 kind: PersistentVolume metadata: - name: "{{ .Release.Namespace }}-alfresco-volume" + name: content-services-pv spec: capacity: storage: {{ .Values.persistence.baseSize | quote }} accessModes: - ReadWriteMany + persistentVolumeReclaimPolicy: {{ .Values.persistence.reclaimPolicy | default "Delete" }} nfs: server: "{{ .Values.persistence.efs.dns }}" path: "{{ .Values.persistence.efs.path }}" @@ -18,12 +19,11 @@ spec: kind: PersistentVolumeClaim apiVersion: v1 metadata: - name: content-services-database-data + name: content-services-pvc spec: - accessModes: + accessModes: {{ if .Values.persistence.efs.enabled }} - ReadWriteMany - volumeName: "{{ .Release.Namespace }}-alfresco-volume" storageClassName: efs {{ else }} - ReadWriteOnce @@ -31,4 +31,4 @@ spec: resources: requests: storage: {{ .Values.database.persistence.size | quote }} -{{- end }} +{{- end }} \ No newline at end of file diff --git a/helm/alfresco-content-services/values.yaml b/helm/alfresco-content-services/values.yaml index 84da8a7a3f..653fd08286 100644 --- a/helm/alfresco-content-services/values.yaml +++ b/helm/alfresco-content-services/values.yaml @@ -89,7 +89,7 @@ postgresql: postgresPassword: alfresco postgresDatabase: alfresco persistence: - existingClaim: "content-services-database-data" + existingClaim: "content-services-pvc" subPath: "alfresco-content-services/database-data" resources: requests: From 5c9115d457c29b0f6f28daf48f09ccceb19f5b77 Mon Sep 17 00:00:00 2001 From: Sergiu-Alexandru Vidrascu Date: Tue, 27 Feb 2018 16:11:28 +0200 Subject: [PATCH 3/4] DEPLOY-377: Updated default reclaim policy to Recycle and added additional information about persistence in helm notes. --- helm/alfresco-content-services/templates/NOTES.txt | 13 +++++++++++-- helm/alfresco-content-services/templates/pvc.yaml | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/helm/alfresco-content-services/templates/NOTES.txt b/helm/alfresco-content-services/templates/NOTES.txt index 58384621ca..bb73ee9e57 100644 --- a/helm/alfresco-content-services/templates/NOTES.txt +++ b/helm/alfresco-content-services/templates/NOTES.txt @@ -14,6 +14,15 @@ echo "http://$DNSNAME/share" 5. Note: if you deployed on a different namespace than the default one, then the kubectl commands should also specify the namespace to run in with --namespace -6. Depending on the storage you use for volumes you should be able to access the persisted db data in the following locations: +6. Persistent Storage + +Depending on the storage you use for volumes you should be able to access the persisted db data in the following locations: - On minikube the usual location is /tmp/hostpath-provisioning - - With docker-for-desktop the usual location is /Users/YourUser/.docker/Volumes/ \ No newline at end of file + - With docker-for-desktop the usual location is /Users/YourUser/.docker/Volumes/ + +If you choose to use EFS for persistence keep in mind that the persistent volume created has the ReclaimPolicy set to Recycle. +This means that by default, when you delete the release the saved data is deleted automatically. + +To change this behaviour and keep the data you can set the persistence.reclaimPolicy value to Retain. + +For more Information on Reclaim Policies checkout the official K8S documentation here -> https://kubernetes.io/docs/concepts/storage/persistent-volumes/#reclaim-policy diff --git a/helm/alfresco-content-services/templates/pvc.yaml b/helm/alfresco-content-services/templates/pvc.yaml index 478d9acf8d..c7f9d73b7f 100644 --- a/helm/alfresco-content-services/templates/pvc.yaml +++ b/helm/alfresco-content-services/templates/pvc.yaml @@ -9,7 +9,7 @@ spec: storage: {{ .Values.persistence.baseSize | quote }} accessModes: - ReadWriteMany - persistentVolumeReclaimPolicy: {{ .Values.persistence.reclaimPolicy | default "Delete" }} + persistentVolumeReclaimPolicy: {{ .Values.persistence.reclaimPolicy | default "Recycle" }} nfs: server: "{{ .Values.persistence.efs.dns }}" path: "{{ .Values.persistence.efs.path }}" From 04c81bae7aa90cab9161616c2de87a23693d6756 Mon Sep 17 00:00:00 2001 From: Sergiu-Alexandru Vidrascu Date: Thu, 1 Mar 2018 12:33:41 +0200 Subject: [PATCH 4/4] DEPLOY-377: - removed pvc - updated readme and helm notes to specify infrastructure dependency - set default claim for postgres --- README.md | 22 +++++++++--- .../templates/NOTES.txt | 30 +++++----------- .../templates/pvc.yaml | 34 ------------------- helm/alfresco-content-services/values.yaml | 12 +------ 4 files changed, 28 insertions(+), 70 deletions(-) delete mode 100644 helm/alfresco-content-services/templates/pvc.yaml diff --git a/README.md b/README.md index 38a10f284e..846049e2a7 100644 --- a/README.md +++ b/README.md @@ -36,20 +36,34 @@ Build and start Alfresco Content Services Community using docker-compose or Kube ### Kubernetes Instructions: #### Prerequisite: -* A minikube/aws k8s cluster up and ready (minimum 5GB memory) +* Deploy the infrastructure chart as specified in https://github.com/Alfresco/alfresco-infrastructure-deployment * Access to docker-internal.alfresco.com and quay.io repositories - Platform Services team is working on getting the images in [Docker Hub](https://hub.docker.com/u/alfresco/) registry. * A kubernetes secret (quay-registry-secret) with the above mentioned credentials created in your cluster. +**Note!** You do not need to pull this repo in order to deploy Alfresco Content Services in Kubernetes + #### Steps -1. Go to **helm** folder -2. Run ```helm dependency update alfresco-content-services && helm install alfresco-content-services``` +1. Run ```helm repo add alfresco-incubator http://kubernetes-charts.alfresco.com/incubator``` to add the Alfresco Kubernetes repository to helm. +2. Deploy Alfresco Content Services: + +```bash +#On MINIKUBE +helm install alfresco-incubator/alfresco-content-services \ +--set dnsaddress="http://$ELBADDRESS:$INFRAPORT" \ +--namespace=$DESIREDNAMESPACE +#On AWS +helm install alfresco-incubator/alfresco-content-services \ +--set dnsaddress="http://$ELBADDRESS" \ +--namespace=$DESIREDNAMESPACE +``` + 3. After deploying the helm chart you will get information for obtaining the URL for repository, share and solr. #### Notes: * The images used in the alfresco-content-services/values.yml are images that are built in the 'docker-alfresco' and 'docker-share' subfolders of the project - see the relevant sections below. * If you don't have access to the docker-internal.alfresco.com and quay.io images, or if you want custom data in your docker images, you can use the 'docker-alfresco' and 'docker-share' folders to customize and build your customized docker images that are used in the docker-compose project. Just make sure you build them in the minikube docker environment and update the alfresco-content-services/values.yml with the tags that you created. -* You can also change those values when deploying the helm chart by running ```helm install alfresco-content-services --set repository.image.tag="yourTag" --set share.image.tag="yourTag"```. +* You can also change those values when deploying the helm chart by running ```helm install alfresco-incubator/alfresco-content-services --set repository.image.tag="yourTag" --set share.image.tag="yourTag"```. * Hint: Run ```eval $(minikube docker-env)``` to switch to your minikube docker environment on osx. ## Docker images diff --git a/helm/alfresco-content-services/templates/NOTES.txt b/helm/alfresco-content-services/templates/NOTES.txt index bb73ee9e57..5bffa0a5b2 100644 --- a/helm/alfresco-content-services/templates/NOTES.txt +++ b/helm/alfresco-content-services/templates/NOTES.txt @@ -1,28 +1,16 @@ -1. Get the share application URL by running these commands: -IP=$(minikube ip) -PORT=$(kubectl get services {{ .Release.Name }}-nginx-ingress-controller -o jsonpath={.spec.ports[0].nodePort}) -echo "http://$IP:$PORT/share" +{{ if .Values.dnsaddress }} -2. To access Repository go to /alfresco path with the same base URL -3. To access Solr go to /solr path with the same base URL +You can access all components of Alfresco Content Services using the same root address, but different paths as follows: -4. If you deployed on an AWS cluster you can get the route53 entry for the cluster as follows: + Content: {{ .Values.dnsaddress }}/alfresco + Share: {{ .Values.dnsaddress }}/share + Solr: {{ .Values.dnsaddress }}/solr -DNSNAME=$(kubectl get services {{ .Release.Name }}-nginx-ingress-controller -o jsonpath={.status.loadBalancer.ingress[0].hostname}) -echo "http://$DNSNAME/share" +{{ else }} -5. Note: if you deployed on a different namespace than the default one, then the kubectl commands should also specify the namespace to run in with --namespace +If you have a specific DNS address for the cluster please run the following commands to get the application paths: -6. Persistent Storage +helm upgrade --reuse-values {{ .Release.Name }} --set dnsaddress="Your DNS address ex: http://myenv.com" alfresco-incubator/alfresco-content-services -Depending on the storage you use for volumes you should be able to access the persisted db data in the following locations: - - On minikube the usual location is /tmp/hostpath-provisioning - - With docker-for-desktop the usual location is /Users/YourUser/.docker/Volumes/ - -If you choose to use EFS for persistence keep in mind that the persistent volume created has the ReclaimPolicy set to Recycle. -This means that by default, when you delete the release the saved data is deleted automatically. - -To change this behaviour and keep the data you can set the persistence.reclaimPolicy value to Retain. - -For more Information on Reclaim Policies checkout the official K8S documentation here -> https://kubernetes.io/docs/concepts/storage/persistent-volumes/#reclaim-policy +{{ end }} diff --git a/helm/alfresco-content-services/templates/pvc.yaml b/helm/alfresco-content-services/templates/pvc.yaml deleted file mode 100644 index c7f9d73b7f..0000000000 --- a/helm/alfresco-content-services/templates/pvc.yaml +++ /dev/null @@ -1,34 +0,0 @@ -{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} -{{- if and .Values.persistence.efs.enabled -}} -apiVersion: v1 -kind: PersistentVolume -metadata: - name: content-services-pv -spec: - capacity: - storage: {{ .Values.persistence.baseSize | quote }} - accessModes: - - ReadWriteMany - persistentVolumeReclaimPolicy: {{ .Values.persistence.reclaimPolicy | default "Recycle" }} - nfs: - server: "{{ .Values.persistence.efs.dns }}" - path: "{{ .Values.persistence.efs.path }}" - storageClassName: efs ---- -{{- end -}} -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: content-services-pvc -spec: - accessModes: - {{ if .Values.persistence.efs.enabled }} - - ReadWriteMany - storageClassName: efs - {{ else }} - - ReadWriteOnce - {{ end }} - resources: - requests: - storage: {{ .Values.database.persistence.size | quote }} -{{- end }} \ No newline at end of file diff --git a/helm/alfresco-content-services/values.yaml b/helm/alfresco-content-services/values.yaml index 653fd08286..9d81af9e9f 100644 --- a/helm/alfresco-content-services/values.yaml +++ b/helm/alfresco-content-services/values.yaml @@ -67,18 +67,8 @@ solr: limits: memory: "500Mi" -persistence: - enabled: true - baseSize: 10Gi - efs: - enabled: false - dns: fs-example.efs.us-east-1.amazonaws.com - path: "/" - database: type: postgresql - persistence: - size: 2Gi postgresql: ## If true, install the postgresql chart alongside Alfresco Content Services @@ -89,7 +79,7 @@ postgresql: postgresPassword: alfresco postgresDatabase: alfresco persistence: - existingClaim: "content-services-pvc" + existingClaim: "alfresco-volume-claim" subPath: "alfresco-content-services/database-data" resources: requests: