Scott Davidson commited on
Commit
e4a04a5
·
1 Parent(s): f539fab

Add Helm chart deployment method (#3815)

Browse files

### What problem does this PR solve?

Add's a Helm chart for deploying RAGFlow on Kubernetes.

Closes #864.

### Type of change

- [X] New Feature (non-breaking change which adds functionality)

helm/.helmignore ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Patterns to ignore when building packages.
2
+ # This supports shell glob matching, relative path matching, and
3
+ # negation (prefixed with !). Only one pattern per line.
4
+ .DS_Store
5
+ # Common VCS dirs
6
+ .git/
7
+ .gitignore
8
+ .bzr/
9
+ .bzrignore
10
+ .hg/
11
+ .hgignore
12
+ .svn/
13
+ # Common backup files
14
+ *.swp
15
+ *.bak
16
+ *.tmp
17
+ *.orig
18
+ *~
19
+ # Various IDEs
20
+ .project
21
+ .idea/
22
+ *.tmproj
23
+ .vscode/
helm/Chart.yaml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ apiVersion: v2
2
+ name: ragflow
3
+ description: A Helm chart for deploying RAGFlow on Kubernetes
4
+
5
+ # A chart can be either an 'application' or a 'library' chart.
6
+ #
7
+ # Application charts are a collection of templates that can be packaged into versioned archives
8
+ # to be deployed.
9
+ #
10
+ # Library charts provide useful utilities or functions for the chart developer. They're included as
11
+ # a dependency of application charts to inject those utilities and functions into the rendering
12
+ # pipeline. Library charts do not define any templates and therefore cannot be deployed.
13
+ type: application
14
+
15
+ # This is the chart version. This version number should be incremented each time you make changes
16
+ # to the chart and its templates, including the app version.
17
+ # Versions are expected to follow Semantic Versioning (https://semver.org/)
18
+ version: 0.1.0
19
+
20
+ # This is the version number of the application being deployed. This version number should be
21
+ # incremented each time you make changes to the application. Versions are not expected to
22
+ # follow Semantic Versioning. They should reflect the version the application is using.
23
+ # It is recommended to use it with quotes.
24
+ appVersion: "dev"
helm/templates/_helpers.tpl ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{/*
2
+ Expand the name of the chart.
3
+ */}}
4
+ {{- define "ragflow.name" -}}
5
+ {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6
+ {{- end }}
7
+
8
+ {{/*
9
+ Create a default fully qualified app name.
10
+ We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11
+ If release name contains chart name it will be used as a full name.
12
+ */}}
13
+ {{- define "ragflow.fullname" -}}
14
+ {{- if .Values.fullnameOverride }}
15
+ {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16
+ {{- else }}
17
+ {{- $name := default .Chart.Name .Values.nameOverride }}
18
+ {{- if contains $name .Release.Name }}
19
+ {{- .Release.Name | trunc 63 | trimSuffix "-" }}
20
+ {{- else }}
21
+ {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22
+ {{- end }}
23
+ {{- end }}
24
+ {{- end }}
25
+
26
+ {{/*
27
+ Create chart name and version as used by the chart label.
28
+ */}}
29
+ {{- define "ragflow.chart" -}}
30
+ {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31
+ {{- end }}
32
+
33
+ {{/*
34
+ Common labels
35
+ */}}
36
+ {{- define "ragflow.labels" -}}
37
+ helm.sh/chart: {{ include "ragflow.chart" . }}
38
+ {{ include "ragflow.selectorLabels" . }}
39
+ {{- if .Chart.AppVersion }}
40
+ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41
+ {{- end }}
42
+ app.kubernetes.io/managed-by: {{ .Release.Service }}
43
+ {{- end }}
44
+
45
+ {{/*
46
+ Selector labels
47
+ */}}
48
+ {{- define "ragflow.selectorLabels" -}}
49
+ app.kubernetes.io/name: {{ include "ragflow.name" . }}
50
+ app.kubernetes.io/instance: {{ .Release.Name }}
51
+ {{- end }}
52
+
53
+ {{/*
54
+ Create the name of the service account to use
55
+ */}}
56
+ {{- define "ragflow.serviceAccountName" -}}
57
+ {{- if .Values.serviceAccount.create }}
58
+ {{- default (include "ragflow.fullname" .) .Values.serviceAccount.name }}
59
+ {{- else }}
60
+ {{- default "default" .Values.serviceAccount.name }}
61
+ {{- end }}
62
+ {{- end }}
helm/templates/elasticsearch-config.yaml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- if eq .Values.env.DOC_ENGINE "elasticsearch" -}}
2
+ apiVersion: v1
3
+ kind: ConfigMap
4
+ metadata:
5
+ name: {{ include "ragflow.fullname" . }}-es-config
6
+ data:
7
+ node.name: "es01"
8
+ bootstrap.memory_lock: "false"
9
+ discovery.type: "single-node"
10
+ xpack.security.enabled: "true"
11
+ xpack.security.http.ssl.enabled: "false"
12
+ xpack.security.transport.ssl.enabled: "false"
13
+ {{- end -}}
helm/templates/elasticsearch.yaml ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- if eq .Values.env.DOC_ENGINE "elasticsearch" -}}
2
+ apiVersion: v1
3
+ kind: PersistentVolumeClaim
4
+ metadata:
5
+ name: {{ include "ragflow.fullname" . }}-es-data
6
+ labels:
7
+ {{- include "ragflow.labels" . | nindent 4 }}
8
+ app.kubernetes.io/component: elasticsearch
9
+ spec:
10
+ {{- with .Values.elasticsearch.storage.className }}
11
+ storageClassName: {{ . }}
12
+ {{- end }}
13
+ accessModes:
14
+ - ReadWriteOnce
15
+ resources:
16
+ requests:
17
+ storage: {{ .Values.elasticsearch.storage.capacity }}
18
+ ---
19
+ apiVersion: apps/v1
20
+ kind: Deployment
21
+ metadata:
22
+ name: {{ include "ragflow.fullname" . }}-es
23
+ labels:
24
+ {{- include "ragflow.labels" . | nindent 4 }}
25
+ app.kubernetes.io/component: elasticsearch
26
+ spec:
27
+ replicas: 1
28
+ selector:
29
+ matchLabels:
30
+ {{- include "ragflow.selectorLabels" . | nindent 6 }}
31
+ app.kubernetes.io/component: elasticsearch
32
+ {{- with .Values.elasticsearch.deployment.strategy }}
33
+ strategy:
34
+ {{- . | toYaml | nindent 4 }}
35
+ {{- end }}
36
+ template:
37
+ metadata:
38
+ labels:
39
+ {{- include "ragflow.labels" . | nindent 8 }}
40
+ app.kubernetes.io/component: elasticsearch
41
+ annotations:
42
+ checksum/config-es: {{ include (print $.Template.BasePath "/elasticsearch-config.yaml") . | sha256sum }}
43
+ checksum/config-env: {{ include (print $.Template.BasePath "/env.yaml") . | sha256sum }}
44
+ spec:
45
+ initContainers:
46
+ - name: fix-data-volume-permissions
47
+ image: alpine
48
+ command:
49
+ - sh
50
+ - -c
51
+ - "chown -R 1000:0 /usr/share/elasticsearch/data"
52
+ volumeMounts:
53
+ - mountPath: /usr/share/elasticsearch/data
54
+ name: es-data
55
+ containers:
56
+ - name: elasticsearch
57
+ image: docker.elastic.co/elasticsearch/elasticsearch:{{ .Values.env.STACK_VERSION }}
58
+ envFrom:
59
+ - secretRef:
60
+ name: {{ include "ragflow.fullname" . }}-env-config
61
+ - configMapRef:
62
+ name: {{ include "ragflow.fullname" . }}-es-config
63
+ ports:
64
+ - containerPort: 9200
65
+ name: http
66
+ - containerPort: 9300
67
+ name: transport
68
+ volumeMounts:
69
+ - mountPath: /usr/share/elasticsearch/data
70
+ name: es-data
71
+ {{- with .Values.elasticsearch.deployment.resources }}
72
+ resources:
73
+ {{- . | toYaml | nindent 10 }}
74
+ {{- end }}
75
+ securityContext:
76
+ capabilities:
77
+ add:
78
+ - "IPC_LOCK"
79
+ runAsUser: 1000
80
+ # NOTE: fsGroup doesn't seem to
81
+ # work so use init container instead
82
+ # fsGroup: 1000
83
+ allowPrivilegeEscalation: false
84
+ volumes:
85
+ - name: es-data
86
+ persistentVolumeClaim:
87
+ claimName: {{ include "ragflow.fullname" . }}-es-data
88
+ ---
89
+ apiVersion: v1
90
+ kind: Service
91
+ metadata:
92
+ name: {{ include "ragflow.fullname" . }}-es
93
+ labels:
94
+ {{- include "ragflow.labels" . | nindent 4 }}
95
+ app.kubernetes.io/component: elasticsearch
96
+ spec:
97
+ selector:
98
+ {{- include "ragflow.selectorLabels" . | nindent 4 }}
99
+ app.kubernetes.io/component: elasticsearch
100
+ ports:
101
+ - protocol: TCP
102
+ port: 9200
103
+ targetPort: http
104
+ type: {{ .Values.elasticsearch.service.type }}
105
+ {{- end -}}
helm/templates/env.yaml ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- /*
2
+ TODO: Split env vars into separate secrets so that each pod
3
+ only gets passed the secrets it really needs.
4
+ */}}
5
+ apiVersion: v1
6
+ kind: Secret
7
+ metadata:
8
+ name: {{ include "ragflow.fullname" . }}-env-config
9
+ type: Opaque
10
+ stringData:
11
+ {{- range $key, $val := .Values.env }}
12
+ {{- if $val }}
13
+ {{ $key }}: {{ quote $val }}
14
+ {{- end }}
15
+ {{- end }}
16
+ {{- /*
17
+ Use host names derived from internal cluster DNS
18
+ */}}
19
+ REDIS_HOST: {{ printf "%s-redis.%s.svc" (include "ragflow.fullname" .) .Release.Namespace }}
20
+ MYSQL_HOST: {{ printf "%s-mysql.%s.svc" (include "ragflow.fullname" .) .Release.Namespace }}
21
+ MINIO_HOST: {{ printf "%s-minio.%s.svc" (include "ragflow.fullname" .) .Release.Namespace }}
22
+ {{- /*
23
+ Fail if passwords are not provided in release values
24
+ */}}
25
+ REDIS_PASSWORD: {{ .Values.env.REDIS_PASSWORD | required "REDIS_PASSWORD is required" }}
26
+ {{- /*
27
+ NOTE: MySQL uses MYSQL_ROOT_PASSWORD env var but Ragflow container expects
28
+ MYSQL_PASSWORD so we need to define both as the same value here.
29
+ */}}
30
+ {{- with .Values.env.MYSQL_PASSWORD | required "MYSQL_PASSWORD is required" }}
31
+ MYSQL_PASSWORD: {{ . }}
32
+ MYSQL_ROOT_PASSWORD: {{ . }}
33
+ {{- end }}
34
+ {{- with .Values.env.MINIO_PASSWORD | required "MINIO_PASSWORD is required" }}
35
+ MINIO_PASSWORD: {{ . }}
36
+ MINIO_ROOT_PASSWORD: {{ . }}
37
+ {{- end }}
38
+ {{- /*
39
+ Only provide env vars for enabled doc engine
40
+ */}}
41
+ {{- if eq .Values.env.DOC_ENGINE "elasticsearch" }}
42
+ ES_HOST: {{ printf "%s-es.%s.svc" (include "ragflow.fullname" .) .Release.Namespace }}
43
+ ELASTIC_PASSWORD: {{ .Values.env.ELASTIC_PASSWORD | required "ELASTIC_PASSWORD is required" }}
44
+ {{- else if eq .Values.env.DOC_ENGINE "infinity" }}
45
+ INFINITY_HOST: {{ printf "%s-infinity.%s.svc" (include "ragflow.fullname" .) .Release.Namespace }}
46
+ {{- else }}
47
+ {{ fail "env.DOC_ENGINE must be either 'elasticsearch' or 'infinity'" }}
48
+ {{- end }}
helm/templates/infinity.yaml ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- if eq .Values.env.DOC_ENGINE "infinity" -}}
2
+ apiVersion: v1
3
+ kind: PersistentVolumeClaim
4
+ metadata:
5
+ name: {{ include "ragflow.fullname" . }}-infinity
6
+ labels:
7
+ {{- include "ragflow.labels" . | nindent 4 }}
8
+ app.kubernetes.io/component: infinity
9
+ spec:
10
+ {{- with .Values.infinity.storage.className }}
11
+ storageClassName: {{ . }}
12
+ {{- end }}
13
+ accessModes:
14
+ - ReadWriteOnce
15
+ resources:
16
+ requests:
17
+ storage: {{ .Values.infinity.storage.capacity }}
18
+ ---
19
+ apiVersion: apps/v1
20
+ kind: Deployment
21
+ metadata:
22
+ name: {{ include "ragflow.fullname" . }}-infinity
23
+ labels:
24
+ {{- include "ragflow.labels" . | nindent 4 }}
25
+ app.kubernetes.io/component: infinity
26
+ spec:
27
+ replicas: 1
28
+ selector:
29
+ matchLabels:
30
+ {{- include "ragflow.selectorLabels" . | nindent 6 }}
31
+ app.kubernetes.io/component: infinity
32
+ {{- with .Values.infinity.deployment.strategy }}
33
+ strategy:
34
+ {{- . | toYaml | nindent 4 }}
35
+ {{- end }}
36
+ template:
37
+ metadata:
38
+ labels:
39
+ {{- include "ragflow.labels" . | nindent 8 }}
40
+ app.kubernetes.io/component: infinity
41
+ annotations:
42
+ checksum/config: {{ include (print $.Template.BasePath "/env.yaml") . | sha256sum }}
43
+ spec:
44
+ containers:
45
+ - name: infinity
46
+ image: {{ .Values.infinity.image.repository }}:{{ .Values.infinity.image.tag }}
47
+ envFrom:
48
+ - secretRef:
49
+ name: {{ include "ragflow.fullname" . }}-env-config
50
+ ports:
51
+ - containerPort: 23817
52
+ name: thrift
53
+ - containerPort: 23820
54
+ name: http
55
+ - containerPort: 5432
56
+ name: psql
57
+ volumeMounts:
58
+ - mountPath: /var/infinity
59
+ name: infinity-data
60
+ {{- with .Values.infinity.deployment.resources }}
61
+ resources:
62
+ {{- . | toYaml | nindent 10 }}
63
+ {{- end }}
64
+ securityContext:
65
+ capabilities:
66
+ add:
67
+ - "NET_BIND_SERVICE"
68
+ seccompProfile:
69
+ type: RuntimeDefault
70
+ livenessProbe:
71
+ httpGet:
72
+ path: /admin/node/current
73
+ port: 23820
74
+ initialDelaySeconds: 60
75
+ periodSeconds: 10
76
+ timeoutSeconds: 10
77
+ failureThreshold: 120
78
+ volumes:
79
+ - name: infinity-data
80
+ persistentVolumeClaim:
81
+ claimName: {{ include "ragflow.fullname" . }}-infinity
82
+ ---
83
+ apiVersion: v1
84
+ kind: Service
85
+ metadata:
86
+ name: {{ include "ragflow.fullname" . }}-infinity
87
+ labels:
88
+ {{- include "ragflow.labels" . | nindent 4 }}
89
+ app.kubernetes.io/component: infinity
90
+ spec:
91
+ selector:
92
+ {{- include "ragflow.selectorLabels" . | nindent 6 }}
93
+ app.kubernetes.io/component: infinity
94
+ ports:
95
+ - protocol: TCP
96
+ port: 23817
97
+ targetPort: thrift
98
+ name: thrift
99
+ - protocol: TCP
100
+ port: 23820
101
+ targetPort: http
102
+ name: http
103
+ - protocol: TCP
104
+ port: 5432
105
+ targetPort: psql
106
+ name: psql
107
+ type: {{ .Values.infinity.service.type }}
108
+ {{- end -}}
helm/templates/ingress.yaml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- if .Values.ingress.enabled -}}
2
+ apiVersion: networking.k8s.io/v1
3
+ kind: Ingress
4
+ metadata:
5
+ name: {{ include "ragflow.fullname" . }}
6
+ labels:
7
+ {{- include "ragflow.labels" . | nindent 4 }}
8
+ {{- with .Values.ingress.annotations }}
9
+ annotations:
10
+ {{- toYaml . | nindent 4 }}
11
+ {{- end }}
12
+ spec:
13
+ {{- with .Values.ingress.className }}
14
+ ingressClassName: {{ . }}
15
+ {{- end }}
16
+ {{- if .Values.ingress.tls }}
17
+ tls:
18
+ {{- range .Values.ingress.tls }}
19
+ - hosts:
20
+ {{- range .hosts }}
21
+ - {{ . | quote }}
22
+ {{- end }}
23
+ secretName: {{ .secretName }}
24
+ {{- end }}
25
+ {{- end }}
26
+ rules:
27
+ {{- range .Values.ingress.hosts }}
28
+ - host: {{ .host | quote }}
29
+ http:
30
+ paths:
31
+ {{- range .paths }}
32
+ - path: {{ .path }}
33
+ {{- with .pathType }}
34
+ pathType: {{ . }}
35
+ {{- end }}
36
+ backend:
37
+ service:
38
+ name: {{ include "ragflow.fullname" $ }}
39
+ port:
40
+ name: http
41
+ {{- end }}
42
+ {{- end }}
43
+ {{- end }}
helm/templates/minio.yaml ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ apiVersion: v1
3
+ kind: PersistentVolumeClaim
4
+ metadata:
5
+ name: {{ include "ragflow.fullname" . }}-minio
6
+ labels:
7
+ {{- include "ragflow.labels" . | nindent 4 }}
8
+ app.kubernetes.io/component: minio
9
+ spec:
10
+ {{- with .Values.minio.storage.className }}
11
+ storageClassName: {{ . }}
12
+ {{- end }}
13
+ accessModes:
14
+ - ReadWriteOnce
15
+ resources:
16
+ requests:
17
+ storage: {{ .Values.minio.storage.capacity }}
18
+ ---
19
+ apiVersion: apps/v1
20
+ kind: Deployment
21
+ metadata:
22
+ name: ragflow-minio-deployment
23
+ labels:
24
+ {{- include "ragflow.labels" . | nindent 4 }}
25
+ app.kubernetes.io/component: minio
26
+ annotations:
27
+ checksum/config: {{ include (print $.Template.BasePath "/env.yaml") . | sha256sum }}
28
+ spec:
29
+ replicas: 1
30
+ selector:
31
+ matchLabels:
32
+ {{- include "ragflow.selectorLabels" . | nindent 6 }}
33
+ app.kubernetes.io/component: minio
34
+ {{- with .Values.minio.deployment.strategy }}
35
+ strategy:
36
+ {{- . | toYaml | nindent 4 }}
37
+ {{- end }}
38
+ template:
39
+ metadata:
40
+ labels:
41
+ {{- include "ragflow.labels" . | nindent 8 }}
42
+ app.kubernetes.io/component: minio
43
+ spec:
44
+ containers:
45
+ - name: minio
46
+ image: {{ .Values.minio.image.repository }}:{{ .Values.minio.image.tag }}
47
+ envFrom:
48
+ - secretRef:
49
+ name: {{ include "ragflow.fullname" . }}-env-config
50
+ args:
51
+ - server
52
+ - "--console-address=:9001"
53
+ - "/data"
54
+ ports:
55
+ - containerPort: 9000
56
+ name: s3
57
+ - containerPort: 9001
58
+ name: console
59
+ {{- with .Values.minio.deployment.resources }}
60
+ resources:
61
+ {{- . | toYaml | nindent 10 }}
62
+ {{- end }}
63
+ volumeMounts:
64
+ - mountPath: /data
65
+ name: minio-data
66
+ volumes:
67
+ - name: minio-data
68
+ persistentVolumeClaim:
69
+ claimName: {{ include "ragflow.fullname" . }}-minio
70
+ ---
71
+ apiVersion: v1
72
+ kind: Service
73
+ metadata:
74
+ name: {{ include "ragflow.fullname" . }}-minio
75
+ labels:
76
+ {{- include "ragflow.labels" . | nindent 4 }}
77
+ app.kubernetes.io/component: minio
78
+ spec:
79
+ selector:
80
+ {{- include "ragflow.selectorLabels" . | nindent 4 }}
81
+ app.kubernetes.io/component: minio
82
+ ports:
83
+ - name: s3
84
+ protocol: TCP
85
+ port: 9000
86
+ targetPort: s3
87
+ - name: console
88
+ protocol: TCP
89
+ port: 9001
90
+ targetPort: console
91
+ type: {{ .Values.minio.service.type }}
helm/templates/mysql-config.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ apiVersion: v1
3
+ kind: ConfigMap
4
+ metadata:
5
+ name: mysql-init-script
6
+ data:
7
+ init.sql: |-
8
+ CREATE DATABASE IF NOT EXISTS rag_flow;
9
+ USE rag_flow;
helm/templates/mysql.yaml ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ apiVersion: v1
3
+ kind: PersistentVolumeClaim
4
+ metadata:
5
+ name: {{ include "ragflow.fullname" . }}-mysql
6
+ labels:
7
+ {{- include "ragflow.labels" . | nindent 4 }}
8
+ app.kubernetes.io/component: mysql
9
+ spec:
10
+ {{- with .Values.mysql.storage.className }}
11
+ storageClassName: {{ . }}
12
+ {{- end }}
13
+ accessModes:
14
+ - ReadWriteOnce
15
+ resources:
16
+ requests:
17
+ storage: {{ .Values.mysql.storage.capacity }}
18
+ ---
19
+ apiVersion: apps/v1
20
+ kind: Deployment
21
+ metadata:
22
+ name: {{ include "ragflow.fullname" . }}-mysql
23
+ labels:
24
+ {{- include "ragflow.labels" . | nindent 4 }}
25
+ app.kubernetes.io/component: mysql
26
+ spec:
27
+ replicas: 1
28
+ selector:
29
+ matchLabels:
30
+ {{- include "ragflow.selectorLabels" . | nindent 6 }}
31
+ app.kubernetes.io/component: mysql
32
+ {{- with .Values.mysql.deployment.strategy }}
33
+ strategy:
34
+ {{- . | toYaml | nindent 4 }}
35
+ {{- end }}
36
+ template:
37
+ metadata:
38
+ labels:
39
+ {{- include "ragflow.labels" . | nindent 8 }}
40
+ app.kubernetes.io/component: mysql
41
+ annotations:
42
+ checksum/config-mysql: {{ include (print $.Template.BasePath "/mysql-config.yaml") . | sha256sum }}
43
+ checksum/config-env: {{ include (print $.Template.BasePath "/env.yaml") . | sha256sum }}
44
+ spec:
45
+ containers:
46
+ - name: mysql
47
+ image: {{ .Values.mysql.image.repository }}:{{ .Values.mysql.image.tag }}
48
+ envFrom:
49
+ - secretRef:
50
+ name: {{ include "ragflow.fullname" . }}-env-config
51
+ args:
52
+ - --max_connections=1000
53
+ - --character-set-server=utf8mb4
54
+ - --collation-server=utf8mb4_general_ci
55
+ - --default-authentication-plugin=mysql_native_password
56
+ - --tls_version=TLSv1.2,TLSv1.3
57
+ - --init-file=/data/application/init.sql
58
+ ports:
59
+ - containerPort: 3306
60
+ name: mysql
61
+ {{- with .Values.mysql.deployment.resources }}
62
+ resources:
63
+ {{- . | toYaml | nindent 10 }}
64
+ {{- end }}
65
+ volumeMounts:
66
+ - mountPath: /var/lib/mysql
67
+ name: mysql-data
68
+ - mountPath: /data/application/init.sql
69
+ subPath: init.sql
70
+ readOnly: true
71
+ name: init-script-volume
72
+ volumes:
73
+ - name: mysql-data
74
+ persistentVolumeClaim:
75
+ claimName: {{ include "ragflow.fullname" . }}-mysql
76
+ - name: init-script-volume
77
+ configMap:
78
+ name: mysql-init-script
79
+ ---
80
+ apiVersion: v1
81
+ kind: Service
82
+ metadata:
83
+ name: {{ include "ragflow.fullname" . }}-mysql
84
+ labels:
85
+ {{- include "ragflow.labels" . | nindent 4 }}
86
+ app.kubernetes.io/component: mysql
87
+ spec:
88
+ selector:
89
+ {{- include "ragflow.selectorLabels" . | nindent 4 }}
90
+ app.kubernetes.io/component: mysql
91
+ ports:
92
+ - protocol: TCP
93
+ port: 3306
94
+ targetPort: mysql
95
+ type: {{ .Values.mysql.service.type }}
helm/templates/ragflow.yaml ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ apiVersion: apps/v1
3
+ kind: Deployment
4
+ metadata:
5
+ name: {{ include "ragflow.fullname" . }}
6
+ labels:
7
+ {{- include "ragflow.labels" . | nindent 4 }}
8
+ app.kubernetes.io/component: ragflow
9
+ spec:
10
+ replicas: 1
11
+ selector:
12
+ matchLabels:
13
+ {{- include "ragflow.selectorLabels" . | nindent 6 }}
14
+ app.kubernetes.io/component: ragflow
15
+ {{- with .Values.ragflow.deployment.strategy }}
16
+ strategy:
17
+ {{- . | toYaml | nindent 4 }}
18
+ {{- end }}
19
+ template:
20
+ metadata:
21
+ labels:
22
+ {{- include "ragflow.labels" . | nindent 8 }}
23
+ app.kubernetes.io/component: ragflow
24
+ annotations:
25
+ checksum/config-env: {{ include (print $.Template.BasePath "/env.yaml") . | sha256sum }}
26
+ checksum/config-ragflow: {{ include (print $.Template.BasePath "/ragflow_config.yaml") . | sha256sum }}
27
+ spec:
28
+ containers:
29
+ - name: ragflow
30
+ image: {{ .Values.env.RAGFLOW_IMAGE }}
31
+ ports:
32
+ - containerPort: 80
33
+ name: http
34
+ volumeMounts:
35
+ - mountPath: /etc/nginx/conf.d/ragflow.conf
36
+ subPath: ragflow.conf
37
+ name: nginx-config-volume
38
+ - mountPath: /etc/nginx/proxy.conf
39
+ subPath: proxy.conf
40
+ name: nginx-config-volume
41
+ - mountPath: /etc/nginx/nginx.conf
42
+ subPath: nginx.conf
43
+ name: nginx-config-volume
44
+ envFrom:
45
+ - secretRef:
46
+ name: {{ include "ragflow.fullname" . }}-env-config
47
+ {{- with .Values.ragflow.deployment.resources }}
48
+ resources:
49
+ {{- . | toYaml | nindent 10 }}
50
+ {{- end }}
51
+ volumes:
52
+ - name: nginx-config-volume
53
+ configMap:
54
+ name: nginx-config
55
+ ---
56
+ apiVersion: v1
57
+ kind: Service
58
+ metadata:
59
+ name: {{ include "ragflow.fullname" . }}
60
+ labels:
61
+ {{- include "ragflow.labels" . | nindent 4 }}
62
+ app.kubernetes.io/component: ragflow
63
+ spec:
64
+ selector:
65
+ {{- include "ragflow.selectorLabels" . | nindent 4 }}
66
+ app.kubernetes.io/component: ragflow
67
+ ports:
68
+ - protocol: TCP
69
+ port: 80
70
+ targetPort: http
71
+ name: http
72
+ type: {{ .Values.ragflow.service.type }}
helm/templates/ragflow_config.yaml ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ apiVersion: v1
3
+ kind: ConfigMap
4
+ metadata:
5
+ name: nginx-config
6
+ data:
7
+ ragflow.conf: |
8
+ server {
9
+ listen 80;
10
+ server_name _;
11
+ root /ragflow/web/dist;
12
+
13
+ gzip on;
14
+ gzip_min_length 1k;
15
+ gzip_comp_level 9;
16
+ gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
17
+ gzip_vary on;
18
+ gzip_disable "MSIE [1-6]\.";
19
+
20
+ location ~ ^/(v1|api) {
21
+ proxy_pass http://localhost:9380;
22
+ include proxy.conf;
23
+ }
24
+
25
+ location / {
26
+ index index.html;
27
+ try_files $uri $uri/ /index.html;
28
+ }
29
+
30
+ # Cache-Control: max-age~@~AExpires
31
+ location ~ ^/static/(css|js|media)/ {
32
+ expires 10y;
33
+ access_log off;
34
+ }
35
+ }
36
+ proxy.conf: |
37
+ proxy_set_header Host $host;
38
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
39
+ proxy_set_header X-Forwarded-Proto $scheme;
40
+ proxy_http_version 1.1;
41
+ proxy_set_header Connection "";
42
+ proxy_buffering off;
43
+ proxy_read_timeout 3600s;
44
+ proxy_send_timeout 3600s;
45
+ nginx.conf: |
46
+ user root;
47
+ worker_processes auto;
48
+
49
+ error_log /var/log/nginx/error.log notice;
50
+ pid /var/run/nginx.pid;
51
+
52
+ events {
53
+ worker_connections 1024;
54
+ }
55
+
56
+ http {
57
+ include /etc/nginx/mime.types;
58
+ default_type application/octet-stream;
59
+
60
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
61
+ '$status $body_bytes_sent "$http_referer" '
62
+ '"$http_user_agent" "$http_x_forwarded_for"';
63
+
64
+ access_log /var/log/nginx/access.log main;
65
+
66
+ sendfile on;
67
+ #tcp_nopush on;
68
+
69
+ keepalive_timeout 65;
70
+
71
+ #gzip on;
72
+ client_max_body_size 128M;
73
+
74
+ include /etc/nginx/conf.d/ragflow.conf;
75
+ }
helm/templates/redis.yaml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ apiVersion: v1
3
+ kind: PersistentVolumeClaim
4
+ metadata:
5
+ name: {{ include "ragflow.fullname" . }}-redis
6
+ labels:
7
+ {{- include "ragflow.labels" . | nindent 4 }}
8
+ app.kubernetes.io/component: redis
9
+ spec:
10
+ accessModes:
11
+ - ReadWriteOnce
12
+ resources:
13
+ requests:
14
+ storage: 8Gi
15
+ ---
16
+ apiVersion: apps/v1
17
+ kind: Deployment
18
+ metadata:
19
+ name: {{ include "ragflow.fullname" . }}-redis
20
+ labels:
21
+ {{- include "ragflow.labels" . | nindent 4 }}
22
+ app.kubernetes.io/component: redis
23
+ spec:
24
+ replicas: 1
25
+ selector:
26
+ matchLabels:
27
+ {{- include "ragflow.selectorLabels" . | nindent 6 }}
28
+ app.kubernetes.io/component: redis
29
+ {{- with .Values.redis.deployment.strategy }}
30
+ strategy:
31
+ {{- . | toYaml | nindent 4 }}
32
+ {{- end }}
33
+ template:
34
+ metadata:
35
+ labels:
36
+ {{- include "ragflow.labels" . | nindent 8 }}
37
+ app.kubernetes.io/component: redis
38
+ annotations:
39
+ checksum/config-env: {{ include (print $.Template.BasePath "/env.yaml") . | sha256sum }}
40
+ spec:
41
+ containers:
42
+ - name: redis
43
+ image: {{ .Values.redis.image.repository }}:{{ .Values.redis.image.tag }}
44
+ command:
45
+ - "sh"
46
+ - "-c"
47
+ - "exec redis-server --requirepass ${REDIS_PASSWORD} --maxmemory 128mb --maxmemory-policy allkeys-lru"
48
+ envFrom:
49
+ - secretRef:
50
+ name: {{ include "ragflow.fullname" . }}-env-config
51
+ ports:
52
+ - containerPort: 6379
53
+ name: redis
54
+ {{- with .Values.redis.deployment.resources }}
55
+ resources:
56
+ {{- . | toYaml | nindent 10 }}
57
+ {{- end }}
58
+ volumeMounts:
59
+ - mountPath: /data
60
+ name: redis-data
61
+ volumes:
62
+ - name: redis-data
63
+ persistentVolumeClaim:
64
+ claimName: {{ include "ragflow.fullname" . }}-redis
65
+ ---
66
+ apiVersion: v1
67
+ kind: Service
68
+ metadata:
69
+ name: {{ include "ragflow.fullname" . }}-redis
70
+ labels:
71
+ {{- include "ragflow.labels" . | nindent 4 }}
72
+ app.kubernetes.io/component: redis
73
+ spec:
74
+ selector:
75
+ {{- include "ragflow.selectorLabels" . | nindent 4 }}
76
+ app.kubernetes.io/component: redis
77
+ ports:
78
+ - protocol: TCP
79
+ port: 6379
80
+ targetPort: redis
81
+ type: {{ .Values.redis.service.type }}
helm/templates/tests/test-connection.yaml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ apiVersion: v1
2
+ kind: Pod
3
+ metadata:
4
+ name: "{{ include "ragflow.fullname" . }}-test-connection"
5
+ labels:
6
+ {{- include "ragflow.labels" . | nindent 4 }}
7
+ annotations:
8
+ "helm.sh/hook": test
9
+ spec:
10
+ containers:
11
+ - name: wget
12
+ image: busybox
13
+ command:
14
+ - 'wget'
15
+ args:
16
+ - {{ printf "%s.%s.svc" (include "ragflow.fullname" .) .Release.Namespace }}
17
+ restartPolicy: Never
helm/values.yaml ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Based on docker compose .env file
2
+ env:
3
+ # The type of doc engine to use.
4
+ # Available options:
5
+ # - `elasticsearch` (default)
6
+ # - `infinity` (https://github.com/infiniflow/infinity)
7
+ # DOC_ENGINE: elasticsearch
8
+ DOC_ENGINE: infinity
9
+
10
+ # The version of Elasticsearch.
11
+ STACK_VERSION: "8.11.3"
12
+
13
+ # The password for Elasticsearch
14
+ ELASTIC_PASSWORD: infini_rag_flow_helm
15
+
16
+ # The password for MySQL
17
+ MYSQL_PASSWORD: infini_rag_flow_helm
18
+ # The database of the MySQL service to use
19
+ MYSQL_DBNAME: rag_flow
20
+
21
+ # The username for MinIO.
22
+ MINIO_ROOT_USER: rag_flow
23
+ # The password for MinIO
24
+ MINIO_PASSWORD: infini_rag_flow_helm
25
+
26
+ # The password for Redis
27
+ REDIS_PASSWORD: infini_rag_flow_helm
28
+
29
+ # The RAGFlow Docker image to download.
30
+ # Defaults to the dev-slim edition, which is the RAGFlow Docker image without embedding models.
31
+ RAGFLOW_IMAGE: infiniflow/ragflow:dev-slim
32
+ #
33
+ # To download the RAGFlow Docker image with embedding models, uncomment the following line instead:
34
+ # RAGFLOW_IMAGE=infiniflow/ragflow:dev
35
+ #
36
+ # The Docker image of the dev edition includes:
37
+ # - Built-in embedding models:
38
+ # - BAAI/bge-large-zh-v1.5
39
+ # - BAAI/bge-reranker-v2-m3
40
+ # - maidalun1020/bce-embedding-base_v1
41
+ # - maidalun1020/bce-reranker-base_v1
42
+ # - Embedding models that will be downloaded once you select them in the RAGFlow UI:
43
+ # - BAAI/bge-base-en-v1.5
44
+ # - BAAI/bge-large-en-v1.5
45
+ # - BAAI/bge-small-en-v1.5
46
+ # - BAAI/bge-small-zh-v1.5
47
+ # - jinaai/jina-embeddings-v2-base-en
48
+ # - jinaai/jina-embeddings-v2-small-en
49
+ # - nomic-ai/nomic-embed-text-v1.5
50
+ # - sentence-transformers/all-MiniLM-L6-v2
51
+ #
52
+ #
53
+
54
+ # The local time zone.
55
+ TIMEZONE: "Asia/Shanghai"
56
+
57
+ # Uncomment the following line if you have limited access to huggingface.co:
58
+ # HF_ENDPOINT: https://hf-mirror.com
59
+
60
+ # The maximum file size for each uploaded file, in bytes.
61
+ # You can uncomment this line and update the value if you wish to change 128M file size limit
62
+ # MAX_CONTENT_LENGTH: "134217728"
63
+
64
+ ragflow:
65
+ deployment:
66
+ strategy:
67
+ resources:
68
+ service:
69
+ # Use LoadBalancer to expose the web interface externally
70
+ type: ClusterIP
71
+
72
+ infinity:
73
+ image:
74
+ repository: infiniflow/infinity
75
+ tag: v0.5.0-dev5
76
+ storage:
77
+ className:
78
+ capacity: 5Gi
79
+ deployment:
80
+ strategy:
81
+ resources:
82
+ service:
83
+ type: ClusterIP
84
+
85
+ elasticsearch:
86
+ storage:
87
+ className:
88
+ capacity: 20Gi
89
+ deployment:
90
+ strategy:
91
+ resources:
92
+ requests:
93
+ memory: 8Gi
94
+ service:
95
+ type: ClusterIP
96
+
97
+ minio:
98
+ image:
99
+ repository: quay.io/minio/minio
100
+ tag: RELEASE.2023-12-20T01-00-02Z
101
+ storage:
102
+ className:
103
+ capacity: 5Gi
104
+ deployment:
105
+ strategy:
106
+ resources:
107
+ service:
108
+ type: ClusterIP
109
+
110
+ mysql:
111
+ image:
112
+ repository: mysql
113
+ tag: 8.0.39
114
+ storage:
115
+ className:
116
+ capacity: 5Gi
117
+ deployment:
118
+ strategy:
119
+ resources:
120
+ service:
121
+ type: ClusterIP
122
+
123
+ redis:
124
+ image:
125
+ repository: valkey/valkey
126
+ tag: 8
127
+ storage:
128
+ className:
129
+ capacity: 5Gi
130
+ deployment:
131
+ strategy:
132
+ resources:
133
+ service:
134
+ type: ClusterIP
135
+
136
+
137
+ # This block is for setting up web service ingress. For more information, see:
138
+ # https://kubernetes.io/docs/concepts/services-networking/ingress/
139
+ ingress:
140
+ enabled: false
141
+ className: ""
142
+ annotations: {}
143
+ # kubernetes.io/ingress.class: nginx
144
+ # kubernetes.io/tls-acme: "true"
145
+ hosts:
146
+ - host: chart-example.local
147
+ paths:
148
+ - path: /
149
+ pathType: ImplementationSpecific
150
+ tls: []
151
+ # - secretName: chart-example-tls
152
+ # hosts:
153
+ # - chart-example.local