Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🪖 feat: Helm Chart (#3539)
Danny Avilab6fe7e5570b2
diff --git a/.github/workflows/helmcharts.yml b/.github/workflows/helmcharts.ymlnew file mode 100644index 0000000000..fcd8bc7df6--- /dev/null+++ b/.github/workflows/helmcharts.yml@@ -0,0 +1,35 @@+name: Build Helm Charts on Tag++# The workflow is triggered when a tag is pushed+on:+ push:+ tags:+ - "*"++jobs:+ release:+ permissions:+ contents: write+ runs-on: ubuntu-latest+ steps:+ - name: Checkout+ uses: actions/checkout@v4+ with:+ fetch-depth: 0++ - name: Configure Git+ run: |+ git config user.name "$GITHUB_ACTOR"+ git config user.email "[email protected]"++ - name: Install Helm+ uses: azure/setup-helm@v4+ env:+ GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"++ - name: Run chart-releaser+ uses: helm/[email protected]+ with:+ charts_dir: helmchart+ env:+ CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"\ No newline at end of filediff --git a/helmchart/.helmignore b/helmchart/.helmignorenew file mode 100644index 0000000000..0e8a0eb36f--- /dev/null+++ b/helmchart/.helmignore@@ -0,0 +1,23 @@+# Patterns to ignore when building packages.+# This supports shell glob matching, relative path matching, and+# negation (prefixed with !). Only one pattern per line.+.DS_Store+# Common VCS dirs+.git/+.gitignore+.bzr/+.bzrignore+.hg/+.hgignore+.svn/+# Common backup files+*.swp+*.bak+*.tmp+*.orig+*~+# Various IDEs+.project+.idea/+*.tmproj+.vscode/diff --git a/helmchart/Chart.yaml b/helmchart/Chart.yamlnew file mode 100644index 0000000000..031ac4cd71--- /dev/null+++ b/helmchart/Chart.yaml@@ -0,0 +1,4 @@+apiVersion: v2+name: librechat+type: application+version: 1.0.0\ No newline at end of filediff --git a/helmchart/templates/NOTES.txt b/helmchart/templates/NOTES.txtnew file mode 100644index 0000000000..fcf3b433a5--- /dev/null+++ b/helmchart/templates/NOTES.txt@@ -0,0 +1,22 @@+1. Get the application URL by running these commands:+{{- if .Values.ingress.enabled }}+{{- range $host := .Values.ingress.hosts }}+ {{- range .paths }}+ http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}+ {{- end }}+{{- end }}+{{- else if contains "NodePort" .Values.service.type }}+ export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "librechat.fullname" . }})+ 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.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 --namespace {{ .Release.Namespace }} svc -w {{ include "librechat.fullname" . }}'+ export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "librechat.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")+ echo http://$SERVICE_IP:{{ .Values.service.port }}+{{- else if contains "ClusterIP" .Values.service.type }}+ export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "librechat.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")+ export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")+ echo "Visit http://127.0.0.1:8080 to use your application"+ kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT+{{- end }}diff --git a/helmchart/templates/_helpers.tpl b/helmchart/templates/_helpers.tplnew file mode 100644index 0000000000..c6b3755b1e--- /dev/null+++ b/helmchart/templates/_helpers.tpl@@ -0,0 +1,74 @@+{{/*+Expand the name of the chart.+*/}}+{{- define "librechat.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).+If release name contains chart name it will be used as a full name.+*/}}+{{- define "librechat.fullname" -}}+{{- if .Values.fullnameOverride }}+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}+{{- else }}+{{- $name := default .Chart.Name .Values.nameOverride }}+{{- if contains $name .Release.Name }}+{{- .Release.Name | trunc 63 | trimSuffix "-" }}+{{- else }}+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}+{{- end }}+{{- end }}+{{- end }}++{{/*+Create chart name and version as used by the chart label.+*/}}+{{- define "librechat.chart" -}}+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}+{{- end }}++{{/*+Common labels+*/}}+{{- define "librechat.labels" -}}+helm.sh/chart: {{ include "librechat.chart" . }}+{{ include "librechat.selectorLabels" . }}+{{- if .Chart.AppVersion }}+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}+{{- end }}+app.kubernetes.io/managed-by: {{ .Release.Service }}+{{- end }}++{{/*+Selector labels+*/}}+{{- define "librechat.selectorLabels" -}}+app.kubernetes.io/name: {{ include "librechat.name" . }}+app.kubernetes.io/instance: {{ .Release.Name }}+{{- end }}++{{/*+Create the name of the service account to use+*/}}+{{- define "librechat.serviceAccountName" -}}+{{- if .Values.serviceAccount.create }}+{{- default (include "librechat.fullname" .) .Values.serviceAccount.name }}+{{- else }}+{{- default "default" .Values.serviceAccount.name }}+{{- end }}+{{- end }}++{{/*+Print string from list split by ,+*/}}+{{- define "model.list" -}}+{{- range $idx, $val := $.Values.configEndpoint.models -}}+{{- if $idx }}+{{- print ", " -}}+{{- end -}}+{{- $val -}}+{{- end -}}+{{- end -}}\ No newline at end of filediff --git a/helmchart/templates/configmap-env.yaml b/helmchart/templates/configmap-env.yamlnew file mode 100644index 0000000000..195c2e28e8--- /dev/null+++ b/helmchart/templates/configmap-env.yaml@@ -0,0 +1,10 @@+apiVersion: v1+kind: ConfigMap+metadata:+ name: {{ include "librechat.fullname" . }}-env+ labels:+ {{- include "librechat.labels" . | nindent 4 }}+data:+{{- range $key, $val := .Values.config.env }}+ {{ $key }}: {{ $val | quote }}+{{- end }}\ No newline at end of filediff --git a/helmchart/templates/deployment.yaml b/helmchart/templates/deployment.yamlnew file mode 100644index 0000000000..fea99bb46d--- /dev/null+++ b/helmchart/templates/deployment.yaml@@ -0,0 +1,81 @@+apiVersion: apps/v1+kind: Deployment+metadata:+ name: {{ include "librechat.fullname" . }}+ labels:+ {{- include "librechat.labels" . | nindent 4 }}+spec:+ {{- if not .Values.autoscaling.enabled }}+ replicas: {{ .Values.replicaCount }}+ {{- end }}+ selector:+ matchLabels:+ {{- include "librechat.selectorLabels" . | nindent 6 }}+ template:+ metadata:+ {{- with .Values.podAnnotations }}+ annotations:+ {{- toYaml . | nindent 8 }}+ {{- end }}+ labels:+ {{- include "librechat.selectorLabels" . | nindent 8 }}+ {{- with .Values.podLabels }}+ {{- toYaml . | nindent 8 }}+ {{- end }}+ spec:+ {{- with .Values.imagePullSecrets }}+ imagePullSecrets:+ {{- toYaml . | nindent 8 }}+ {{- end }}+ serviceAccountName: {{ include "librechat.serviceAccountName" . }}+ securityContext:+ {{- toYaml .Values.podSecurityContext | nindent 8 }}+ containers:+ - name: {{ .Chart.Name }}+ securityContext:+ {{- toYaml .Values.securityContext | nindent 12 }}+ image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"+ imagePullPolicy: {{ .Values.image.pullPolicy }}+ envFrom:+ {{ if .Values.config.envSecrets.secretRef }}+ - secretRef:+ name: {{ .Values.config.envSecrets.secretRef }}+ {{- end }}+ - configMapRef:+ name: {{ include "librechat.fullname" . }}-env+ env:+ {{- range $secretKeyRef := .Values.config.envSecrets.secretKeyRef }}+ - name: {{ $secretKeyRef.name }}+ valueFrom:+ secretKeyRef:+ name: {{ $secretKeyRef.secretName }}+ key: {{ $secretKeyRef.secretKey }}+ {{- end }}+ ports:+ - name: http+ containerPort: 3080+ protocol: TCP+ livenessProbe:+ initialDelaySeconds: 5+ httpGet:+ path: /+ port: http+ readinessProbe:+ initialDelaySeconds: 5+ httpGet:+ path: /+ port: http+ resources:+ {{- toYaml .Values.resources | nindent 12 }}+ {{- with .Values.nodeSelector }}+ nodeSelector:+ {{- toYaml . | nindent 8 }}+ {{- end }}+ {{- with .Values.affinity }}+ affinity:+ {{- toYaml . | nindent 8 }}+ {{- end }}+ {{- with .Values.tolerations }}+ tolerations:+ {{- toYaml . | nindent 8 }}+ {{- end }}diff --git a/helmchart/templates/hpa.yaml b/helmchart/templates/hpa.yamlnew file mode 100644index 0000000000..f66fd461e2--- /dev/null+++ b/helmchart/templates/hpa.yaml@@ -0,0 +1,28 @@+{{- if .Values.autoscaling.enabled }}+apiVersion: autoscaling/v2beta1+kind: HorizontalPodAutoscaler+metadata:+ name: {{ include "librechat.fullname" . }}+ labels:+ {{- include "librechat.labels" . | nindent 4 }}+spec:+ scaleTargetRef:+ apiVersion: apps/v1+ kind: Deployment+ name: {{ include "librechat.fullname" . }}+ minReplicas: {{ .Values.autoscaling.minReplicas }}+ maxReplicas: {{ .Values.autoscaling.maxReplicas }}+ metrics:+ {{- if .Values.autoscaling.targetCPUUtilizationPercentage }}+ - type: Resource+ resource:+ name: cpu+ targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}+ {{- end }}+ {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}+ - type: Resource+ resource:+ name: memory+ targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}+ {{- end }}+{{- end }}diff --git a/helmchart/templates/ingress.yaml b/helmchart/templates/ingress.yamlnew file mode 100644index 0000000000..135c71be35--- /dev/null+++ b/helmchart/templates/ingress.yaml@@ -0,0 +1,61 @@+{{- if .Values.ingress.enabled -}}+{{- $fullName := include "librechat.fullname" . -}}+{{- $svcPort := .Values.service.port -}}+{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}+ {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}+ {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}+ {{- end }}+{{- end }}+{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}+apiVersion: networking.k8s.io/v1+{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}+apiVersion: networking.k8s.io/v1beta1+{{- else -}}+apiVersion: extensions/v1beta1+{{- end }}+kind: Ingress+metadata:+ name: {{ $fullName }}+ labels:+ {{- include "librechat.labels" . | nindent 4 }}+ {{- with .Values.ingress.annotations }}+ annotations:+ {{- toYaml . | nindent 4 }}+ {{- end }}+spec:+ {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}+ ingressClassName: {{ .Values.ingress.className }}+ {{- end }}+ {{- if .Values.ingress.tls }}+ tls:+ {{- range .Values.ingress.tls }}+ - hosts:+ {{- range .hosts }}+ - {{ . | quote }}+ {{- end }}+ secretName: {{ .secretName }}+ {{- end }}+ {{- end }}+ rules:+ {{- range .Values.ingress.hosts }}+ - host: {{ .host | quote }}+ http:+ paths:+ {{- range .paths }}+ - path: {{ .path }}+ {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}+ pathType: {{ .pathType }}+ {{- end }}+ backend:+ {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}+ service:+ name: {{ $fullName }}+ port:+ number: {{ $svcPort }}+ {{- else }}+ serviceName: {{ $fullName }}+ servicePort: {{ $svcPort }}+ {{- end }}+ {{- end }}+ {{- end }}+{{- end }}diff --git a/helmchart/templates/service.yaml b/helmchart/templates/service.yamlnew file mode 100644index 0000000000..7f60acc7c7--- /dev/null+++ b/helmchart/templates/service.yaml@@ -0,0 +1,15 @@+apiVersion: v1+kind: Service+metadata:+ name: {{ include "librechat.fullname" . }}+ labels:+ {{- include "librechat.labels" . | nindent 4 }}+spec:+ type: {{ .Values.service.type }}+ ports:+ - port: {{ .Values.service.port }}+ targetPort: http+ protocol: TCP+ name: http+ selector:+ {{- include "librechat.selectorLabels" . | nindent 4 }}diff --git a/helmchart/templates/serviceaccount.yaml b/helmchart/templates/serviceaccount.yamlnew file mode 100644index 0000000000..baa9ad3122--- /dev/null+++ b/helmchart/templates/serviceaccount.yaml@@ -0,0 +1,12 @@+{{- if .Values.serviceAccount.create -}}+apiVersion: v1+kind: ServiceAccount+metadata:+ name: {{ include "librechat.serviceAccountName" . }}+ labels:+ {{- include "librechat.labels" . | nindent 4 }}+ {{- with .Values.serviceAccount.annotations }}+ annotations:+ {{- toYaml . | nindent 4 }}+ {{- end }}+{{- end }}diff --git a/helmchart/values.yaml b/helmchart/values.yamlnew file mode 100644index 0000000000..c21f84586a--- /dev/null+++ b/helmchart/values.yaml@@ -0,0 +1,112 @@+# Default values for librechat.+# This is a YAML-formatted file.+# Declare variables to be passed into your templates.++replicaCount: 1++image:+ repository: ghcr.io/danny-avila/librechat+ pullPolicy: IfNotPresent+ # Overrides the image tag whose default is the chart appVersion.+ tag: "latest"++imagePullSecrets: []+nameOverride: ""+fullnameOverride: ""++serviceAccount:+ # Specifies whether a service account should be created+ create: true+ # Annotations to add to the service account+ annotations: {}+ # The name of the service account to use.+ # If not set and create is true, a name is generated using the fullname template+ name: ""++podAnnotations: {}++podLabels: {}++podSecurityContext: {}+ # fsGroup: 2000++securityContext: {}+ # capabilities:+ # drop:+ # - ALL+ # readOnlyRootFilesystem: true+ # runAsNonRoot: true+ # runAsUser: 1000++networkPolicies:+ enabled: true++service:+ type: LoadBalancer+ port: 80++ingress:+ enabled: true+ className: "nginx"+ annotations: {}+ # kubernetes.io/ingress.class: nginx+ # kubernetes.io/tls-acme: "true"+ hosts:+ - host: chat.example.com+ paths:+ - path: /+ pathType: ImplementationSpecific+ tls: []+ # - secretName: chart-example-tls+ # hosts:+ # - chart-example.local++resources: {}+ # limits:+ # cpu: 100m+ # memory: 128Mi+ # requests:+ # cpu: 100m+ # memory: 128Mi++autoscaling:+ enabled: false+ minReplicas: 1+ maxReplicas: 100+ targetCPUUtilizationPercentage: 80+ # targetMemoryUtilizationPercentage: 80++nodeSelector: {}++tolerations: []++affinity: {}++config:+ envSecrets:+ # Use this when using one k8s secret for multiply env secrets+ # secretRef: librechat++ # Use this when using one k8s secret for each env secret+ secretKeyRef: []+# - name: CREDS_IV+# secretName: librechat+# secretKey: CREDS_IV++ env:+ # Full list of possible values+ # https://github.com/danny-avila/LibreChat/blob/main/.env.example+ ALLOW_EMAIL_LOGIN: "true"+ ALLOW_REGISTRATION: "true"+ ALLOW_SOCIAL_LOGIN: "false"+ ALLOW_SOCIAL_REGISTRATION: "false"+ APP_TITLE: "Librechat"+ CUSTOM_FOOTER: "Provided with ❤️"+ DEBUG_CONSOLE: "true"+ DEBUG_LOGGING: "true"+ DEBUG_OPENAI: "true"+ DEBUG_PLUGINS: "true"+ DOMAIN_CLIENT: ""+ DOMAIN_SERVER: ""+ ENDPOINTS: "openAI,azureOpenAI,bingAI,chatGPTBrowser,google,gptPlugins,anthropic"+ SEARCH: false