Skip to content

Commit

Permalink
πŸͺ– feat: Helm Chart (#99)
Browse files Browse the repository at this point in the history
* feat: Update configuration metadata for Azure OpenAI and Docker Override

* πŸͺ– docs: Helm Chart

* docs: Add example submission by @dimaby and link to env config

* feat: Add Helm chart documentation card

* chore: remove AI generation lol

* chore: docs formatting
  • Loading branch information
danny-avila authored Aug 5, 2024
1 parent 6d58312 commit 04d691c
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 8 deletions.
6 changes: 5 additions & 1 deletion pages/docs/configuration/_meta.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
export default {
index: 'Intro',
authentication: 'Authentication',
dotenv: 'Environment Variables',
librechat_yaml: 'librechat.yaml',
authentication: 'Authentication',
mongodb: 'MongoDB',
pre_configured_ai: 'AI Providers',
tools: 'Tools and Plugins',
azure: 'Azure OpenAI',
docker_override: 'Docker Override',
mod_system: 'Automated Moderation',
}
5 changes: 3 additions & 2 deletions pages/docs/local/_meta.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default {
index: 'Intro',
docker: 'Docker',
npm: 'npm',
docker: 'πŸ‹ Docker',
npm: 'πŸ“¦ npm',
helm_chart: 'πŸͺ– Helm Chart',
}
2 changes: 1 addition & 1 deletion pages/docs/local/docker.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Docker
title: πŸ‹ Docker
description: How to install LibreChat locally with Docker
---

Expand Down
109 changes: 109 additions & 0 deletions pages/docs/local/helm_chart.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
title: πŸͺ– Helm Chart
description: Instructions for deploying LibreChat on Kubernetes using Helm
---

# Deployment a LibreChat Helm Chart

The following instructions guide you to deploy LibreChat on Kubernetes using Helm. At the moment, this installation method only provides running the LibreChat components, without any additional services like MongoDB or Redis. You will need to provide your own MongoDB and Redis instances.

Note: this method was contributed by the community. If you are familiar with Helm and Kubernetes, use this guide as a reference and adjust to your needs. You can also reference other helm charts made by the community below in the [Community Helm Charts](#community-helm-charts) section.

## Prerequisites

* A running Kubernetes cluster
* `kubectl` installed
* Having a MongoDB instance running that can be accessed from the Kubernetes cluster
* Helm installed on your local machine

## Configuration
Similar to other Helm charts, there exists a [values file](https://github.com/danny-avila/LibreChat/blob/main/helmchart/values.yaml) that serves two primary functions: it outlines the default settings and indicates which configurations are adjustable.

Essentially, any setting within this values file can be modified in two main ways:

- The first method involves creating a separate override file and specifying it when executing the install command.
- The second method involves directly setting each variable with the installation command itself. If you're planning to change numerous variables, it's advisable to use the override file approach to avoid an overly lengthy command. Conversely, for fewer adjustments, directly setting variables with the installation command might be more convenient.


The very end of the file sets some of [environment variables](/docs/configuration/dotenv) of the application, that should look familiar if you deployed the application before. It is the base configuration without any sensitive data.

```
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
```

However, like the comment says, you could have a look at which environment variables are generally available to be modified.

Because with only these variables set the application won't start correctly. We need to set some more variables, but those contain sensitive data. We will show 2 different ways to make use of Kubernetes features in order to configure those in a secure way.

### Create one Kubernetes Secret with different entries
Assuming you have `kubectl` installed on your machine and you are connected to your Kubernetes cluster you can run the following command to create a respective Kubernetes secret, that can be used by the helm chart.

```
kubectl create secret generic librechat \
--from-literal=CREDS_KEY=0963cc1e5e5df9554c8dd32435d0eb2b1a8b6edde6596178d5c5418ade897673 \
--from-literal=CREDS_IV=46d727a066d5d8c4ebc94305d028fecc \
--from-literal=MONGO_URI=mongodb+srv://<user>:<password>@<mongodb-url> \
--from-literal=JWT_SECRET=83e5c1f0e037e4f027dbdb332d54ca1bd1f12af6798700c207ed817ebd7c544b \ --from-literal=JWT_REFRESH_SECRET=83e5c1f0c037e4f027dbab332d54ca1bd1f12af6798700c207ed817ebd7c544
```

- Remember to use your own values for securing sensitive environment variables like `CREDS_KEY`, `CREDS_IV`, `JWT_SECRET`, and `JWT_REFRESH_SECRET`.
- Use the [Credentials Generator](/toolkit/creds_generator) to quickly generate secure values for these variables.

### Create one Kubernetes Secret for each configuration
This one is a bit more complicated but also allows for more fine-grained control over the secrets. For each secret, you would like to create you can run the following command.

```
kubectl create secret generic librechat-creds-key \
--from-literal=CREDS_KEY=0963cc1e5e5df9554c8dd32435d0eb2b1a8b6edde6596178d5c5418ade897673
```
... and so on for each secret.


## Install Helm Chart
In the root directory run:

`helm install <deployment-name> helmchart`

Example: `helm install librechat helmchart --set config.envSecrets.secretRef=librechat` (using one Kubernetes secret for all credentials).

If you used the approach where you created one Kubernetes secret for each credential you will need to do a more extensive configuration which is best placed in a separate file. Create a file with the following content:

```
config:
envSecrets:
secretKeyRef:
- name: CREDS_KEY
secretName: librechat-creds-iv
secretKey: CREDS_KEY
<...>
```

After that you can run the following command: `helm install librechat helmchart --values <values-override-filel>`


## Uninstall Helm Chart

In order to uninstall the Helm Chart simply run: `helm uninstall <deployment-name>`

Example: `helm uninstall librechat`

## Community Helm Charts

- [LibreChat Helm Chart by Blue Atlas Helm Charts](https://github.com/bat-bs/helm-charts/tree/main/charts/librechat)
- Example submitted by [@dimaby](https://github.com/dimaby) on GitHub: [PR #2879](https://github.com/danny-avila/LibreChat/pull/2879)
7 changes: 4 additions & 3 deletions pages/docs/local/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import { DockerIcon, NpmIcon } from '@/components/svg/'

Alternatively, you can install LibreChat using the `npm{:zig}` install method. However, this method requires manual setup of MongoDB, MeiliSearch, and the "rag_api + vectordb" dependencies, which can be time-consuming and error-prone.

Whether you choose the Docker or npm install method, we have detailed instructions to help you get started with LibreChat.
Whether you choose the Docker, npm install method, or Helm chart for Kubernetes, we have detailed instructions to help you get started with LibreChat.

<div style={{ display: 'flex', justifyContent: 'center' }}>
<Cards num={2} style={{ display: 'flex', flexDirection: 'row' }}>
<Cards num={3} style={{ display: 'flex', flexDirection: 'row' }}>
<Cards.Card
icon={<DockerIcon />}
title="Docker Install"
Expand All @@ -23,5 +23,6 @@ Whether you choose the Docker or npm install method, we have detailed instructio
href="/docs/local/docker"
/>
<Cards.Card icon={<NpmIcon />} title="npm Install" image arrow href="/docs/local/npm" />
<Cards.Card icon="πŸͺ–" title="Helm Chart" image arrow href="/docs/local/helm_chart" />
</Cards>
</div>
</div>
2 changes: 1 addition & 1 deletion pages/docs/local/npm.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Docker
title: πŸ“¦ npm
description: How to install LibreChat locally using npm
---

Expand Down

0 comments on commit 04d691c

Please sign in to comment.