Skip to content
Open
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
30 changes: 30 additions & 0 deletions pages/docs/configuration/cdn/azure.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,32 @@ fileStrategy: "azure_blob"

This setting tells LibreChat to use the Azure Blob Storage implementation provided in your code.

## 5. Optional: Setup lifecycle management for temporary files

Files uploaded during temporary conversations can be automatically cleared from Azure using lifecycle rules.

- Go to your storage account in Azure.
- Navigate to "Data Management" -> "Lifecycle management".
- Click "Add a rule."
- Details
- **Rule name**: LibreChat temporary file expiration
- **Rule scope**: Limit blobs with filters
- **Blob type**: Block blobs
- **Blob subtype**: Base blobs

![Screenshot of adding a lifecycle rule in Azure, demonstrating the "details" settings](/images/cdn/azure_rule_details.png)

- Base blobs
- **If**: base blobs were created more than (days ago): set to # of days you want temporary files to remain (default: 30)
- **Then**: Delete the blob

![Screenshot of adding a lifecycle rule in Azure, demonstrating the "base blobs" settings](/images/cdn/azure_rule_base_blobs.png)

- Filter set
- **Blob prefix**: "[YOUR_AZURE_CONTAINER_NAME]/tmp/" (by default, `AZURE_CONTAINER_NAME` is `files`)

![Screenshot of adding a lifecycle rule in Azure, demonstrating the "filter set" settings](/images/cdn/azure_rule_filter_set.png)

---

## Summary
Expand All @@ -107,6 +133,10 @@ In your `.env` file, set either:
4. **Configure LibreChat:**
Set `fileStrategy` to `"azure_blob"` in your `librechat.yaml` configuration file.

4. **Optional: Configure Temporary Blob Expiration:**
Add a lifecycle rule to Azure to expire any keys prefixed with `tmp/`.


With these steps, your LibreChat application will automatically create the container (if it doesn't exist) and manage file uploads, downloads, and deletions using Azure Blob Storage as your CDN. Managed Identity provides a secure alternative by eliminating the need for long-term credentials.

## Local Development with Azurite
Expand Down
40 changes: 25 additions & 15 deletions pages/docs/configuration/cdn/firebase.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ FIREBASE_APP_ID=1:your_app_id #appId
match /images/{userId}/{fileName} {
allow read, write: if true;
}
match /tmp/images/{userId}/{fileName} {
allow read, write: if true;
}
}
}
```
Expand All @@ -116,13 +119,28 @@ Finally, to enable the app use Firebase, you must set the following in your `lib

For more information about the `librechat.yaml` config file, see the guide here: [Custom Endpoints & Configuration](/docs/configuration/librechat_yaml).

<Callout type="warning" title="Export convos as png when using Firebase">
### Optional: Setup lifecycle rule for temporary files

### Step-by-Step Guide to Set Up CORS for Firebase Storage
Files uploaded during temporary conversations can be automatically cleared from Firebase using lifecycle rules.
(These rules are provided by the underlying Google Cloud Storage platform, not Firebase.)

---
- Go to your project in [Google Cloud Storage](https://console.cloud.google.com/storage).
- Open the "Buckets" tab, select your bucket.
- Go to "Lifecycle" tab.
- Click "Add a rule."
- **Action**: Delete object

![Screenshot of adding a lifecycle rule in Firebase, demonstrating the "action" setting](/images/cdn/firebase_rule_action.png)

- Object conditions
- **Object name matches prefix**: `tmp/`
- **Set Conditions**: "Age" to # of days you want temporary files to remain (default: 30)

![Screenshot of adding a lifecycle rule in Firebase, demonstrating the "object conditions" settings](/images/cdn/firebase_rule_object_conditions.png)

## Step-by-Step Guide to Set Up CORS for Firebase Storage

#### **Step 1: Create the CORS Configuration File**
### Step 1: Create the CORS Configuration File

- Open a text editor of your choice.
- Create a new file and name it `cors.json`.
Expand All @@ -139,9 +157,7 @@ For more information about the `librechat.yaml` config file, see the guide here:
```
- Save the file.

---

#### **Step 2: Apply the CORS Configuration**
### Step 2: Apply the CORS Configuration

- Open your terminal or command prompt.
- Navigate to the directory where you saved the `cors.json` file.
Expand All @@ -151,9 +167,7 @@ For more information about the `librechat.yaml` config file, see the guide here:
gsutil cors set cors.json gs://<your-cloud-storage-bucket>
```

---

#### **Step 3: Verify the CORS Settings**
### Step 3: Verify the CORS Settings

- To confirm that the CORS settings have been applied correctly, you can retrieve the current CORS configuration with the following command:

Expand All @@ -163,9 +177,7 @@ gsutil cors get gs://<your-cloud-storage-bucket>

- The output should reflect the settings you specified in the `cors.json` file.

---

#### **Step 4: Test the Configuration**
### Step 4: Test the Configuration

- Try exporting a convo as png from the allowed origin ("https://ai.example.com").
- If everything is set up correctly, you should not encounter any CORS issues.
Expand All @@ -177,5 +189,3 @@ gsutil cors get gs://<your-cloud-storage-bucket>
---

That's it! You've successfully configured CORS for your Firebase Storage bucket to allow requests from a specific origin. Remember to replace `<your-cloud-storage-bucket>` with your actual bucket name and `https://ai.example.com` with your own domain when applying the configuration.

</Callout>
18 changes: 18 additions & 0 deletions pages/docs/configuration/cdn/s3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,21 @@ fileStrategy: "s3"

This setting tells LibreChat to use the S3 implementation provided in your code.

## 5. Optional: Setup S3 lifecycle rule for temporary files

Files uploaded during temporary conversations can be automatically cleared from S3 using lifecycle rules.

- Go to your bucket in S3.
- Open the "Management" tab.
- Click "Create lifecycle rule."
- **Lifecycle rule name**: LibreChat temporary file expiration
- **Rule scope**: "Limit the scope of this rule using one or more filters"
- **Prefix**: `tmp/`
- **Lifecycle rule actions**: check "Expire current versions of objects"
- **Days after object creation**: set to # of days you want temporary files to remain (default: 30)

![Screenshot of adding the lifecycle rule in S3](/images/cdn/s3_lifecycle_rule.png)

## Summary

1. **Create an AWS Account & IAM User (or configure IRSA):**
Expand All @@ -130,6 +145,9 @@ This setting tells LibreChat to use the S3 implementation provided in your code.
4. **Configure LibreChat:**
- Set `fileStrategy` to `"s3"` in your `librechat.yaml` configuration file.

5. **Optional: Configure Temporary File Expiration**
- Add a lifecycle rule to S3 to expire any keys prefixed with `tmp/`.

With these steps, your LibreChat application will use Amazon S3 to handle file uploads, downloads, and deletions, leveraging S3 as your CDN for static assets. Additionally, with IRSA support, your application can run securely on Kubernetes without embedding long-term AWS credentials.

<Callout type="info" title="Note">
Expand Down
Binary file added public/images/cdn/azure_rule_base_blobs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/cdn/azure_rule_details.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/cdn/azure_rule_filter_set.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/cdn/firebase_rule_action.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/cdn/s3_lifecycle_rule.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.