From 8d9003c9bdbbe0a7204a4a953e1092096b9211ce Mon Sep 17 00:00:00 2001 From: Pierre Ozoux Date: Thu, 6 Jul 2017 00:08:04 +0100 Subject: [PATCH] Add rocket.chat (#752) * Add rocket.chat * Add additional maintainers beyond the github org * Fix mongo dependency * Improved Labels, Chart Defaults, Notes * Add labels to pod for proper kubectl selection * Allow chart to be installed with no values set * Improved output notes * add helm chart to suggested install command * Add deploy platform environment variable * Add Instance IP to pod env variable to make scaling easier * Switch app name to use app's name * Update to latest Rocket.Chat version * Remove else from ROOT_URL, its not needed --- stable/rocketchat/.helmignore | 1 + stable/rocketchat/Chart.yaml | 22 ++++++ stable/rocketchat/requirements.lock | 11 +++ stable/rocketchat/requirements.yaml | 4 + stable/rocketchat/templates/NOTES.txt | 27 +++++++ stable/rocketchat/templates/_helpers.tpl | 24 ++++++ stable/rocketchat/templates/deployment.yaml | 73 ++++++++++++++++++ stable/rocketchat/templates/ingress.yaml | 31 ++++++++ stable/rocketchat/templates/pvc.yaml | 21 +++++ stable/rocketchat/templates/secrets.yaml | 15 ++++ stable/rocketchat/templates/svc.yaml | 17 +++++ stable/rocketchat/values.yaml | 85 +++++++++++++++++++++ 12 files changed, 331 insertions(+) create mode 100644 stable/rocketchat/.helmignore create mode 100644 stable/rocketchat/Chart.yaml create mode 100644 stable/rocketchat/requirements.lock create mode 100644 stable/rocketchat/requirements.yaml create mode 100644 stable/rocketchat/templates/NOTES.txt create mode 100644 stable/rocketchat/templates/_helpers.tpl create mode 100644 stable/rocketchat/templates/deployment.yaml create mode 100644 stable/rocketchat/templates/ingress.yaml create mode 100644 stable/rocketchat/templates/pvc.yaml create mode 100644 stable/rocketchat/templates/secrets.yaml create mode 100644 stable/rocketchat/templates/svc.yaml create mode 100644 stable/rocketchat/values.yaml diff --git a/stable/rocketchat/.helmignore b/stable/rocketchat/.helmignore new file mode 100644 index 000000000000..6b8710a711f3 --- /dev/null +++ b/stable/rocketchat/.helmignore @@ -0,0 +1 @@ +.git diff --git a/stable/rocketchat/Chart.yaml b/stable/rocketchat/Chart.yaml new file mode 100644 index 000000000000..8989edb9bf14 --- /dev/null +++ b/stable/rocketchat/Chart.yaml @@ -0,0 +1,22 @@ +name: rocketchat +version: 0.0.1 +description: Prepare to take off with the ultimate chat platform, experience the next level of team communications +keywords: +- chat +- communication +- http +- web +- application +- nodejs +- javascript +- meteor +home: https://rocket.chat/ +icon: https://cdn-www.rocket.chat/images/logo/logo.svg +sources: +- https://github.com/RocketChat/Docker.Official.Image/ +maintainers: +- name: RocketChat + email: buildmaster@rocket.chat +- name: geekgonecrazy +- name: pierreozoux +engine: gotpl diff --git a/stable/rocketchat/requirements.lock b/stable/rocketchat/requirements.lock new file mode 100644 index 000000000000..887787c99310 --- /dev/null +++ b/stable/rocketchat/requirements.lock @@ -0,0 +1,11 @@ +dependencies: +- alias: "" + condition: "" + enabled: false + import-values: null + name: mongodb + repository: https://kubernetes-charts.storage.googleapis.com/ + tags: null + version: 0.4.7 +digest: sha256:e76c2327ca138151bcc776ae4b46197069026fb14f1c2386e446f91f5488593b +generated: 2017-06-29T11:26:54.116252379-05:00 diff --git a/stable/rocketchat/requirements.yaml b/stable/rocketchat/requirements.yaml new file mode 100644 index 000000000000..c609c3ae7ad8 --- /dev/null +++ b/stable/rocketchat/requirements.yaml @@ -0,0 +1,4 @@ +dependencies: +- name: mongodb + version: 0.4.7 + repository: https://kubernetes-charts.storage.googleapis.com/ diff --git a/stable/rocketchat/templates/NOTES.txt b/stable/rocketchat/templates/NOTES.txt new file mode 100644 index 000000000000..c81cb5701010 --- /dev/null +++ b/stable/rocketchat/templates/NOTES.txt @@ -0,0 +1,27 @@ +Rocket.Chat can be accessed via port 80 on the following DNS name from within your cluster: + +- http://{{ template "fullname" . }}.{{ .Release.Namespace }} + +You can easily connect to the remote instance from your browser. Forward the webserver port to localhost:8888 + +- kubectl port-forward --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "name" . }},release={{ .Release.Name }}" -o jsonpath='{ .items[0].metadata.name }') 8888:3000 + +You can also connect to the container running Rocket.Chat. To open a shell session in the pod run the following: + +- kubectl exec -i -t --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "name" . }},release={{ .Release.Name }}" -o jsonpath='{.items[0].metadata.name}') /bin/sh + +To trail the logs for the Rocket.Chat pod run the following: + +- kubectl logs -f --namespace {{ .Release.Namespace }} $(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "name" . }},release={{ .Release.Name }}" -o jsonpath='{ .items[0].metadata.name }') + +{{- if .Values.ingress.enabled }} + +Rocket.Chat will be available at the URL: + +- http://{{ .Values.host }} +{{ else }} + +To expose Rocket.Chat via an Ingress you need to set host and enable ingress. + +helm install --set host=chat.yourdomain.com --set ingress.enabled=true stable/rocketchat +{{- end -}} diff --git a/stable/rocketchat/templates/_helpers.tpl b/stable/rocketchat/templates/_helpers.tpl new file mode 100644 index 000000000000..7610d1e4beb5 --- /dev/null +++ b/stable/rocketchat/templates/_helpers.tpl @@ -0,0 +1,24 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "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). +*/}} +{{- define "fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | 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). +*/}} +{{- define "mongodb.fullname" -}} +{{- printf "%s-%s" .Release.Name "mongodb" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/stable/rocketchat/templates/deployment.yaml b/stable/rocketchat/templates/deployment.yaml new file mode 100644 index 000000000000..8aecbf9d8fd4 --- /dev/null +++ b/stable/rocketchat/templates/deployment.yaml @@ -0,0 +1,73 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + replicas: 1 + template: + metadata: + labels: + app: {{ template "name" . }} + release: "{{ .Release.Name }}" + spec: + containers: + - name: {{ template "fullname" . }} + image: "{{ .Values.image }}" + imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }} + env: + - name: DEPLOY_PLATFORM + value: helm-chart + - name: INSTANCE_IP + valueFrom: + fieldRef: + fieldPath: status.podIP + - name: MONGO_URL + {{ if .Values.mongodb.mongodbUsername }} + valueFrom: + secretKeyRef: + name: {{ template "fullname" . }} + key: mongo-uri + {{ else }} + value: mongodb://{{ template "mongodb.fullname" . }}:27017/rocketchat + {{ end }} + {{ if .Values.host }} + - name: ROOT_URL + value: https://{{ .Values.host }} + {{ end }} + - name: MAIL_URL + valueFrom: + secretKeyRef: + name: {{ template "fullname" . }} + key: mail-url + {{- range $key, $value := .Values.config }} + - name: {{ $key }} + value: {{ $value | quote }} + {{- end }} + ports: + - name: http + containerPort: 3000 + livenessProbe: + httpGet: + path: / + port: http + initialDelaySeconds: 20 + timeoutSeconds: 5 + resources: +{{ toYaml .Values.resources | indent 10 }} + volumeMounts: + - name: rocket-data + mountPath: /app/uploads + volumes: + - name: rocket-data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ template "fullname" . }} + {{- else }} + emptyDir: {} + {{- end }} + diff --git a/stable/rocketchat/templates/ingress.yaml b/stable/rocketchat/templates/ingress.yaml new file mode 100644 index 000000000000..8248b2f15acc --- /dev/null +++ b/stable/rocketchat/templates/ingress.yaml @@ -0,0 +1,31 @@ +{{- if .Values.ingress.enabled -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + annotations: +{{ toYaml .Values.ingress.annotations | indent 4 }} +{{- if .Values.ingress.tls }} + kubernetes.io/tls-acme: "true" +{{- end }} +spec: +{{- if .Values.ingress.tls }} + tls: + - hosts: + - {{ .Values.host }} + secretName: {{ template "fullname" . }}-tls +{{- end }} + rules: + - host: {{ .Values.host }} + http: + paths: + - path: / + backend: + serviceName: {{ template "fullname" . }} + servicePort: 3000 +{{- end -}} diff --git a/stable/rocketchat/templates/pvc.yaml b/stable/rocketchat/templates/pvc.yaml new file mode 100644 index 000000000000..ae1b04a1fb83 --- /dev/null +++ b/stable/rocketchat/templates/pvc.yaml @@ -0,0 +1,21 @@ +{{- if .Values.persistence.enabled -}} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + annotations: + {{- if .Values.persistence.storageClass }} + volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }} + {{- end }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- end -}} diff --git a/stable/rocketchat/templates/secrets.yaml b/stable/rocketchat/templates/secrets.yaml new file mode 100644 index 000000000000..39b5b0a6c295 --- /dev/null +++ b/stable/rocketchat/templates/secrets.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +type: Opaque +data: + mail-url: {{ printf "smtp://%s:%s@%s:%s" .Values.config.SMTP_Username .Values.config.SMTP_Password .Values.config.SMTP_Host .Values.config.SMTP_Port | b64enc | quote }} + {{ if .Values.mongodb.mongodbUsername }} + mongo-uri: {{ printf "mongodb://%s:%s@%s-mongodb:27017/%s" .Values.mongodb.mongodbUsername .Values.mongodb.mongodbPassword .Release.Name .Values.mongodb.mongodbDatabase | b64enc | quote }} + {{ end }} diff --git a/stable/rocketchat/templates/svc.yaml b/stable/rocketchat/templates/svc.yaml new file mode 100644 index 000000000000..adafe2550015 --- /dev/null +++ b/stable/rocketchat/templates/svc.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + ports: + - name: http + port: 3000 + targetPort: http + selector: + app: {{ template "name" . }} + release: "{{ .Release.Name }}" diff --git a/stable/rocketchat/values.yaml b/stable/rocketchat/values.yaml new file mode 100644 index 000000000000..976ec48d0071 --- /dev/null +++ b/stable/rocketchat/values.yaml @@ -0,0 +1,85 @@ +## Rocket Chat image version +## ref: https://hub.docker.com/r/library/rocket.chat/tags/ +## +image: rocket.chat:0.56 + +## Specify a imagePullPolicy +## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' +## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images +## +# imagePullPolicy: + +## Host for the application +## +# host: + +# Main RocketChat configuration: +config: + SMTP_Host: + SMTP_Port: + SMTP_Username: + SMTP_Password: + From_Email: + Jitsi_Enabled: false + Jitsi_Domain: meet.jit.si + Jitsi_URL_Room_Prefix: RocketChat + Jitsi_Open_New_Window: false + Jitsi_Enable_Channels: false + Jitsi_Chrome_Extension: + WebRTC_Enable_Channel: false + WebRTC_Enable_Private: false + WebRTC_Enable_Direct: false + +## +## MongoDB chart configuration +## +mongodb: + ## MongoDB admin password + ### ref: https://github.com/bitnami/bitnami-docker-mongodb/blob/master/README.md#setting-the-root-password-on-first-run + ### + ## mongodbRootPassword: + # + ## MongoDB custom user and database + ## ref: https://github.com/bitnami/bitnami-docker-mongodb/blob/master/README.md#creating-a-user-and-database-on-first-run + ## + # mongodbUsername: + # mongodbPassword: + # mongodbDatabase: + ## Enable persistence using Persistent Volume Claims + ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ + ## + persistence: + enabled: true + ## If defined, volume.beta.kubernetes.io/storage-class: + ## + # storageClass: + accessMode: ReadWriteOnce + size: 8Gi + +## Enable persistence using Persistent Volume Claims +## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ +## +persistence: + enabled: true + ## If defined, volume.beta.kubernetes.io/storage-class: + ## + # storageClass: + accessMode: ReadWriteOnce + size: 8Gi + +## Configure resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +# resources: +# requests: +# memory: 512Mi +# cpu: 300m + +## Configure the ingress object to hook into existing infastructure +### ref : http://kubernetes.io/docs/user-guide/ingress/ +### +ingress: + enabled: false + tls: false + annotations: + kubernetes.io/ingress.class: "nginx"