Skip to content

Commit

Permalink
Remove deprecated MongoDB and NGINX, support TAR node store, version 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaszmichalak committed Nov 15, 2023
1 parent d070cc3 commit 87365a4
Show file tree
Hide file tree
Showing 17 changed files with 79 additions and 581 deletions.
82 changes: 16 additions & 66 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# WebSight Charts
![Version: 1.6.0](https://img.shields.io/badge/Version-1.6.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.19.0](https://img.shields.io/badge/AppVersion-1.19.0-informational?style=flat-square)
![Version: 2.0.0](https://img.shields.io/badge/Version-2.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.22.1](https://img.shields.io/badge/AppVersion-1.22.1-informational?style=flat-square)

This chart bootstraps WebSight CMS deployment on a Kubernetes cluster using the Helm package manager.

Expand All @@ -26,11 +26,6 @@ helm upgrade --install my-websight websight-cms \

> WebSight instance will be available at:
> - CMS Panel: http://cms.127.0.0.1.nip.io
> - Demo sites:
> - http://kyanite.127.0.0.1.nip.io
> - http://luna-low-code.127.0.0.1.nip.io
> - http://luna.127.0.0.1.nip.io
> - http://luna-no-code.127.0.0.1.nip.io
### Installing the Chart
To install the chart with the release name `my-websight` using existing domain that points to your Kubernetes cluster, run:
Expand All @@ -54,67 +49,34 @@ The command removes all the Kubernetes components associated with the chart and
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| cms.customAdminSecret | string | `nil` | Name of the secret (without release name prefix) where custom admin password is stored under `WS_ADMIN_PASSWORD` key |
| cms.debug.enabled | bool | `false` | enables WebSight CMS debug on port 5005 |
| cms.env | list | `[]` | WebSight CMS environment variables |
| cms.envsFromConfig | list | `[]` | List of WebSight CMS config maps that will work with `configMapRef` |
| cms.envsFromSecret | list | `[]` | List of WebSight CMS secrets that will work with `secretRef` |
| cms.image.pullPolicy | string | `"IfNotPresent"` | WebSight CMS project image pull policy |
| cms.image.repository | string | `"public.ecr.aws/ds/websight-cms-starter"` | WebSight CMS project image repository |
| cms.image.tag | string | `nil` | WebSight CMS project image tag, overwrites value from `.Chart.appVersion` |
| cms.debug.enabled | bool | `false` | enables debug on port 5005 |
| cms.env | list | `[]` | environment variables |
| cms.envsFromConfig | list | `[]` | List of config maps that will work with `configMapRef` |
| cms.envsFromSecret | list | `[]` | List of secrets that will work with `secretRef` |
| cms.image.pullPolicy | string | `"IfNotPresent"` | project image pull policy |
| cms.image.repository | string | `"europe-docker.pkg.dev/websight-io/public/websight-cms-starter"` | project image repository |
| cms.image.tag | string | `nil` | project image tag, overwrites value from `.Chart.appVersion` |
| cms.imagePullSecrets | list | `[]` | cms image pull secrets |
| cms.livenessProbe.enabled | bool | `true` | enables WebSight CMS pods liveness probe |
| cms.livenessProbe.enabled | bool | `true` | enables pods liveness probe |
| cms.livenessProbe.failureThreshold | int | `3` | |
| cms.livenessProbe.initialDelaySeconds | int | `30` | |
| cms.livenessProbe.periodSeconds | int | `10` | |
| cms.livenessProbe.successThreshold | int | `1` | |
| cms.livenessProbe.timeoutSeconds | int | `3` | |
| cms.nodeSelector | object | `nil` | CMS node selector |
| cms.readinessProbe.enabled | bool | `true` | enables WebSight CMS pods readiness probe |
| cms.nodeSelector | object | `nil` | node selector |
| cms.persistence.mode | string | `"tar"` | |
| cms.persistence.tar.size | string | `"2Gi"` | tar persistance volume size |
| cms.persistence.tar.storageClassName | string | `""` | |
| cms.readinessProbe.enabled | bool | `true` | enables pods readiness probe |
| cms.readinessProbe.failureThreshold | int | `3` | |
| cms.readinessProbe.initialDelaySeconds | int | `30` | |
| cms.readinessProbe.periodSeconds | int | `30` | |
| cms.readinessProbe.successThreshold | int | `1` | |
| cms.readinessProbe.timeoutSeconds | int | `10` | |
| cms.replicas | int | `1` | number of WebSight CMS replicas |
| cms.resources | object | `{}` | WebSight CMS container's resources settings |
| cms.resources | object | `{}` | container's resources settings |
| ingress.annotations | object | `{"kubernetes.io/ingress.class":"nginx","nginx.ingress.kubernetes.io/proxy-body-size":"5m"}` | custom ingress annotations |
| ingress.enabled | bool | `false` | enables ingress |
| ingress.hosts.cms | string | `"cms.127.0.0.1.nip.io"` | cms panel host |
| ingress.hosts.sites | list | `[]` | demo sites hosts, should correspond with your `nginx.customServerConfigurations` config |
| mongo.env | list | `[{"name":"MONGO_INITDB_ROOT_PASSWORD","value":"mongoadmin"},{"name":"MONGO_INITDB_ROOT_USERNAME","value":"mongoadmin"}]` | MongoDB Content Store environment variables |
| mongo.image.pullPolicy | string | `"IfNotPresent"` | MongoDB Content Store image pull policy |
| mongo.image.repository | string | `"mongo"` | MongoDB Content Store image repository |
| mongo.image.tag | string | `"4.4.6"` | MongoDB Content Store image tag |
| mongo.livenessProbe.enabled | bool | `true` | enables MongoDB pods liveness probe |
| mongo.livenessProbe.failureThreshold | int | `3` | |
| mongo.livenessProbe.initialDelaySeconds | int | `15` | |
| mongo.livenessProbe.periodSeconds | int | `10` | |
| mongo.livenessProbe.successThreshold | int | `1` | |
| mongo.livenessProbe.timeoutSeconds | int | `5` | |
| mongo.nodeSelector | object | `nil` | MongoDB node selector |
| mongo.replicas | int | `1` | number of MongoDB replicas - valid values are `0` or `1`, do not set above `1` |
| mongo.resources | object | `{}` | MongoDB resources settings |
| mongo.storage.size | string | `"2Gi"` | MongoDB Repository volume size |
| nginx.configurationTemplates | list | `[]` | list of Nginx custom templates that will be atached to the container under `/etc/nginx/templates/` directory using `configMapRef` and processed by `envsubst` command during the entrypoint execution, read more [here](https://hub.docker.com/_/nginx#:~:text=Using%20environment%20variables%20in%20nginx%20configuration) |
| nginx.customServerConfigurations | list | `[]` | list of Nginx custom configs that will be atached to the container under `/etc/nginx/conf.d/` directory using `configMapRef` |
| nginx.enabled | bool | `true` | enables Web Server |
| nginx.env | list | `[]` | WebSight Nginx environment variables |
| nginx.host | string | `"127.0.0.1.nip.io"` | WebSight Nginx host name used for Nginx config, overwrite it to change the nginx configurations `server_name` |
| nginx.image.pullPolicy | string | `"IfNotPresent"` | Web Server image pull policy |
| nginx.image.repository | string | `"nginx"` | Web Server image repository |
| nginx.image.tag | string | `"1.23.3"` | Web Server project image tag |
| nginx.livenessProbe.enabled | bool | `true` | enables WebSight Nginx pods liveness probe |
| nginx.livenessProbe.failureThreshold | int | `6` | |
| nginx.livenessProbe.initialDelaySeconds | int | `5` | |
| nginx.livenessProbe.periodSeconds | int | `5` | |
| nginx.livenessProbe.successThreshold | int | `1` | |
| nginx.livenessProbe.timeoutSeconds | int | `1` | |
| nginx.nodeSelector | object | `nil` | WebSight Nginx node selector |
| nginx.replicas | int | `2` | number of Web Server replicas |
| nginx.resources | object | `{}` | WebSight Nginx resources settings |
| siteRepository.enabled | bool | `true` | enables Site Repository volume |
| siteRepository.rwxStorageClassName | string | `nil` | Configure storageClassName in case you want to use `ReadWriteMany` access mode |
| siteRepository.storage.size | string | `"2Gi"` | Site Repository volume size |
| ingress.hosts.cms | string | `"cms.127.0.0.1.nip.io"` | cms host |

### configuration

Expand Down Expand Up @@ -150,15 +112,3 @@ cms:
- cms-admin # add all `<Release name>-cms-admin` secrets as env variables (this is how CMS reads custom username)
customAdminSecret: cms-admin # mount `<Release name>-cms-admin` secret for CMS pod and add value from `WS_ADMIN_PASSWORD` key as a secret file (this is how CMS reads custom password)
```
#### Nginx custom configuration
> Out-of-the-box, nginx doesn't support environment variables inside most configuration blocks. But this image has a function, which will extract environment variables before nginx starts.
Read more about the mechanics [here](https://hub.docker.com/_/nginx#:~:text=Using%20environment%20variables%20in%20nginx%20configuration).
Use `nginx.configurationTemplates` to add custom configuration templates to the nginx via configMapRef and `nginx.env` to pass the environment variables to the nginx.

## Improvements (help wanted)

- `*` use Community MongoDB Operator instead of custom mongo chart
4 changes: 2 additions & 2 deletions websight-cms/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: websight-cms
description: This chart bootstraps WebSight CMS deployment on a Kubernetes cluster using the Helm package manager.
type: application
version: 1.6.0
appVersion: "1.19.0"
version: 2.0.0
appVersion: "1.22.1"
24 changes: 5 additions & 19 deletions websight-cms/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,16 @@
> Make sure to install [Nginx ingress](https://kubernetes.github.io/ingress-nginx/deploy/) before installing WebSight CMS.

```bash
helm upgrade --install my-websight websight-cms \
helm upgrade --install websight-cms websight-cms \
--repo https://websight-io.github.io/charts \
--namespace ws --create-namespace --set ingress.enabled=true
--namespace cms --create-namespace --set ingress.enabled=true
```

helm upgrade --install websight-cms . \
--namespace cms --create-namespace --set ingress.enabled=true

> WebSight instance will be available at:
> - CMS Panel: http://cms.127.0.0.1.nip.io
> - Demo sites:
> - http://kyanite.127.0.0.1.nip.io
> - http://luna-low-code.127.0.0.1.nip.io
> - http://luna.127.0.0.1.nip.io
> - http://luna-no-code.127.0.0.1.nip.io

### Installing the Chart
To install the chart with the release name `my-websight` using existing domain that points to your Kubernetes cluster, run:
Expand Down Expand Up @@ -89,15 +87,3 @@ cms:
- cms-admin # add all `<Release name>-cms-admin` secrets as env variables (this is how CMS reads custom username)
customAdminSecret: cms-admin # mount `<Release name>-cms-admin` secret for CMS pod and add value from `WS_ADMIN_PASSWORD` key as a secret file (this is how CMS reads custom password)
```

#### Nginx custom configuration

> Out-of-the-box, nginx doesn't support environment variables inside most configuration blocks. But this image has a function, which will extract environment variables before nginx starts.

Read more about the mechanics [here](https://hub.docker.com/_/nginx#:~:text=Using%20environment%20variables%20in%20nginx%20configuration).

Use `nginx.configurationTemplates` to add custom configuration templates to the nginx via configMapRef and `nginx.env` to pass the environment variables to the nginx.

## Improvements (help wanted)

- `*` use Community MongoDB Operator instead of custom mongo chart
4 changes: 0 additions & 4 deletions websight-cms/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ Your WebSight CE instance is starting...
{{- if .Values.ingress.enabled }}
WebSight instance will be available at:{{ ` ` }}
- CMS Panel: http://{{ .Values.ingress.hosts.cms }}
- Demo sites:
{{- range .Values.ingress.hosts.sites }}
- http://{{ . }}
{{- end }}
{{- end }}

{{- if .Values.cms.customAdminSecret }}
Expand Down
39 changes: 14 additions & 25 deletions websight-cms/templates/cms/cms-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "websight-cms.fullname" . }}-cms
name: {{ include "websight-cms.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "websight-cms.name" . }}-cms
app.kubernetes.io/instance: {{ .Release.Name }}-cms
app.kubernetes.io/version: {{ .Values.cms.image.tag }}
app.kubernetes.io/websight-version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: cms
app.kubernetes.io/part-of: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- include "websight-cms.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.cms.replicas }}
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: {{ include "websight-cms.name" . }}-cms
app.kubernetes.io/instance: {{ .Release.Name }}-cms
{{- include "websight-cms.selectorLabels" . | nindent 6 }}
strategy:
type: Recreate
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "websight-cms.name" . }}-cms
app.kubernetes.io/instance: {{ .Release.Name }}-cms
{{- include "websight-cms.selectorLabels" . | nindent 8 }}
spec:
{{- if .Values.cms.imagePullSecrets }}
imagePullSecrets: {{- .Values.cms.imagePullSecrets | toYaml | nindent 8 }}
Expand All @@ -32,10 +24,6 @@ spec:
image: "{{ .Values.cms.image.repository }}:{{ default .Chart.AppVersion .Values.cms.image.tag }}"
imagePullPolicy: {{ .Values.cms.image.pullPolicy }}
env:
- name: MONGODB_HOST
value: {{ include "websight-cms.fullname" . }}-mongo
- name: MONGODB_PORT
value: "27017"
{{- range $k, $v := .Values.cms.env }}
- name: {{ $v.name }}
value: {{ $v.value | quote }}
Expand Down Expand Up @@ -65,15 +53,15 @@ spec:
{{ toYaml .Values.cms.resources | indent 12 }}
{{- end }}
volumeMounts:
{{- if eq .Values.cms.persistence.mode "tar" }}
- name: segment-store-repository
mountPath: /websight/launcher/repository
{{- end }}
{{- if .Values.cms.customAdminSecret }}
- name: admin-password
mountPath: /websight/resources/secrets
mountPath: /websight/launcher/resources/secrets
readOnly: true
{{- end }}
{{- if .Values.siteRepository.enabled }}
- mountPath: /websight/docroot
name: site-repository
{{- end }}
{{- if .Values.cms.livenessProbe.enabled }}
livenessProbe:
initialDelaySeconds: {{ .Values.cms.livenessProbe.initialDelaySeconds }}
Expand All @@ -100,10 +88,10 @@ spec:
{{- end }}
restartPolicy: Always
volumes:
{{- if .Values.siteRepository.enabled }}
- name: site-repository
{{- if eq .Values.cms.persistence.mode "tar" }}
- name: segment-store-repository
persistentVolumeClaim:
claimName: {{ include "websight-cms.fullname" . }}-site-repository
claimName: {{ include "websight-cms.fullname" . }}-tar
{{- end }}
{{- if .Values.cms.customAdminSecret }}
- name: admin-password
Expand All @@ -116,4 +104,5 @@ spec:
{{- if .Values.cms.nodeSelector }}
nodeSelector: {{- .Values.cms.nodeSelector | toYaml | nindent 8 }}
{{- end }}

status: {}
13 changes: 3 additions & 10 deletions websight-cms/templates/cms/cms-service.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "websight-cms.fullname" . }}-cms
name: {{ include "websight-cms.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "websight-cms.name" . }}-cms
app.kubernetes.io/instance: {{ .Release.Name }}-cms
app.kubernetes.io/version: {{ .Values.cms.image.tag }}
app.kubernetes.io/websight-version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: cms
app.kubernetes.io/part-of: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- include "websight-cms.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- name: panel
port: 8080
targetPort: 8080
selector:
app.kubernetes.io/name: {{ include "websight-cms.name" . }}-cms
app.kubernetes.io/instance: {{ .Release.Name }}-cms
{{- include "websight-cms.selectorLabels" . | nindent 4 }}
15 changes: 15 additions & 0 deletions websight-cms/templates/cms/cms-tar-pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if eq .Values.cms.persistence.mode "tar" -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "websight-cms.fullname" . }}-tar
labels:
{{- include "websight-cms.labels" . | nindent 4 }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.cms.persistence.tar.size }}
# storageClassName: {{ .Values.cms.persistence.tar.storageClass }}
{{- end -}}
23 changes: 3 additions & 20 deletions websight-cms/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ metadata:
annotations: {{- .Values.ingress.annotations | toYaml | nindent 4 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ include "websight-cms.name" . }}-ingress
app.kubernetes.io/instance: {{ .Release.Name }}-ingress
app.kubernetes.io/websight-version: {{ .Chart.AppVersion }}
app.kubernetes.io/component: "ingress"
app.kubernetes.io/part-of: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- include "websight-cms.labels" . | nindent 4 }}
spec:
rules:
- host: {{ tpl .Values.ingress.hosts.cms . }}
Expand All @@ -22,19 +17,7 @@ spec:
path: "/"
backend:
service:
name: {{ include "websight-cms.fullname" . }}-cms
name: {{ include "websight-cms.fullname" . }}
port:
number: 8080
{{- range .Values.ingress.hosts.sites }}
- host: {{ tpl . $ }}
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: {{ include "websight-cms.fullname" $ }}-nginx
port:
number: 80
{{- end }}
number: 8080
{{- end }}
Loading

0 comments on commit 87365a4

Please sign in to comment.