Skip to content
This repository was archived by the owner on Feb 22, 2022. It is now read-only.

[stable/suitecrm] adds chart to deploy SuiteCRM #1258

Merged
merged 13 commits into from
Jul 31, 2017
1 change: 1 addition & 0 deletions stable/suitecrm/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git
14 changes: 14 additions & 0 deletions stable/suitecrm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: suitecrm
version: 0.2.0
description: SuiteCRM is a completely open source enterprise-grade Customer Relationship Management (CRM) application. SuiteCRM is a software fork of the popular customer relationship management (CRM) system SugarCRM.
keywords:
- suitecrm
- CRM
home: http://www.suitecrm.com
sources:
- https://github.com/bitnami/bitnami-docker-suitecrm
maintainers:
- name: Bitnami
email: [email protected]
engine: gotpl
icon: https://bitnami.com/assets/stacks/osclass/img/osclass-stack-110x117.png
113 changes: 113 additions & 0 deletions stable/suitecrm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# SuiteCRM

[SuiteCRM](https://www.suitecrm.com) SuiteCRM is a completely open source enterprise-grade Customer Relationship Management (CRM) application. SuiteCRM is a software fork of the popular customer relationship management (CRM) system SugarCRM.

## TL;DR;

```console
$ helm install stable/suitecrm
```

## Introduction

This chart bootstraps a [SuiteCRM](https://github.com/bitnami/bitnami-docker-suitecrm) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.

It also packages the [Bitnami MariaDB chart](https://github.com/kubernetes/charts/tree/master/stable/mariadb) which is required for bootstrapping a MariaDB deployment for the database requirements of the SuiteCRM application.

## Prerequisites

- Kubernetes 1.5+ with Beta APIs enabled
- PV provisioner support in the underlying infrastructure

## Installing the Chart

To install the chart with the release name `my-release`:

```console
$ helm install --name my-release stable/suitecrm
```

The command deploys SuiteCRM on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.

> **Tip**: List all releases using `helm list`

## Uninstalling the Chart

To uninstall/delete the `my-release` deployment:

```console
$ helm delete my-release
```

The command removes all the Kubernetes components associated with the chart and deletes the release.

## Configuration

The following tables lists the configurable parameters of the SuiteCRM chart and their default values.

| Parameter | Description | Default |
|-------------------------------------|-------------------------------------------|---------------------------------------------|
| `imageTag` | `bitnami/suitecrm` image tag. | SuiteCRM image version |
| `imagePullPolicy` | Image pull policy. | `IfNotPresent` |
| `suitecrmHost` | SuiteCRM host to create application URLs | `nil` |
| `suitecrmLoadBalancerIP` | `loadBalancerIP` for the SuiteCRM Service | `nil` |
| `suitecrmUsername` | User of the application | `user` |
| `suitecrmPassword` | Application password | _random 10 character alphanumeric string_ |
| `suitecrmEmail` | Admin email | `[email protected]` |
| `suitecrmLastName` | Last name | `Last` |
| `suitecrmSmtpHost` | SMTP host | `nil` |
| `suitecrmSmtpPort` | SMTP port | `nil` |
| `suitecrmSmtpUser` | SMTP user | `nil` |
| `suitecrmSmtpPassword` | SMTP password | `nil` |
| `suitecrmSmtpProtocol` | SMTP protocol [`ssl`, `tls`] | `nil` |
| `mariadb.mariadbRootPassword` | MariaDB admin password | `nil` |
| `serviceType` | Kubernetes Service type | `LoadBalancer` |
| `persistence.enabled` | Enable persistence using PVC | `true` |
| `persistence.apache.storageClass` | PVC Storage Class for apache volume | `nil` (uses alpha storage class annotation) |
| `persistence.apache.accessMode` | PVC Access Mode for apache volume | `ReadWriteOnce` |
| `persistence.apache.size` | PVC Storage Request for apache volume | `1Gi` |
| `persistence.suitecrm.storageClass` | PVC Storage Class for SuiteCRM volume | `nil` (uses alpha storage class annotation) |
| `persistence.suitecrm.accessMode` | PVC Access Mode for SuiteCRM volume | `ReadWriteOnce` |
| `persistence.suitecrm.size` | PVC Storage Request for SuiteCRM volume | `8Gi` |
| `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` |

The above parameters map to the env variables defined in [bitnami/suitecrm](https://github.com/bitnami/bitnami-docker-suitecrm). For more information please refer to the [bitnami/suitecrm](https://github.com/bitnami/bitnami-docker-suitecrm) image documentation.

> **Note**:
>
> For SuiteCRM to function correctly, you should specify the `suitecrmHost` parameter to specify the FQDN (recommended) or the public IP address of the SuiteCRM service.
>
> Optionally, you can specify the `suitecrmLoadBalancerIP` parameter to assign a reserved IP address to the SuiteCRM service of the chart. However please note that this feature is only available on a few cloud providers (f.e. GKE).
>
> To reserve a public IP address on GKE:
>
> ```bash
> $ gcloud compute addresses create suitecrm-public-ip
> ```
>
> The reserved IP address can be associated to the SuiteCRM service by specifying it as the value of the `suitecrmLoadBalancerIP` parameter while installing the chart.

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,

```console
$ helm install --name my-release \
--set suitecrmUsername=admin,suitecrmPassword=password,mariadb.mariadbRootPassword=secretpassword \
stable/suitecrm
```

The above command sets the SuiteCRM administrator account username and password to `admin` and `password` respectively. Additionally it sets the MariaDB `root` user password to `secretpassword`.

Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example,

```console
$ helm install --name my-release -f values.yaml stable/suitecrm
```

> **Tip**: You can use the default [values.yaml](values.yaml)

## Persistence

The [Bitnami SuiteCRM](https://github.com/bitnami/bitnami-docker-suitecrm) image stores the SuiteCRM data and configurations at the `/bitnami/suitecrm` and `/bitnami/apache` paths of the container.

Persistent Volume Claims are used to keep the data across deployments. This is known to work in GCE, AWS, and minikube.
See the [Configuration](#configuration) section to configure the PVC or to disable persistence.
10 changes: 10 additions & 0 deletions stable/suitecrm/requirements.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
dependencies:
- condition: ""
enabled: false
import-values: null
name: mariadb
repository: https://kubernetes-charts.storage.googleapis.com/
tags: null
version: 0.6.3
digest: sha256:99135a083bee8717224e9f5a4e151b2831bc8367b1b88075b6405dd190ac7a11
generated: 2017-06-07T16:16:02.415627682+05:30
4 changes: 4 additions & 0 deletions stable/suitecrm/requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dependencies:
- name: mariadb
version: 0.6.3
repository: https://kubernetes-charts.storage.googleapis.com/
50 changes: 50 additions & 0 deletions stable/suitecrm/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{{- if empty (include "host" .) -}}
###############################################################################
### ERROR: You did not provide an external host in your 'helm install' call ###
###############################################################################

This deployment will be incomplete until you configure SuiteCRM with a resolvable
host. To configure SuiteCRM with the URL of your service:

1. Get the SuiteCRM URL by running:

{{- if contains "NodePort" .Values.serviceType }}

export APP_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.spec.ports[0].nodePort}")
export APP_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")

{{- else if contains "LoadBalancer" .Values.serviceType }}

NOTE: It may take a few minutes for the LoadBalancer IP to be available.
Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "fullname" . }}'

export APP_HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
export APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.suitecrm-password}" | base64 --decode)
{{- if .Values.mariadb.mariadbRootPassword }}
export APP_DATABASE_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "mariadb.fullname" . }} -o jsonpath="{.data.mariadb-root-password}" | base64 --decode)
{{- end }}
{{- end }}

2. Complete your SuiteCRM deployment by running:

helm upgrade {{ .Release.Name }} \
--set suitecrmHost=$APP_HOST,suitecrmPassword=$APP_PASSWORD{{ if .Values.mariadb.mariadbRootPassword }},mariadb.mariadbRootPassword=$APP_DATABASE_PASSWORD{{ end }} stable/suitecrm

{{- else -}}
1. Get the SuiteCRM URL by running:

{{- if eq .Values.serviceType "ClusterIP" }}

export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }}" -o jsonpath="{.items[0].metadata.name}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"app={{ template "fullname" . }}" -> "app={{ template "name" . }},release={{ .Release.Name }}"

echo http://127.0.0.1:8080/
kubectl port-forward $POD_NAME 8080:80
{{- else }}

echo URL : http://{{ include "host" . }}/
{{- end }}

2. Get your SuiteCRM login credentials by running:

echo Username : {{ .Values.suitecrmUsername }}
echo Password : $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.suitecrm-password}" | base64 --decode)
{{- end }}
45 changes: 45 additions & 0 deletions stable/suitecrm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{/* 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 "mariadb.fullname" -}}
{{- printf "%s-%s" .Release.Name "mariadb" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Get the user defined LoadBalancerIP for this release.
Note, returns 127.0.0.1 if using ClusterIP.
*/}}
{{- define "serviceIP" -}}
{{- if eq .Values.serviceType "ClusterIP" -}}
127.0.0.1
{{- else -}}
{{- index .Values (printf "%sLoadBalancerIP" .Chart.Name) | default "" -}}
{{- end -}}
{{- end -}}

{{/*
Gets the host to be used for this application.
If not using ClusterIP, or if a host or LoadBalancerIP is not defined, the value will be empty.
*/}}
{{- define "host" -}}
{{- $host := index .Values (printf "%sHost" .Chart.Name) | default "" -}}
{{- default (include "serviceIP" .) $host -}}
{{- end -}}
23 changes: 23 additions & 0 deletions stable/suitecrm/templates/apache-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- if .Values.persistence.enabled -}}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "fullname" . }}-apache
labels:
app: {{ template "name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
annotations:
{{- if .Values.persistence.apache.storageClass }}
volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.apache.storageClass | quote }}
{{- else }}
volume.alpha.kubernetes.io/storage-class: default
{{- end }}
spec:
accessModes:
- {{ .Values.persistence.apache.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.apache.size | quote }}
{{- end -}}
103 changes: 103 additions & 0 deletions stable/suitecrm/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
{{- if include "host" . -}}
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:
template:
metadata:
labels:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only app and release label should be added here.

app: {{ template "name" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
containers:
- name: {{ template "fullname" . }}
image: "{{ .Values.image }}"
imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add default "" .

env:
- name: MARIADB_HOST
value: {{ template "mariadb.fullname" . }}
- name: MARIADB_PORT_NUMBER
value: "3306"
- name: MARIADB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "mariadb.fullname" . }}
key: mariadb-root-password
- name: SUITECRM_HOST
value: {{ include "host" . | quote }}
- name: SUITECRM_USERNAME
value: {{ default "" .Values.suitecrmUsername | quote }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add default "" if you add an empty default to values.yml. Apply where applicable in the whole chart.

- name: SUITECRM_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}
key: suitecrm-password
- name: SUITECRM_EMAIL
value: {{ default "" .Values.suitecrmEmail | quote }}
- name: SUITECRM_LAST_NAME
value: {{ default "" .Values.suitecrmLastName | quote }}
- name: SUITECRM_SMTP_HOST
value: {{ default "" .Values.suitecrmSmtpHost | quote }}
- name: SUITECRM_SMTP_PORT
value: {{ default "" .Values.suitecrmSmtpPort | quote }}
- name: SUITECRM_SMTP_USER
value: {{ default "" .Values.suitecrmSmtpUser | quote }}
- name: SUITECRM_SMTP_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "fullname" . }}
key: suitecrm-smtp-password
- name: SUITECRM_SMTP_PROTOCOL
value: {{ default "" .Values.suitecrmSmtpProtocol | quote }}
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
livenessProbe:
httpGet:
path: /index.php
port: http
httpHeaders:
- name: Host
value: {{ include "host" . | quote }}
initialDelaySeconds: 300
readinessProbe:
httpGet:
path: /index.php
port: http
httpHeaders:
- name: Host
value: {{ include "host" . | quote }}
initialDelaySeconds: 60
resources:
{{ toYaml .Values.resources | indent 10 }}
volumeMounts:
- name: suitecrm-data
mountPath: /bitnami/suitecrm
- name: apache-data
mountPath: /bitnami/apache
volumes:
- name: suitecrm-data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ template "fullname" . }}-suitecrm
{{- else }}
emptyDir: {}
{{- end }}
- name: apache-data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ template "fullname" . }}-apache
{{- else }}
emptyDir: {}
{{- end }}
{{- end -}}
17 changes: 17 additions & 0 deletions stable/suitecrm/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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:
{{ if .Values.suitecrmPassword }}
suitecrm-password: {{ default "" .Values.suitecrmPassword | b64enc | quote }}
{{ else }}
suitecrm-password: {{ randAlphaNum 10 | b64enc | quote }}
{{ end }}
suitecrm-smtp-password: {{ default "" .Values.suitecrmSmtpPassword | b64enc | quote }}
Loading