Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions incubator/tke-dify/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v1
appVersion: "1.0.0"
appVersion: "1.0.1"
description: Helm chart for deploying dify resources on TKE.
icon: https://cloudcache.tencent-cloud.com/qcloud/ui/static/Industry_tke/1cb1fab9-bc6e-49fc-94d8-d8edfe36b822.png
keywords:
Expand All @@ -12,4 +12,4 @@ maintainers:
email: [email protected]

name: tke-dify
version: 1.1.3
version: 1.5.0
7 changes: 0 additions & 7 deletions incubator/tke-dify/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,6 @@ Create chart name and version as used by the chart label.
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Namespace
*/}}
{{- define "dify.namespace" -}}
{{ .Release.Namespace }}
{{- end -}}

{{/*
Common labels
*/}}
Expand Down
1 change: 0 additions & 1 deletion incubator/tke-dify/templates/api-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "dify.api.fullname" . }}
namespace: {{ include "dify.namespace" . }}
data:
{{- include "dify.api.config" . | nindent 2 }}
13 changes: 9 additions & 4 deletions incubator/tke-dify/templates/api-deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if and .Values.api.enabled}}
{{- $usePvc := not (or .Values.externalS3.enabled .Values.externalAzureBlobStorage.enabled .Values.externalGCS.enabled .Values.externalCOS.enabled) -}}
{{- $usePvc := not (or .Values.externalS3.enabled .Values.externalAzureBlobStorage.enabled .Values.externalGCS.enabled .Values.externalCOS.enabled .Values.externalOBS.enabled) -}}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -12,7 +12,6 @@ metadata:
# app: {{ template "dify.api.fullname" . }}
{{ include "dify.ud.labels" . | indent 4 }}
name: {{ template "dify.api.fullname" . }}
namespace: {{ template "dify.namespace" . }}
spec:
replicas: {{ .Values.api.replicas }}
selector:
Expand All @@ -22,8 +21,11 @@ spec:
{{/*
# Required labels for istio
# app: {{ template "dify.api.fullname" . }}
# version: {{ (print "v" .Values.serviceMesh.version) | quote }}
# version: {{ .Values.istioServiceMesh.version | quote }}
*/}}
{{- if .Values.api.updateStrategy }}
strategy: {{- toYaml .Values.api.updateStrategy | nindent 4 }}
{{- end }}
template:
metadata:
annotations:
Expand All @@ -36,11 +38,14 @@ spec:
{{/*
# Required labels for istio
# app: {{ template "dify.api.fullname" . }}
# version: {{ (print "v" .Values.serviceMesh.version) | quote }}
# version: {{ .Values.istioServiceMesh.version | quote }}
*/}}
{{ include "dify.ud.labels" . | indent 8 }}
spec:
serviceAccountName: {{ include "dify.api.serviceAccountName" . }}
{{- if .Values.api.priorityClassName }}
priorityClassName: {{ .Values.api.priorityClassName | quote }}
{{- end }}
{{- if eq .Release.Name "dify"}}
{{/*
Disable service environment variables,
Expand Down
1 change: 0 additions & 1 deletion incubator/tke-dify/templates/api-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ template "dify.api.fullname" . }}
namespace: {{ include "dify.namespace" . }}
type: Opaque
data:
{{- include "dify.api.credentials" . | nindent 2 }}
1 change: 0 additions & 1 deletion incubator/tke-dify/templates/api-service-account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "dify.api.serviceAccountName" . }}
namespace: {{ include "dify.namespace" . }}
labels: {{- include "dify.labels" . | nindent 4 }}
component: api
{{- if or .Values.api.serviceAccount.annotations (include "dify.ud.annotations" .) }}
Expand Down
1 change: 0 additions & 1 deletion incubator/tke-dify/templates/api-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "dify.api.fullname" . }}
namespace: {{ include "dify.namespace" . }}
labels:
{{ include "dify.labels" . | indent 4 }}
{{- if .Values.api.service.labels }}
Expand Down
123 changes: 92 additions & 31 deletions incubator/tke-dify/templates/config.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Startup mode, 'api' starts the API server.
MODE: api
# The log level for the application. Supported values are `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`
LOG_LEVEL: {{ .Values.api.logLevel }}
LOG_LEVEL: {{ .Values.api.logLevel | quote }}
# A secret key that is used for securely signing the session cookie and encrypting sensitive information on the database. You can generate a strong key using `openssl rand -base64 42`.
# SECRET_KEY: {{ .Values.api.secretKey }}
# The base URL of console application web frontend, refers to the Console base URL of WEB service if console domain is
Expand Down Expand Up @@ -136,19 +136,19 @@ MARKETPLACE_URL: {{ .Values.api.url.marketplace | quote }}

{{- define "dify.db.config" -}}
{{- if .Values.externalPostgres.enabled }}
# DB_USERNAME: {{ .Values.externalPostgres.username }}
# DB_PASSWORD: {{ .Values.externalPostgres.password }}
# DB_USERNAME: {{ .Values.externalPostgres.username | quote }}
# DB_PASSWORD: {{ .Values.externalPostgres.password | quote }}
DB_HOST: {{ .Values.externalPostgres.address }}
DB_PORT: {{ .Values.externalPostgres.port | toString | quote }}
DB_DATABASE: {{ .Values.externalPostgres.database.api | quote }}
{{- else if .Values.postgresql.enabled }}
{{ with .Values.postgresql.global.postgresql.auth }}
{{- if empty .username }}
# DB_USERNAME: postgres
# DB_PASSWORD: {{ .postgresPassword }}
# DB_PASSWORD: {{ .postgresPassword | quote }}
{{- else }}
# DB_USERNAME: {{ .username }}
# DB_PASSWORD: {{ .password }}
# DB_USERNAME: {{ .username | quote }}
# DB_PASSWORD: {{ .password | quote }}
{{- end }}
{{- end }}
{{- if eq .Values.postgresql.architecture "replication" }}
Expand All @@ -163,46 +163,59 @@ DB_DATABASE: {{ .Values.postgresql.global.postgresql.auth.database }}

{{- define "dify.storage.config" -}}
{{- if .Values.externalS3.enabled }}
# The type of storage to use for storing user files. Supported values are `local`, `s3`, `azure-blob`, `tencent-cos` and `google-storage`, Default: `local`
# The type of storage to use for storing user files. Supported values are `local`, `s3`, `azure-blob`, `aliyun-oss` and `google-storage`, Default: `local`
STORAGE_TYPE: s3
# The S3 storage configurations, only available when STORAGE_TYPE is `s3`.
S3_ENDPOINT: {{ .Values.externalS3.endpoint }}
S3_BUCKET_NAME: {{ .Values.externalS3.bucketName }}
# S3_ACCESS_KEY: {{ .Values.externalS3.accessKey }}
# S3_SECRET_KEY: {{ .Values.externalS3.secretKey }}
S3_REGION: {{ .Values.externalS3.region }}
S3_ENDPOINT: {{ .Values.externalS3.endpoint | quote }}
S3_BUCKET_NAME: {{ .Values.externalS3.bucketName.api | quote }}
# S3_ACCESS_KEY: {{ .Values.externalS3.accessKey | quote }}
# S3_SECRET_KEY: {{ .Values.externalS3.secretKey | quote }}
S3_REGION: {{ .Values.externalS3.region | quote }}
{{- else if .Values.externalAzureBlobStorage.enabled }}
# The type of storage to use for storing user files. Supported values are `local`, `s3`, `azure-blob`, `tencent-cos` and `google-storage`, Default: `local`
# The type of storage to use for storing user files. Supported values are `local`, `s3`, `azure-blob`, `aliyun-oss` and `google-storage`, Default: `local`
STORAGE_TYPE: azure-blob
# The Azure Blob storage configurations, only available when STORAGE_TYPE is `azure-blob`.
AZURE_BLOB_ACCOUNT_NAME: {{ .Values.externalAzureBlobStorage.account | quote }}
# AZURE_BLOB_ACCOUNT_KEY: {{ .Values.externalAzureBlobStorage.key | quote }}
AZURE_BLOB_CONTAINER_NAME: {{ .Values.externalAzureBlobStorage.container | quote }}
AZURE_BLOB_ACCOUNT_URL: {{ .Values.externalAzureBlobStorage.url | quote }}
{{- else if .Values.externalGCS.enabled }}
# The type of storage to use for storing user files. Supported values are `local`, `s3`, `azure-blob`, `tencent-cos` and `google-storage`, Default: `local`
# The type of storage to use for storing user files. Supported values are `local`, `s3`, `azure-blob`, `aliyun-oss` and `google-storage`, Default: `local`
STORAGE_TYPE: google-storage
GOOGLE_STORAGE_BUCKET_NAME: {{ .Values.externalGCS.bucketName }}
GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON_BASE64: {{ .Values.externalGCS.serviceAccountJsonBase64 }}
GOOGLE_STORAGE_BUCKET_NAME: {{ .Values.externalGCS.bucketName.api | quote }}
# GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON_BASE64: {{ .Values.externalGCS.serviceAccountJsonBase64 | quote }}
{{- else if .Values.externalCOS.enabled }}
# The type of storage to use for storing user files. Supported values are `local`, `s3`, `azure-blob`, `tencent-cos`, `google-storage` and `tencent-cos`, Default: `local`
# The type of storage to use for storing user files. Supported values are `local`, `s3`, `azure-blob`, `aliyun-oss`, `google-storage` and `tencent-cos`, Default: `local`
STORAGE_TYPE: tencent-cos
# The name of the Tencent COS bucket to use for storing files.
TENCENT_COS_BUCKET_NAME: {{ .Values.externalCOS.bucketName }}
TENCENT_COS_BUCKET_NAME: {{ .Values.externalCOS.bucketName.api | quote }}
# The secret key to use for authenticating with the Tencent COS service.
TENCENT_COS_SECRET_KEY: {{ .Values.externalCOS.secretKey }}
# TENCENT_COS_SECRET_KEY: {{ .Values.externalCOS.secretKey | quote }}
# The secret id to use for authenticating with the Tencent COS service.
TENCENT_COS_SECRET_ID: {{ .Values.externalCOS.secretId }}
TENCENT_COS_SECRET_ID: {{ .Values.externalCOS.secretId | quote }}
# The region of the Tencent COS service.
TENCENT_COS_REGION: {{ .Values.externalCOS.region }}
TENCENT_COS_REGION: {{ .Values.externalCOS.region | quote }}
# The scheme of the Tencent COS service.
TENCENT_COS_SCHEME: {{ .Values.externalCOS.scheme }}
TENCENT_COS_SCHEME: {{ .Values.externalCOS.scheme | quote }}
{{- else if .Values.externalOBS.enabled }}
STORAGE_TYPE: huawei-obs
HUAWEI_OBS_SERVER: {{ .Values.externalOBS.endpoint | quote }}
HUAWEI_OBS_BUCKET_NAME: {{ .Values.externalOBS.bucketName.api | quote }}
# HUAWEI_OBS_ACCESS_KEY: {{ .Values.externalOBS.accessKey | quote }}
# HUAWEI_OBS_SECRET_KEY: {{ .Values.externalOBS.secretKey | quote }}
{{- else if .Values.externalTOS.enabled }}
STORAGE_TYPE: "volcengine-tos"
VOLCENGINE_TOS_ENDPOINT: {{ .Values.externalTOS.endpoint | quote }}
VOLCENGINE_TOS_REGION: {{ .Values.externalTOS.region | quote }}
VOLCENGINE_TOS_BUCKET_NAME: {{ .Values.externalTOS.bucketName.api | quote }}
VOLCENGINE_TOS_ACCESS_KEY: {{ .Values.externalTOS.accessKey | quote }}
# VOLCENGINE_TOS_SECRET_KEY: {{ .Values.externalTOS.secretKey | quote }}
{{- else }}
# The type of storage to use for storing user files. Supported values are `local` and `s3` and `azure-blob`, Default: `local`
STORAGE_TYPE: local
# The path to the local storage directory, the directory relative the root path of API service codes or absolute path. Default: `storage` or `/home/john/storage`.
# only available when STORAGE_TYPE is `local`.
STORAGE_LOCAL_PATH: {{ .Values.api.persistence.mountPath }}
STORAGE_LOCAL_PATH: {{ .Values.api.persistence.mountPath | quote }}
{{- end }}
{{- end }}

Expand Down Expand Up @@ -235,7 +248,11 @@ REDIS_DB: "0"
# Use redis as the broker, and redis db 1 for celery broker.
{{- if .Values.externalRedis.enabled }}
{{- with .Values.externalRedis }}
# CELERY_BROKER_URL: {{ printf "redis://%s:%s@%s:%v/1" .username .password .host .port }}
{{- $scheme := "redis" }}
{{- if .useSSL }}
{{- $scheme = "rediss" }}
{{- end }}
# CELERY_BROKER_URL: {{ printf "%s://%s:%s@%s:%v/1" $scheme .username .password .host .port }}
{{- end }}
{{- else if .Values.redis.enabled }}
{{- $redisHost := printf "%s-redis-master" .Release.Name -}}
Expand All @@ -256,17 +273,17 @@ WEAVIATE_ENDPOINT: {{ .Values.externalWeaviate.endpoint | quote }}
{{- else if .Values.externalQdrant.enabled }}
VECTOR_STORE: qdrant
# The Qdrant endpoint URL. Only available when VECTOR_STORE is `qdrant`.
QDRANT_URL: {{ .Values.externalQdrant.endpoint }}
QDRANT_URL: {{ .Values.externalQdrant.endpoint | quote }}
# The Qdrant API key.
# QDRANT_API_KEY: {{ .Values.externalQdrant.apiKey }}
# QDRANT_API_KEY: {{ .Values.externalQdrant.apiKey | quote }}
# The Qdrant clinet timeout setting.
QDRANT_CLIENT_TIMEOUT: {{ .Values.externalQdrant.timeout | quote }}
# The Qdrant client enable gRPC mode.
QDRANT_GRPC_ENABLED: {{ .Values.externalQdrant.grpc.enabled | toString | quote }}
# The Qdrant server gRPC mode PORT.
QDRANT_GRPC_PORT: {{ .Values.externalQdrant.grpc.port | quote }}
# The DSN for Sentry error reporting. If not set, Sentry error reporting will be disabled.
{{- else if .Values.externalMilvus.enabled}}
{{- else if .Values.externalMilvus.enabled }}
# Milvus configuration Only available when VECTOR_STORE is `milvus`.
VECTOR_STORE: milvus
# Milvus endpoint
Expand All @@ -279,9 +296,9 @@ VECTOR_STORE: pgvector
PGVECTOR_HOST: {{ .Values.externalPgvector.address }}
PGVECTOR_PORT: {{ .Values.externalPgvector.port | toString | quote }}
PGVECTOR_DATABASE: {{ .Values.externalPgvector.dbName }}
# DB_USERNAME: {{ .Values.externalPgvector.username }}
# DB_PASSWORD: {{ .Values.externalPgvector.password }}
{{- else if .Values.externalTencentVectorDB.enabled}}
# DB_USERNAME: {{ .Values.externalPgvector.username | quote }}
# DB_PASSWORD: {{ .Values.externalPgvector.password | quote }}
{{- else if .Values.externalTencentVectorDB.enabled }}
# tencent vector configurations, only available when VECTOR_STORE is `tencent`
VECTOR_STORE: tencent
TENCENT_VECTOR_DB_URL: {{ .Values.externalTencentVectorDB.url | quote }}
Expand All @@ -300,6 +317,13 @@ MYSCALE_PORT: {{ .Values.externalMyScaleDB.port | toString | quote }}
# MYSCALE_PASSWORD: {{ .Values.externalMyScaleDB.password | quote }}
MYSCALE_DATABASE: {{ .Values.externalMyScaleDB.database | quote }}
MYSCALE_FTS_PARAMS: {{ .Values.externalMyScaleDB.ftsParams | quote }}
{{- else if .Values.externalTableStore.enabled }}
# TableStore configurations, only available when VECTOR_STORE is `tablestore`
VECTOR_STORE: tablestore
TABLESTORE_ENDPOINT: {{ .Values.externalTableStore.endpoint | quote }}
TABLESTORE_INSTANCE_NAME: {{ .Values.externalTableStore.instanceName | quote }}
# TABLESTORE_ACCESS_KEY_ID: {{ .Values.externalTableStore.accessKeyId | quote }}
# TABLESTORE_ACCESS_KEY_SECRET: {{ .Values.externalTableStore.accessKeySecret | quote }}
{{- else if .Values.weaviate.enabled }}
# The type of vector store to use. Supported values are `weaviate`, `qdrant`, `milvus`.
VECTOR_STORE: weaviate
Expand Down Expand Up @@ -513,7 +537,7 @@ cache_store_log none

{{- define "dify.pluginDaemon.db.config" -}}
{{- if .Values.externalPostgres.enabled }}
DB_HOST: {{ .Values.externalPostgres.address }}
DB_HOST: {{ .Values.externalPostgres.address | quote }}
DB_PORT: {{ .Values.externalPostgres.port | toString | quote }}
DB_DATABASE: {{ .Values.externalPostgres.database.pluginDaemon | quote }}
{{- else if .Values.postgresql.enabled }}
Expand All @@ -526,10 +550,12 @@ DB_DATABASE: {{ .Values.externalPostgres.database.pluginDaemon | quote }}
{{- define "dify.pluginDaemon.config" }}
{{- include "dify.redis.config" . }}
{{- include "dify.pluginDaemon.db.config" .}}
{{- include "dify.pluginDaemon.storage.config" .}}
SERVER_PORT: "5002"
PLUGIN_REMOTE_INSTALLING_HOST: "0.0.0.0"
PLUGIN_REMOTE_INSTALLING_PORT: "5003"
MAX_PLUGIN_PACKAGE_SIZE: "52428800"
PLUGIN_STORAGE_LOCAL_ROOT: {{ .Values.pluginDaemon.persistence.mountPath | quote }}
PLUGIN_WORKING_PATH: {{ printf "%s/cwd" .Values.pluginDaemon.persistence.mountPath | clean | quote }}
DIFY_INNER_API_URL: "http://{{ template "dify.api.fullname" . }}:{{ .Values.api.service.port }}"
{{- include "dify.marketplace.config" . }}
Expand All @@ -543,3 +569,38 @@ MARKETPLACE_API_URL: {{ .Values.api.url.marketplaceApi | quote }}
MARKETPLACE_ENABLED: "false"
{{- end }}
{{- end }}

{{- define "dify.pluginDaemon.storage.config" -}}
{{- if and .Values.externalS3.enabled .Values.externalS3.bucketName.pluginDaemon }}
PLUGIN_STORAGE_TYPE: aws_s3
S3_USE_PATH_STYLE: {{ .Values.externalS3.pathStyle | toString | quote }}
S3_ENDPOINT: {{ .Values.externalS3.endpoint | quote }}
PLUGIN_STORAGE_OSS_BUCKET: {{ .Values.externalS3.bucketName.pluginDaemon | quote }}
AWS_REGION: {{ .Values.externalS3.region | quote }}
{{- else if and .Values.externalGCS.enabled .Values.externalGCS.bucketName.pluginDaemon }}
PLUGIN_STORAGE_TYPE: "google-storage"
PLUGIN_STORAGE_OSS_BUCKET: {{ .Values.externalGCS.bucketName.pluginDaemon | quote }}
# GCS_CREDENTIALS: {{ .Values.externalGCS.serviceAccountJsonBase64 | quote }}
{{- else if and .Values.externalCOS.enabled .Values.externalCOS.bucketName.pluginDaemon }}
PLUGIN_STORAGE_TYPE: "tencent_cos"
TENCENT_COS_SECRET_ID: {{ .Values.externalCOS.secretId | quote }}
TENCENT_COS_REGION: {{ .Values.externalCOS.region | quote }}
PLUGIN_STORAGE_OSS_BUCKET: {{ .Values.externalCOS.bucketName.pluginDaemon | quote }}
{{- else if and .Values.externalOBS.enabled .Values.externalOBS.bucketName.pluginDaemon }}
PLUGIN_STORAGE_TYPE: "huawei-obs"
HUAWEI_OBS_SERVER: {{ .Values.externalOBS.endpoint | quote }}
PLUGIN_STORAGE_OSS_BUCKET: {{ .Values.externalOBS.bucketName.pluginDaemon | quote }}
HUAWEI_OBS_ACCESS_KEY: {{ .Values.externalOBS.accessKey | quote }}
# HUAWEI_OBS_SECRET_KEY: {{ .Values.externalOBS.secretKey | quote }}
{{- else if and .Values.externalTOS.enabled .Values.externalTOS.bucketName.pluginDaemon }}
PLUGIN_STORAGE_TYPE: "volcengine-tos"
PLUGIN_VOLCENGINE_TOS_ENDPOINT: {{ .Values.externalTOS.endpoint | quote }}
PLUGIN_VOLCENGINE_TOS_REGION: {{ .Values.externalTOS.region | quote }}
PLUGIN_STORAGE_OSS_BUCKET: {{ .Values.externalTOS.bucketName.pluginDaemon | quote }}
PLUGIN_VOLCENGINE_TOS_ACCESS_KEY: {{ .Values.externalTOS.accessKey | quote }}
# PLUGIN_VOLCENGINE_TOS_SECRET_KEY: {{ .Values.externalTOS.secretKey | quote }}
{{- else }}
PLUGIN_STORAGE_TYPE: local
STORAGE_LOCAL_PATH: {{ .Values.pluginDaemon.persistence.mountPath | quote }}
{{- end }}
{{- end }}
Loading