Skip to content

Commit

Permalink
Tock Helm Chart initial version for theopenconversationkit (#1)
Browse files Browse the repository at this point in the history
* initial version

* updates

readme,
upgrade tock version  to 24.9.3
solve tock configuration issues

* upgrade genai orchestrator configs

* add pgvector , upgrade mongodb helmchart

* update helper for pgvector

* add rag sample
  • Loading branch information
sacquatella authored Nov 7, 2024
1 parent 38c8baf commit 688d7ee
Show file tree
Hide file tree
Showing 65 changed files with 4,008 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
charts/tock/README-Origin.md
.DS_Store
/tmp

### Helm ###
# Chart dependencies
**/charts/*.tgz
packages/
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
CHART=charts/tock
chartversion?=`awk '/^version/ {print $$NF}' ${CHART}/Chart.yaml`
appversion?=`awk '/^appVersion/ {print $$NF}' ${CHART}/Chart.yaml`


lint:
helm lint ${CHART}

debug:
helm install --dry-run --debug tockdebug ${CHART}

template:
helm template test ${CHART} --debug

version:
@echo "Chart Name:tock Application Version:$(appversion) Chart Version:${chartversion}"

build:
helm repo add bitnami https://charts.bitnami.com/bitnami
helm dep update ${CHART}
helm lint ${CHART}
echo "Chart Name:Tock Application Version:${appversion} Chart Version:${chartversion} "
helm package ${CHART} --version ${chartversion} --app-version ${appversion} --destination packages

doc:
helm-docs -c ${CHART}

publish:
helm push packages/tock-${chartversion}.tgz oci://registry.hub.docker.com/onelans
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Helm Chart for Tock (theopenconversationkit)


[Tock](https://doc.tock.ai/fr/), an open conversational AI platform provide a complete solution to build conversational agents aka bots.

Tock can integrate and experiment with both classic and Generative AI (LLM, RAG) models.


## Quick start

```console
$ helm install mytock ./charts/tock
```

## DLDR

```console
$ helm install my-release oci://registry.hub.docker.com/onelans/tock --version 0.4.4
```

You will find more information on chart parameters at the helm chart [README](charts/tock/README.md).

## What is deployed

The chart deploy all tock components. It's able also to deploy a mongodb database (Bitnami mongoDb chart is used as subchart) or use an existing mongodb backend. In the same feeling, since version 24.3.2 of tock, opensearch can be deployed as sub chart (opensearch chart is used as subchart) and since version 24.9.3 PGvector can be deployer as sub chart (bitnami chart is used as subchart).

![Tock on K8S](tock-24x-on-k8s.png)
15 changes: 15 additions & 0 deletions charts/tock/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
dependencies:
- name: mongodb
repository: https://charts.bitnami.com/bitnami
version: 14.8.3
- name: opensearch
repository: https://opensearch-project.github.io/helm-charts/
version: 2.21.0
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 13.4.4
- name: opensearch-dashboards
repository: https://opensearch-project.github.io/helm-charts/
version: 2.19.0
digest: sha256:2e07cc09c0ec22303869433fbefe49c66b34d643bf49d41e018a38b65befb8ac
generated: "2024-10-23T08:49:04.181528+02:00"
40 changes: 40 additions & 0 deletions charts/tock/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apiVersion: v2
appVersion: 24.9.3
description: A helm chart for Tock. Tock is an open conversational AI platform. It's a complete solution to build conversational agents aka bots.Tock can integrate and experiment with both classic and Generative AI (LLM, RAG) models
name: tock
type: application
version: 0.4.4

maintainers:
- name: stephanacquatella

dependencies:
- name: mongodb
#version: 13.6.8
version: 14.8.3
repository : https://charts.bitnami.com/bitnami
condition: global.deployMongoDb.enabled
tags:
- mongodb

- name: opensearch
version: 2.21.0
repository : https://opensearch-project.github.io/helm-charts/
condition: global.deployOpenSearch.enabled
tags:
- opensearch

- name: postgresql
version: 13.4.4
repository : https://charts.bitnami.com/bitnami
condition: global.deployPgVector.enabled
tags:
- postgres

- name: opensearch-dashboards
version: 2.19.0
repository : https://opensearch-project.github.io/helm-charts/
condition: global.deployOpenSearch.enabled
tags:
- opensearch
- dashboard
423 changes: 423 additions & 0 deletions charts/tock/README.md

Large diffs are not rendered by default.

160 changes: 160 additions & 0 deletions charts/tock/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
{{ template "chart.header" . }}
{{ template "chart.description" . }}

{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}



## DLDR

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

```console
$ helm registry login -u myuser registry.hub.docker.com
$ helm install my-release oci://registry.hub.docker.com/onelans/{{ template "chart.name" . }} --version 0.4.4
```

## Introduction

This chart helps to setup a Tock environnement.


{{ template "chart.requirementsSection" . }}

## Sections

This creates values, but sectioned into own section tables if a section comment is provided.

{{ template "chart.valuesSection" . }}



## Authentification configurations

The following sample could be added as ConfigMap to configure the authentication of the admin web interface.

To use it , you have to apply the following ConfigMap to your cluster.

```console
$ kubectl apply -f ./admin-web-auth-cfg.yaml
```

And set in your values file `adminWeb.authCongifMap` to `admin-web-auth-cfg` (configmap name)

`admin-web-auth-cfg.yaml`

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: admin-web-auth-cfg
labels:
app.kubernetes.io/name: admin-web-auth
app.kubernetes.io/component: admin-web
data:
tock_users: "alice@tock.ai,bob@tock.ai" # Credentials (separated by commas). Default value `admin@app.com`
tock_passwords: "secret1,secret2" # Password (separated by commas). Default value `password`
tock_organizations: "tock,tock" # Organizations (separated by commas). Default value `app``
tock_roles: "botUser,nlpUser|botUser|admin|technicalAdmin" # Roles separated | (and then by commas). Default value is empty."
```

In this example, Alice has the role 'botUser', whereas Bob has all roles.
To define the identities and roles of several users, separate their values with commas.

You can find more information about the roles in the [Tock documentation](https://doc.tock.ai/tock/fr/admin/securite/#r%C3%B4les)

## Deployment on arm64 and processor without AVX instructions

It seems the native build of MongoDB requires AVX instructions at the processor level

https://github.com/bitnami/charts/issues/12834

For Arm, the image used in value must be changed and the following Mongodb chart image should be used instead.

https://artifacthub.io/packages/helm/bitnami/mongodb/14.8.3

## Deployment sample on Rancher Desktop or k3s

```console
$ helm install mytock oci://registry.hub.docker.com/onelans/{{ template "chart.name" . }} --version 0.4.4 -f ./rancher-values.yaml
```

`rancher-values.yaml`
```yaml
global:
wildcardDomain: rancher.localhost
deployMongoDb:
enabled: true

botApi:
environment:
tock_default_log_level: "debug"
tock_web_use_default_cors_handler_url : "*"
ingress:
enabled: true


mongodb:
architecture: "replicaset"
auth:
enabled: false
persistence:
enabled: false
size: 1Gi
image:
repository: xavidop/mongodb
tag: 7.0.14

nlpApi:
environment:
tock_env: prod
tock_web_use_default_cors_handler: "true"
tock_web_use_default_cors_handler_url: "*"
tock_web_use_default_cors_handler_with_credentials: "false"
repository:
image: tock/nlp_api
tag: 24.3.4


adminWeb:
ingress:
enabled: true
```

> The values file defines a MongoDB image that is compatible with macOS Arm

## Deployment sample on GKE

```console
$ helm install mytock oci://registry.hub.docker.com/onelans/{{ template "chart.name" . }} --version 0.4.4 -f ./gke-values.yaml
```

`gke-values.yaml`

```yaml
global:
wildcardDomain: gke.mydomain.com
deployMongoDb:
enabled: true

botApi:
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: "gce"
service:
type: NodePort

adminWeb:
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: "gce"
service:
type: NodePort
```

> The values file defines the use of the GCE ingress controller
> You can get the external IP of the ingress controller with the following command
> `kubectl get ingress mytock-admin-web --output yaml`

Binary file added charts/tock/charts/opensearch-2.21.0.tgz
Binary file not shown.
Binary file not shown.
46 changes: 46 additions & 0 deletions charts/tock/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

Congratulations,

Your application tock is now deployed. This may take a while to be up and responding.

Get the Tock Studio URL by running these commands:

{{- if .Values.adminWeb.ingress.enabled }}
http{{ if .Values.adminWeb.ingress.tls }}s{{ end }}://tockstudio-{{ .Release.Name }}.{{ .Values.global.wildcardDomain }}{{ .Values.adminWeb.ingress.path }}
{{- else if contains "NodePort" .Values.adminWeb.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ .Release.Name }}-admin-web)
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.adminWeb.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ .Release.Name }}-admin-web'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ .Release.Name }}-admin-web -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.adminWeb.service.port }}
{{- else if contains "ClusterIP" .Values.adminWeb.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/component=admin-web,app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:8080
{{- end }}


The default login/password is admin@app.com/password.


Bot api can be reach through the following url:

{{- if .Values.botApi.ingress.enabled }}
http{{ if .Values.botApi.ingress.tls }}s{{ end }}://bot-api-{{ .Release.Name }}.{{ .Values.global.wildcardDomain }}{{ .Values.botApi.ingress.path }}
{{- else if contains "NodePort" .Values.botApi.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ .Release.Name }}-bot-api)
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.botApi.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ .Release.Name }}-bot-api'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ .Release.Name }}-bot-api -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.adminWeb.service.port }}
{{- else if contains "ClusterIP" .Values.botApi.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/component=bot-api,app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:8080
{{- end }}
Loading

0 comments on commit 688d7ee

Please sign in to comment.