-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⚡ docs: Add static file configuration & update how to contribute (#98)
* add static file & update doc documentation * add DISABLE_COMPRESSION * 📝 docs: rag_api.mdx for running RAG API with Ollama nomic-embed-text (#92) * feat: Update Traefik docs about support for static file caching and compression * Update traefik.mdx * docs: Mention static file caching and compression for NGINX --------- Co-authored-by: mawburn <[email protected]> Co-authored-by: matt burnett <[email protected]> Co-authored-by: Linh <[email protected]>
- Loading branch information
1 parent
3cb41e3
commit 6d58312
Showing
4 changed files
with
94 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,17 +12,17 @@ While the default settings provide a solid foundation for a standard `docker` in | |
Alternatively, you can create a new file named `docker-compose.override.yml` in the same directory as your main `docker-compose.yml` file for LibreChat, where you can set your .env variables as needed under `environment`, or modify the default configuration provided by the main `docker-compose.yml`, without the need to directly edit or duplicate the whole file. | ||
|
||
For more info see: | ||
For more info see: | ||
|
||
- Our quick guide: | ||
- Our quick guide: | ||
- **[Docker Override](/docs/configuration/docker_override)** | ||
|
||
- The official docker documentation: | ||
- The official docker documentation: | ||
- **[docker docs - understanding-multiple-compose-files](https://docs.docker.com/compose/multiple-compose-files/extends/#understanding-multiple-compose-files)** | ||
- **[docker docs - merge-compose-files](https://docs.docker.com/compose/multiple-compose-files/merge/#merge-compose-files)** | ||
- **[docker docs - specifying-multiple-compose-files](https://docs.docker.com/compose/reference/#specifying-multiple-compose-files)** | ||
|
||
- You can also view an example of an override file for LibreChat in your LibreChat folder and on GitHub: | ||
- You can also view an example of an override file for LibreChat in your LibreChat folder and on GitHub: | ||
- **[docker-compose.override.example](https://github.com/danny-avila/LibreChat/blob/main/docker-compose.override.yml.example)** | ||
|
||
--- | ||
|
@@ -42,6 +42,28 @@ For more info see: | |
]} | ||
/> | ||
|
||
#### Static File Handling | ||
|
||
<OptionTable | ||
options={[ | ||
['STATIC_CACHE_MAX_AGE', 'string', 'Cache-Control max-age in seconds','STATIC_CACHE_MAX_AGE=604800'], | ||
['STATIC_CACHE_S_MAX_AGE', 'string', 'Custom footer.','STATIC_CACHE_S_MAX_AGE="259200"'], | ||
['DISABLE_COMPRESSION', 'boolean', 'Disables compression for static files.','DISABLE_COMPRESSION=false'], | ||
]} | ||
/> | ||
|
||
**Behaviour:** | ||
|
||
Sets the [Cache-Control](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) headers for static files. These configurations only trigger when the `NODE_ENV` is set to `production`. | ||
|
||
* Uncomment `STATIC_CACHE_MAX_AGE` to change the local `max-age` for static files. By default this is set to 4 weeks. | ||
* Uncomment `STATIC_CACHE_S_MAX_AGE` empty to remove the footer. This is for the "shared cache," which is used by CDNs and proxies. By default this is set to 1 week. | ||
* Set `DISABLE_COMPRESSION` to `true` to disable compression for static files. This is useful if you have another service in front of your service handling compression for you. By default this is set to `false`. | ||
|
||
<Callout type="warning" title="Warning"> | ||
- This only affects static files served by the API server and is not applicable to _Firebase_, _NGINX_, or any other configurations. | ||
</Callout> | ||
|
||
|
||
### MongoDB Database | ||
|
||
|
@@ -52,7 +74,7 @@ For more info see: | |
/> | ||
Change this to your MongoDB URI if different. You should add `LibreChat` or your own `APP_TITLE` as the database name in the URI. | ||
|
||
If you are using an online database, the URI format is `mongodb+srv://<username>:<password>@<host>/<database>?<options>`. Your `MONGO_URI` should look like this: | ||
If you are using an online database, the URI format is `mongodb+srv://<username>:<password>@<host>/<database>?<options>`. Your `MONGO_URI` should look like this: | ||
* `mongodb+srv://username:[email protected]/LibreChat?retryWrites=true` (`retryWrites` is the only option you need when using the online database.) | ||
|
||
Alternatively you can use `documentDb` that emulates `mongoDb` but it: | ||
|
@@ -61,7 +83,7 @@ Alternatively you can use `documentDb` that emulates `mongoDb` but it: | |
* requires TLS connection, hence use parameters `tls=true` to enable TLS and `tlsCAFile=/path-to-ca/bundle.pem` to point to the AWS provided CA bundle file | ||
|
||
The URI for `documentDb` will look like: | ||
* `mongodb+srv://username:password@domain/dbname?retryWrites=false&tls=true&tlsCAFile=/path-to-ca/bundle.pem` | ||
* `mongodb+srv://username:password@domain/dbname?retryWrites=false&tls=true&tlsCAFile=/path-to-ca/bundle.pem` | ||
|
||
See also: | ||
|
||
|
@@ -81,7 +103,7 @@ To configure LibreChat for local use or custom domain deployment, set the follow | |
]} | ||
/> | ||
|
||
When deploying LibreChat to a custom domain, replace `http://localhost:3080` with your deployed URL | ||
When deploying LibreChat to a custom domain, replace `http://localhost:3080` with your deployed URL | ||
- e.g. `https://librechat.example.com`. | ||
|
||
### Prevent Public Search Engines Indexing | ||
|
@@ -116,10 +138,10 @@ LibreChat has built-in central logging, see [Logging System](/docs/configuration | |
]} | ||
/> | ||
|
||
Note: | ||
Note: | ||
* `DEBUG_LOGGING` can be used with either `DEBUG_CONSOLE` or `CONSOLE_JSON` but not both. | ||
* `DEBUG_CONSOLE` and `CONSOLE_JSON` are mutually exclusive. | ||
* `CONSOLE_JSON`: When handling console logs in cloud deployments (such as GCP or AWS), enabling this will dump the logs with a UTC timestamp and format them as JSON. | ||
* `CONSOLE_JSON`: When handling console logs in cloud deployments (such as GCP or AWS), enabling this will dump the logs with a UTC timestamp and format them as JSON. | ||
* See: [feat: Add CONSOLE_JSON](https://github.com/danny-avila/LibreChat/pull/2146) | ||
|
||
Note: `DEBUG_CONSOLE` is not recommended, as the outputs can be quite verbose, and so it's disabled by default. | ||
|
@@ -135,7 +157,7 @@ Note: `DEBUG_CONSOLE` is not recommended, as the outputs can be quite verbose, a | |
/> | ||
|
||
### Configuration Path - `librechat.yaml` | ||
Specify an alternative location for the LibreChat configuration file. | ||
Specify an alternative location for the LibreChat configuration file. | ||
You may specify an **absolute path**, a **relative path**, or a **URL**. The filename in the path is flexible and does not have to be `librechat.yaml`; any valid configuration file will work. | ||
|
||
> **Note**: If you prefer LibreChat to search for the configuration file in the root directory (which is the default behavior), simply leave this option commented out. | ||
|
@@ -308,15 +330,15 @@ To securely store credentials, you need a fixed key and IV. You can set them her | |
/> | ||
|
||
<Callout type="warning" title="Warning"> | ||
**Warning:** If you don't set `CREDS_KEY` and `CREDS_IV`, the app will crash on startup. | ||
**Warning:** If you don't set `CREDS_KEY` and `CREDS_IV`, the app will crash on startup. | ||
- You can use this [Key Generator](/toolkit/creds_generator) to generate them quickly. | ||
</Callout> | ||
|
||
#### Azure AI Search | ||
This plugin supports searching Azure AI Search for answers to your questions. See: [Azure AI Search](/docs/configuration/tools/azure_ai_search) | ||
|
||
<OptionTable | ||
options={[ | ||
options={[ | ||
['AZURE_AI_SEARCH_SERVICE_ENDPOINT', 'string', 'The service endpoint for Azure AI Search.','AZURE_AI_SEARCH_SERVICE_ENDPOINT='], | ||
['AZURE_AI_SEARCH_INDEX_NAME', 'string', 'The index name for Azure AI Search.','AZURE_AI_SEARCH_INDEX_NAME='], | ||
['AZURE_AI_SEARCH_API_KEY', 'string', 'The API key for Azure AI Search.','AZURE_AI_SEARCH_API_KEY='], | ||
|
@@ -612,7 +634,7 @@ see: **[Automated Moderation](/docs/configuration/mod_system)** | |
#### Message rate limiting (per user & IP) | ||
|
||
<OptionTable | ||
options={[ | ||
options={[ | ||
['LIMIT_CONCURRENT_MESSAGES', 'boolean', 'Whether to limit the amount of messages a user can send per request.','LIMIT_CONCURRENT_MESSAGES=true'], | ||
['CONCURRENT_MESSAGE_MAX', 'integer', 'The max amount of messages a user can send per request.','CONCURRENT_MESSAGE_MAX=2'], | ||
]} | ||
|
@@ -625,7 +647,7 @@ see: **[Automated Moderation](/docs/configuration/mod_system)** | |
##### IP Limiter: | ||
|
||
<OptionTable | ||
options={[ | ||
options={[ | ||
['LIMIT_MESSAGE_IP', 'boolean', 'Whether to limit the amount of messages an IP can send per `MESSAGE_IP_WINDOW`.','LIMIT_MESSAGE_IP=true'], | ||
['MESSAGE_IP_MAX', 'integer', 'The max amount of messages an IP can send per `MESSAGE_IP_WINDOW`.','MESSAGE_IP_MAX=40'], | ||
['MESSAGE_IP_WINDOW', 'integer', 'In minutes, determines the window of time for `MESSAGE_IP_MAX` messages.','MESSAGE_IP_WINDOW=1'], | ||
|
@@ -635,7 +657,7 @@ see: **[Automated Moderation](/docs/configuration/mod_system)** | |
##### User Limiter: | ||
|
||
<OptionTable | ||
options={[ | ||
options={[ | ||
['LIMIT_MESSAGE_USER', 'boolean', 'Whether to limit the amount of messages an user can send per `MESSAGE_USER_WINDOW`.','LIMIT_MESSAGE_USER=false'], | ||
['MESSAGE_USER_MAX', 'integer', 'The max amount of messages an user can send per `MESSAGE_USER_WINDOW`.','MESSAGE_USER_MAX=40'], | ||
['MESSAGE_USER_WINDOW', 'integer', 'In minutes, determines the window of time for `MESSAGE_USER_MAX` messages.','MESSAGE_USER_WINDOW=1'], | ||
|
@@ -676,7 +698,7 @@ see: **[Authentication System](/docs/configuration/authentication)** | |
</div> | ||
</div> | ||
|
||
- General Settings: | ||
- General Settings: | ||
|
||
<OptionTable | ||
options={[ | ||
|
@@ -693,7 +715,7 @@ see: **[Authentication System](/docs/configuration/authentication)** | |
> **Quick Tip:** Even with registration disabled, add users directly to the database using `npm run create-user`. | ||
> **Quick Tip:** With registration disabled, you can delete a user with `npm run delete-user [email protected]`. | ||
- Session and Refresh Token Settings: | ||
- Session and Refresh Token Settings: | ||
|
||
<OptionTable | ||
options={[ | ||
|
@@ -704,9 +726,9 @@ see: **[Authentication System](/docs/configuration/authentication)** | |
|
||
- For more information: **[Refresh Token](https://github.com/danny-avila/LibreChat/pull/927)** | ||
|
||
- JWT Settings: | ||
- JWT Settings: | ||
|
||
You should use new secure values. The examples given are 32-byte keys (64 characters in hex). | ||
You should use new secure values. The examples given are 32-byte keys (64 characters in hex). | ||
Use this replit to generate some quickly: **[JWT Keys](/toolkit/creds_generator)** | ||
|
||
<OptionTable | ||
|
@@ -769,7 +791,7 @@ For more information: **[Google Authentication](/docs/configuration/authenticati | |
|
||
#### [OpenID Connect](/docs/configuration/authentication/OAuth2-OIDC#openid-connect) | ||
|
||
For more information: | ||
For more information: | ||
- [AWS Cognito](/docs/configuration/authentication/OAuth2-OIDC/aws) | ||
- [Azure Entra/AD](/docs/configuration/authentication/OAuth2-OIDC/azure) | ||
- [Keycloak](/docs/configuration/authentication/OAuth2-OIDC/keycloak) | ||
|
@@ -828,7 +850,7 @@ Email is used for account verification and password reset. See: **[Email setup]( | |
**Important Note**: All of the service or host, username, and password, and the From address must be set for email to work. | ||
|
||
> **Warning**: If using `EMAIL_SERVICE`, **do NOT** set the extended connection parameters: | ||
> HOST, PORT, ENCRYPTION, ENCRYPTION_HOSTNAME, ALLOW_SELFSIGNED. | ||
> HOST, PORT, ENCRYPTION, ENCRYPTION_HOSTNAME, ALLOW_SELFSIGNED. | ||
> Failing to set valid values here will result in LibreChat using the unsecured password reset! | ||
See: **[nodemailer well-known-services](https://community.nodemailer.com/2-0-0-beta/setup-smtp/well-known-services/)** | ||
|
@@ -857,7 +879,7 @@ See: **[Firebase CDN Configuration](/docs/configuration/firebase)** | |
</Callout> | ||
|
||
<OptionTable | ||
options={[ | ||
options={[ | ||
['FIREBASE_API_KEY', 'string', 'The API key for your Firebase project.', 'FIREBASE_API_KEY='], | ||
['FIREBASE_AUTH_DOMAIN', 'string', 'The Firebase Auth domain for your project.', 'FIREBASE_AUTH_DOMAIN='], | ||
['FIREBASE_PROJECT_ID', 'string', 'The ID of your Firebase project.', 'FIREBASE_PROJECT_ID='], | ||
|
@@ -879,9 +901,13 @@ See: **[Firebase CDN Configuration](/docs/configuration/firebase)** | |
|
||
**Behaviour:** | ||
|
||
* If `HELP_AND_FAQ_URL` is empty or commented, the button is enabled. | ||
* If `HELP_AND_FAQ_URL` is set to a URL (e.g., `https://example.com`), the button is enabled and links to that URL. | ||
* If `HELP_AND_FAQ_URL` is set to `/`, the button is disabled. | ||
Sets the [Cache-Control](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) headers for static files. These configurations only trigger when the `NODE_ENV` is set to `production`. | ||
|
||
Properly setting cache headers is crucial for optimizing the performance and efficiency of your web application. By controlling how long browsers and CDNs store copies of your static files, you can significantly reduce server load, decrease page load times, and improve the overall user experience. | ||
|
||
* Uncomment `STATIC_CACHE_MAX_AGE` to change the `max-age` for static files. By default this is set to 4 weeks. | ||
* Uncomment `STATIC_CACHE_S_MAX_AGE` to change the `s-maxage` for static files. By default this is set to 1 week. | ||
- This is for the _shared cache_, which is used by CDNs and proxies. | ||
|
||
#### App Title and Footer | ||
|
||
|
@@ -942,4 +968,4 @@ LibreChat supports Google Tag Manager for analytics. You will need a Google Tag | |
['REDIS_URI', 'string', 'Redis URI.','# REDIS_URI='], | ||
['USE_REDIS', 'boolean', 'Use Redis.','# USE_REDIS='], | ||
]} | ||
/> | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters