diff --git a/README.md b/README.md index 545ba6e855..de6394ef4a 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ This project contains the code for packaging the entire Alfresco Content Service * ```mvn clean install``` in the root of the project will build everything. Note: It is not easy to build the full installer locally (and impossible on Windows) so, most likely you don't want to create the installer locally. Comment out the installer in the root pom.xml in order to avoid building the installer locally. -## Docker-compose -Build and start Alfresco Content Services Community using docker-compose, containing: +## Docker-compose & Kubernetes +Build and start Alfresco Content Services Community using docker-compose or Kubernetes, containing: 1. Alfresco Repository for community, with: 1.1. Alfresco Share Services amp 1.2. Alfresco AOS amp @@ -19,7 +19,7 @@ Build and start Alfresco Content Services Community using docker-compose, contai 3. A Postgres DB 4. Alfresco Solr6 -### Instructions: +### Docker Compose Instructions: #### Prerequisite: * Docker installed locally * 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. @@ -34,6 +34,22 @@ Build and start Alfresco Content Services Community using docker-compose, contai * The images used in the docker-compose.yml are images that are build 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 use proper tags when you create the images and update the docker-compose.yml with these proper tags that you created. +### Kubernetes Instructions: +#### Prerequisite: +* A minikube k8s cluster up and ready +* 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. + +#### Steps +1. Go to **helm** folder +2. Run ```helm install alfresco-content-services``` +3. After deploying the helm chart you will get information for obtaining the URL for alfresco, share and solr. + +#### Notes: + +* The images used in the docker-compose.yml are images that are build 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 use proper tags when you create the images and update the docker-compose.yml with these proper tags that you created. + + ## Docker images These images are used to build the images used by the docker-compose.yml project to bring up an ACS Community, similar to what the installer did/does. The images are based on *pure* _content services_ and _share_ images done by the _acs-packaging_ and _share_ projects and adds the amps and settings necessary for running the images in a similar fashion to what the ACS deployment with the installer did/does. diff --git a/helm/alfresco-content-services/.helmignore b/helm/alfresco-content-services/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/helm/alfresco-content-services/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/helm/alfresco-content-services/Chart.yaml b/helm/alfresco-content-services/Chart.yaml new file mode 100644 index 0000000000..9091863fda --- /dev/null +++ b/helm/alfresco-content-services/Chart.yaml @@ -0,0 +1,13 @@ +name: alfresco-content-services +version: 0.0.1 +description: A Helm chart for deploying Alfresco Content Services +keywords: +- content +- content services +- alfresco +- community +- alfresco community +home: https://www.alfresco.com +sources: +- https://github.com/Alfresco/acs-community-full-packaging/tree/master/helm +icon: https://avatars0.githubusercontent.com/u/391127?s=200&v=4 \ No newline at end of file diff --git a/helm/alfresco-content-services/charts/nginx-ingress-0.8.18.tgz b/helm/alfresco-content-services/charts/nginx-ingress-0.8.18.tgz new file mode 100644 index 0000000000..03b8a5398a Binary files /dev/null and b/helm/alfresco-content-services/charts/nginx-ingress-0.8.18.tgz differ diff --git a/helm/alfresco-content-services/charts/postgresql-0.8.5.tgz b/helm/alfresco-content-services/charts/postgresql-0.8.5.tgz new file mode 100644 index 0000000000..ad298dc869 Binary files /dev/null and b/helm/alfresco-content-services/charts/postgresql-0.8.5.tgz differ diff --git a/helm/alfresco-content-services/requirements.lock b/helm/alfresco-content-services/requirements.lock new file mode 100644 index 0000000000..cd6064fabc --- /dev/null +++ b/helm/alfresco-content-services/requirements.lock @@ -0,0 +1,9 @@ +dependencies: +- name: postgresql + repository: https://kubernetes-charts.storage.googleapis.com/ + version: 0.8.5 +- name: nginx-ingress + repository: https://kubernetes-charts.storage.googleapis.com + version: 0.8.18 +digest: sha256:ee2a7ec0ed228940857082137c9fe72ff81fc4a2bdb3ca8315d258066750b714 +generated: 2017-12-15T16:41:34.393214+02:00 diff --git a/helm/alfresco-content-services/requirements.yaml b/helm/alfresco-content-services/requirements.yaml new file mode 100644 index 0000000000..92118edfa8 --- /dev/null +++ b/helm/alfresco-content-services/requirements.yaml @@ -0,0 +1,8 @@ + +dependencies: +- name: postgresql + version: 0.8.5 + repository: https://kubernetes-charts.storage.googleapis.com/ +- name: nginx-ingress + version: ^0.8.11 + repository: https://kubernetes-charts.storage.googleapis.com \ No newline at end of file diff --git a/helm/alfresco-content-services/templates/NOTES.txt b/helm/alfresco-content-services/templates/NOTES.txt new file mode 100644 index 0000000000..02531b1398 --- /dev/null +++ b/helm/alfresco-content-services/templates/NOTES.txt @@ -0,0 +1,8 @@ +1. Get the 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" + +2. To access Alfresco go to /alfresco path with the same base URL +4. To access Solr go to /solr path with the same base URL diff --git a/helm/alfresco-content-services/templates/_helpers.tpl b/helm/alfresco-content-services/templates/_helpers.tpl new file mode 100644 index 0000000000..a834dbe6a0 --- /dev/null +++ b/helm/alfresco-content-services/templates/_helpers.tpl @@ -0,0 +1,8 @@ +{{/* +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 "content-services.fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} \ No newline at end of file diff --git a/helm/alfresco-content-services/templates/config-repository.yaml b/helm/alfresco-content-services/templates/config-repository.yaml new file mode 100644 index 0000000000..93d678b0ef --- /dev/null +++ b/helm/alfresco-content-services/templates/config-repository.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "content-services.fullname" . }}-repository-configmap + labels: + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} +data: + {{- if .Values.repository.environment }} + {{- range $key, $val := .Values.repository.environment }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} + CATALINA_OPTS: " -Ddb.driver=org.postgresql.Driver + -Ddb.username={{ .Values.postgresql.postgresUser }} + -Ddb.password={{ .Values.postgresql.postgresPassword }} + -Ddb.url=jdbc:postgresql://{{ .Release.Name }}-postgresql-acs:5432/{{ .Values.postgresql.postgresDatabase }} + -Dsolr.host={{ template "content-services.fullname" . }}-solr + -Dsolr.port={{ .Values.solr.service.externalPort }}" \ No newline at end of file diff --git a/helm/alfresco-content-services/templates/config-share.yaml b/helm/alfresco-content-services/templates/config-share.yaml new file mode 100644 index 0000000000..078ecbcc90 --- /dev/null +++ b/helm/alfresco-content-services/templates/config-share.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "content-services.fullname" . }}-share-configmap + labels: + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} +data: + REPO_HOST: "{{ template "content-services.fullname" . }}-repository" + REPO_PORT: "{{ .Values.repository.service.externalPort }}" \ No newline at end of file diff --git a/helm/alfresco-content-services/templates/config-solr.yaml b/helm/alfresco-content-services/templates/config-solr.yaml new file mode 100644 index 0000000000..d24bfb4264 --- /dev/null +++ b/helm/alfresco-content-services/templates/config-solr.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "content-services.fullname" . }}-solr-configmap + labels: + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} +data: + SOLR_ALFRESCO_HOST: "{{ template "content-services.fullname" . }}-repository" + SOLR_ALFRESCO_PORT: "{{ .Values.repository.service.externalPort }}" + SOLR_SOLR_HOST: "{{ template "content-services.fullname" . }}-solr" + SOLR_SOLR_PORT: "{{ .Values.solr.image.internalPort }}" + {{- if .Values.solr.environment }} + {{- range $key, $val := .Values.solr.environment }} + {{ $key }}: {{ $val | quote }} + {{- end }} + {{- end }} \ No newline at end of file diff --git a/helm/alfresco-content-services/templates/deployment-repository.yaml b/helm/alfresco-content-services/templates/deployment-repository.yaml new file mode 100644 index 0000000000..cdf6c64ae1 --- /dev/null +++ b/helm/alfresco-content-services/templates/deployment-repository.yaml @@ -0,0 +1,32 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "content-services.fullname" . }}-repository + labels: + app: {{ template "content-services.fullname" . }}-repository + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.repository.replicaCount }} + template: + metadata: + labels: + app: {{ template "content-services.fullname" . }}-repository + release: {{ .Release.Name }} + spec: + imagePullSecrets: + - name: {{ .Values.registryPullSecrets }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.repository.image.repository }}:{{ .Values.repository.image.tag }}" + imagePullPolicy: {{ .Values.repository.image.pullPolicy }} + envFrom: + - configMapRef: + name: {{ template "content-services.fullname" . }}-repository-configmap + ports: + - containerPort: {{ .Values.repository.image.internalPort }} + initContainers: + - name: init-postgres + image: busybox + command: ['sh', '-c', 'until nslookup {{ .Release.Name }}-postgresql-acs; do echo "waiting for postgres"; sleep 2; done;'] diff --git a/helm/alfresco-content-services/templates/deployment-share.yaml b/helm/alfresco-content-services/templates/deployment-share.yaml new file mode 100644 index 0000000000..bdfb3ad7c8 --- /dev/null +++ b/helm/alfresco-content-services/templates/deployment-share.yaml @@ -0,0 +1,28 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "content-services.fullname" . }}-share + labels: + app: {{ template "content-services.fullname" . }}-share + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.share.replicaCount }} + template: + metadata: + labels: + app: {{ template "content-services.fullname" . }}-share + release: {{ .Release.Name }} + spec: + imagePullSecrets: + - name: {{ .Values.registryPullSecrets }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.share.image.repository }}:{{ .Values.share.image.tag }}" + imagePullPolicy: {{ .Values.share.image.pullPolicy }} + ports: + - containerPort: {{ .Values.share.image.internalPort }} + envFrom: + - configMapRef: + name: {{ template "content-services.fullname" . }}-share-configmap \ No newline at end of file diff --git a/helm/alfresco-content-services/templates/deployment-solr.yaml b/helm/alfresco-content-services/templates/deployment-solr.yaml new file mode 100644 index 0000000000..197d9c812d --- /dev/null +++ b/helm/alfresco-content-services/templates/deployment-solr.yaml @@ -0,0 +1,28 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "content-services.fullname" . }}-solr + labels: + app: {{ template "content-services.fullname" . }}-solr + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.solr.replicaCount }} + template: + metadata: + labels: + app: {{ template "content-services.fullname" . }}-solr + release: {{ .Release.Name }} + spec: + imagePullSecrets: + - name: {{ .Values.registryPullSecrets }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.solr.image.repository }}:{{ .Values.solr.image.tag }}" + imagePullPolicy: {{ .Values.solr.image.pullPolicy }} + envFrom: + - configMapRef: + name: {{ template "content-services.fullname" . }}-solr-configmap + ports: + - containerPort: {{ .Values.solr.image.internalPort }} \ No newline at end of file diff --git a/helm/alfresco-content-services/templates/ingress-repository.yaml b/helm/alfresco-content-services/templates/ingress-repository.yaml new file mode 100644 index 0000000000..c5b56d9824 --- /dev/null +++ b/helm/alfresco-content-services/templates/ingress-repository.yaml @@ -0,0 +1,15 @@ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "content-services.fullname" . }}-repository + annotations: + kubernetes.io/ingress.class: "nginx" + ingress.kubernetes.io/ssl-redirect: "false" +spec: + rules: + - http: + paths: + - path: {{ .Values.repository.ingress.path }} + backend: + serviceName: {{ template "content-services.fullname" . }}-repository + servicePort: {{ .Values.repository.service.externalPort }} \ No newline at end of file diff --git a/helm/alfresco-content-services/templates/ingress-share.yaml b/helm/alfresco-content-services/templates/ingress-share.yaml new file mode 100644 index 0000000000..c04f8ea2b6 --- /dev/null +++ b/helm/alfresco-content-services/templates/ingress-share.yaml @@ -0,0 +1,15 @@ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "content-services.fullname" . }}-share + annotations: + kubernetes.io/ingress.class: "nginx" + ingress.kubernetes.io/ssl-redirect: "false" +spec: + rules: + - http: + paths: + - path: {{ .Values.share.ingress.path }} + backend: + serviceName: {{ template "content-services.fullname" . }}-share + servicePort: {{ .Values.share.service.externalPort }} \ No newline at end of file diff --git a/helm/alfresco-content-services/templates/ingress-solr.yaml b/helm/alfresco-content-services/templates/ingress-solr.yaml new file mode 100644 index 0000000000..64a6d16af0 --- /dev/null +++ b/helm/alfresco-content-services/templates/ingress-solr.yaml @@ -0,0 +1,15 @@ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "content-services.fullname" . }}-solr + annotations: + kubernetes.io/ingress.class: "nginx" + ingress.kubernetes.io/ssl-redirect: "false" +spec: + rules: + - http: + paths: + - path: {{ .Values.solr.ingress.path }} + backend: + serviceName: {{ template "content-services.fullname" . }}-solr + servicePort: {{ .Values.solr.service.externalPort }} \ No newline at end of file diff --git a/helm/alfresco-content-services/templates/svc-repository.yaml b/helm/alfresco-content-services/templates/svc-repository.yaml new file mode 100644 index 0000000000..848830ce00 --- /dev/null +++ b/helm/alfresco-content-services/templates/svc-repository.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "content-services.fullname" . }}-repository + labels: + app: {{ template "content-services.fullname" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.repository.service.type }} + ports: + - port: {{ .Values.repository.service.externalPort }} + targetPort: {{ .Values.repository.image.internalPort }} + name: {{ .Values.repository.service.name }} + selector: + app: {{ template "content-services.fullname" . }}-repository + release: {{ .Release.Name }} \ No newline at end of file diff --git a/helm/alfresco-content-services/templates/svc-share.yaml b/helm/alfresco-content-services/templates/svc-share.yaml new file mode 100644 index 0000000000..15f4bd6a87 --- /dev/null +++ b/helm/alfresco-content-services/templates/svc-share.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "content-services.fullname" . }}-share + labels: + app: {{ template "content-services.fullname" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.share.service.type }} + ports: + - port: {{ .Values.share.service.externalPort }} + targetPort: {{ .Values.share.image.internalPort }} + name: {{ .Values.share.service.name }} + selector: + app: {{ template "content-services.fullname" . }}-share + release: {{ .Release.Name }} \ No newline at end of file diff --git a/helm/alfresco-content-services/templates/svc-solr.yaml b/helm/alfresco-content-services/templates/svc-solr.yaml new file mode 100644 index 0000000000..8e4d8e7d9b --- /dev/null +++ b/helm/alfresco-content-services/templates/svc-solr.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "content-services.fullname" . }}-solr + labels: + app: {{ template "content-services.fullname" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.solr.service.type }} + ports: + - port: {{ .Values.solr.service.externalPort }} + targetPort: {{ .Values.solr.image.internalPort }} + name: {{ .Values.solr.service.name }} + selector: + app: {{ template "content-services.fullname" . }}-solr + release: {{ .Release.Name }} \ No newline at end of file diff --git a/helm/alfresco-content-services/values.yaml b/helm/alfresco-content-services/values.yaml new file mode 100644 index 0000000000..1afcfda968 --- /dev/null +++ b/helm/alfresco-content-services/values.yaml @@ -0,0 +1,64 @@ +# Default values for alfresco-acs. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +registryPullSecrets: quay-registry-secret + +repository: + replicaCount: 1 + image: + repository: quay.io/alfresco/alfresco-full-content-services-community + tag: "latest" + pullPolicy: Always + internalPort: 8080 + service: + name: alfresco + type: NodePort + externalPort: 80 + ingress: + path: /alfresco + environment: + JAVA_OPTS: " -Dsolr.base.url=/solr + -Dsolr.secureComms=none + -Dindex.subsystem.name=solr6" + +share: + replicaCount: 1 + image: + repository: quay.io/alfresco/alfresco-full-share + tag: "5.2.X" + pullPolicy: Always + internalPort: 8080 + service: + name: share + type: NodePort + externalPort: 80 + ingress: + path: /share + +solr: + replicaCount: 1 + image: + repository: quay.io/alfresco/search-services + tag: "1.2.0-SNAPSHOT" + pullPolicy: IfNotPresent + internalPort: 8983 + service: + name: solr + type: NodePort + externalPort: 80 + ingress: + path: /solr + environment: + SOLR_CREATE_ALFRESCO_DEFAULTS: alfresco,archive + +postgresql: + nameOverride: postgresql-acs + imageTag: "9.4.12" + + postgresUser: alfresco + postgresPassword: alfresco + postgresDatabase: alfresco + + persistence: + enabled: false