From 21f678dd903588deba8fb973e52fc04c4b8f5ba3 Mon Sep 17 00:00:00 2001 From: Mendon Kissling <59585235+mendonk@users.noreply.github.com> Date: Fri, 1 Aug 2025 17:37:56 -0400 Subject: [PATCH] docs: kubernetes best practices and postgresql dba guide (#9226) * content * dba-style * kubernetes-best-practices * edits * spacing-cleanup * see-also * trailing-space * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * title-case-and-via * steps-for-intro * ha-postgres * dba-page * code-review * a-the * Apply suggestions from code review Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> * move-file-location * split-out-bp-page * cleanup-links * link * editorial - k8s dev and prod deployments * working on dba and best practices * finish best practices * fix link * finish dba and best practices * fix migration command --------- Co-authored-by: April I. Murphy <36110273+aimurphy@users.noreply.github.com> Co-authored-by: April M --- docs/docs/Components/bundles-ibm.mdx | 2 +- docs/docs/Concepts/concepts-flows-import.mdx | 2 +- .../configuration-custom-database.mdx | 1 + .../Deployment/deployment-architecture.mdx | 75 +++++ .../Deployment/deployment-kubernetes-dev.mdx | 79 +++-- .../Deployment/deployment-kubernetes-prod.mdx | 249 ++++++++------- .../deployment-prod-best-practices.mdx | 138 ++++++--- docs/docs/Develop/develop-application.mdx | 2 +- .../Develop/enterprise-database-guide.mdx | 286 ++++++++++++++++++ docs/docs/Develop/memory.mdx | 8 +- docs/sidebars.js | 14 +- 11 files changed, 666 insertions(+), 190 deletions(-) create mode 100644 docs/docs/Deployment/deployment-architecture.mdx create mode 100644 docs/docs/Develop/enterprise-database-guide.mdx diff --git a/docs/docs/Components/bundles-ibm.mdx b/docs/docs/Components/bundles-ibm.mdx index 78a1bd3e3..804d2be74 100644 --- a/docs/docs/Components/bundles-ibm.mdx +++ b/docs/docs/Components/bundles-ibm.mdx @@ -7,7 +7,7 @@ import Icon from "@site/src/components/icon"; [Bundles](/components-bundle-components) contain custom components that support specific third-party integrations with Langflow. -**IBM** bundle provides access to IBM watsonx.ai models for text and embedding generation. +The **IBM** bundle provides access to IBM watsonx.ai models for text and embedding generation. These components require an IBM watsonx.ai deployment and watsonx API credentials. ## IBM watsonx.ai diff --git a/docs/docs/Concepts/concepts-flows-import.mdx b/docs/docs/Concepts/concepts-flows-import.mdx index b7109c011..51e93162f 100644 --- a/docs/docs/Concepts/concepts-flows-import.mdx +++ b/docs/docs/Concepts/concepts-flows-import.mdx @@ -15,7 +15,7 @@ There are three ways to export flows: * **Export by sharing**: When editing a flow, click **Share**, and then click **Export**. -* **Export with the Langflow API**: To export one flow, use the [`/flows/download`](/api-flows#export-flows) endpoint. +* **Export with the Langflow API**: To export one flow, use the [`/flows/download`](/api-flows#export-flows) endpoint. To export all flows in a project, use the [`/projects/download`](/api-projects#export-a-project) endpoint. Exported flows are downloaded to your local machine as JSON files named `FLOW_NAME.json`. diff --git a/docs/docs/Configuration/configuration-custom-database.mdx b/docs/docs/Configuration/configuration-custom-database.mdx index 7bedd1da5..c1db6d43e 100644 --- a/docs/docs/Configuration/configuration-custom-database.mdx +++ b/docs/docs/Configuration/configuration-custom-database.mdx @@ -161,5 +161,6 @@ Since each Langflow instance runs in its own container on the Docker network, us ## See also +* [Langflow database guide for enterprise DBAs](/enterprise-database-guide) * [Memory management options](/memory) * [Logs](/logging) \ No newline at end of file diff --git a/docs/docs/Deployment/deployment-architecture.mdx b/docs/docs/Deployment/deployment-architecture.mdx new file mode 100644 index 000000000..0e1b75c48 --- /dev/null +++ b/docs/docs/Deployment/deployment-architecture.mdx @@ -0,0 +1,75 @@ +--- +title: Langflow architecture on Kubernetes +slug: /deployment-architecture +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +There are two broad types of Langflow deployments: + +* **Langflow IDE (development)**: Deploy both the Langflow visual editor (frontend) and API (backend). Typically, this is used for development environments where developers use the visual editor to create and manage flows before packaging and serving them through a production runtime deployment. + + The Langflow repository's example [`docker-compose.yml`](https://github.com/langflow-ai/langflow/blob/main/docker_example/docker-compose.yml) file builds a Langflow IDE image. + + For information about IDE deployments on Kubernetes, see [Deploy the Langflow development environment on Kubernetes](/deployment-kubernetes-dev). + + +* **Langflow runtime (production)**: Deploy the Langflow runtime for production flows, which is headless (backend only) service focused on serving the Langflow API. This is used for production environments where flows are executed programmatically without the need for the visual editor. The server exposes your flows as endpoints, and then runs only the processes necessary to serve each flow. + + An external PostgreSQL database is strongly recommended with this deployment type to improve scalability and reliability as compared to the default SQLite database. + + For information about runtime deployments on Kubernetes, see [Deploy the Langflow production environment on Kubernetes](/deployment-kubernetes-prod). + + :::tip + You can start Langflow in headless mode with the `LANGFLOW_BACKEND_ONLY` [environment variable](/environment-variables). + ::: + +You can also [deploy the Langflow IDE and runtime on Docker](/deployment-docker). + +## Benefits of deploying Langflow on Kubernetes + +Deploying on Kubernetes offers the following advantages: + +* **Scalability**: Kubernetes allows you to scale the Langflow service to meet the demands of your workload. +* **Availability and resilience**: Kubernetes provides built-in resilience features, such as automatic failover and self-healing, to ensure that the Langflow service is always available. +* **Security**: Kubernetes provides security features, such as role-based access control and network isolation, to protect the Langflow service and its data. +* **Portability**: Kubernetes is a portable platform, which means that you can deploy the Langflow service to any Kubernetes cluster, on-premises or in the cloud. + + Langflow can be deployed on cloud platforms like AWS EKS, Google GKE, or Azure AKS. For more information, see the [Langflow Helm charts repository](https://github.com/langflow-ai/langflow-helm-charts). + +## Langflow deployment + +A typical Langflow deployment includes: + +* **Langflow services**: The Langflow API and, for IDE deployments, the visual editor. +* **Kubernetes cluster**: The Kubernetes cluster provides a platform for deploying and managing Langflow and its supporting services. +* **Persistent storage**: Persistent storage is used to store the Langflow service's data, such as models and training data. +* **Ingress controller**: The ingress controller provides a single entry point for traffic to the Langflow service. +* **Load balancer**: Balances traffic across multiple Langflow replicas. +* **Vector database**: If you are using Langflow for RAG, you can integrate with the vector database in Astra Serverless. + +![Langflow reference architecture on Kubernetes](/img/langflow-reference-architecture.png) + +## Environment isolation + +It is recommended to deploy and run separate development and production environments for Langflow: + +* Deploy the IDE in your development environment where your developers prototype and test new flows. +* Deploy the runtime in your production environment to serve flows as standalone services. + +![Langflow environments](/img/langflow-env.png) + +This separation is designed to enhance security, support an organized software development pipeline, and optimize infrastructure resource allocation: + +* **Isolation**: By separating the development and production environments, you can better isolate different phases of the application lifecycle. This isolation minimizes the risk of development-related issues impacting the production environments. +* **Access control**: Different security policies and access controls can be applied to each environment. Developers may require broader access in the IDE for testing and debugging, while the runtime environment can be locked down with stricter security measures. +* **Reduced attack surface**: The runtime environment is configured to include only essential components, reducing the attack surface and potential vulnerabilities. +* **Optimized resource usage and cost efficiency**: By separating the two environments, you can allocate resources more effectively. Each flow can be deployed independently, providing fine-grained resource control. +* **Scalability**: The runtime environment can be scaled independently based on application load and performance requirements, without affecting the development environment. + +## Next steps + +* [Best practices for Langflow on Kubernetes](/deployment-prod-best-practices) +* [Deploy the Langflow development environment on Kubernetes](/deployment-kubernetes-dev) +* [Deploy the Langflow production environment on Kubernetes](/deployment-kubernetes-prod) \ No newline at end of file diff --git a/docs/docs/Deployment/deployment-kubernetes-dev.mdx b/docs/docs/Deployment/deployment-kubernetes-dev.mdx index c534bd3a7..4a657e6af 100644 --- a/docs/docs/Deployment/deployment-kubernetes-dev.mdx +++ b/docs/docs/Deployment/deployment-kubernetes-dev.mdx @@ -6,7 +6,7 @@ slug: /deployment-kubernetes-dev import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -The [Langflow Integrated Development Environment (IDE)](https://github.com/langflow-ai/langflow-helm-charts/tree/main/charts/langflow-ide) Helm chart is designed to provide a complete environment for developers to create, test, and debug their flows. It includes both the API and the visual editor. +The [Langflow integrated development environment (IDE) Helm chart](https://github.com/langflow-ai/langflow-helm-charts/tree/main/charts/langflow-ide) is designed to provide a complete environment for developers to create, test, and debug their flows. It includes both the Langflow API and visual editor. ## Prerequisites @@ -18,13 +18,13 @@ The [Langflow Integrated Development Environment (IDE)](https://github.com/langf This example uses [Minikube](https://minikube.sigs.k8s.io/docs/start/), but you can use any Kubernetes cluster. -1. Create a Kubernetes cluster on Minikube. +1. Create a Kubernetes cluster on Minikube: ```shell minikube start ``` -2. Set `kubectl` to use Minikube. +2. Set `kubectl` to use Minikube: ```shell kubectl config use-context minikube @@ -32,20 +32,20 @@ This example uses [Minikube](https://minikube.sigs.k8s.io/docs/start/), but you ## Install the Langflow IDE Helm chart -1. Add the repository to Helm and update it. +1. Add the repository to Helm, and then update it: ```shell helm repo add langflow https://langflow-ai.github.io/langflow-helm-charts helm repo update ``` -2. Install Langflow with the default options in the `langflow` namespace. +2. Install Langflow with the default options in the `langflow` namespace: ```shell helm install langflow-ide langflow/langflow-ide -n langflow --create-namespace ``` -3. Check the status of the pods. +3. Check the status of the pods: ```shell kubectl get pods -n langflow @@ -53,28 +53,38 @@ This example uses [Minikube](https://minikube.sigs.k8s.io/docs/start/), but you ## Access the Langflow IDE -Enable local port forwarding to access Langflow from your local machine. +Enable local port forwarding to access Langflow from your local machine: -1. To make the Langflow API accessible from your local machine at port 7860: -```shell -kubectl port-forward -n langflow svc/langflow-service-backend 7860:7860 -``` +1. Make the Langflow API accessible from your local machine at port 7860: -2. To make the visual editor accessible from your local machine at port 8080: + ```shell + kubectl port-forward -n langflow svc/langflow-service-backend 7860:7860 + ``` -```shell -kubectl port-forward -n langflow svc/langflow-service 8080:8080 -``` +2. Make the visual editor accessible from your local machine at port 8080: + + ```shell + kubectl port-forward -n langflow svc/langflow-service 8080:8080 + ``` Now you can do the following: + - Access the Langflow API at `http://localhost:7860`. - Access the visual editor at `http://localhost:8080`. -## Configure the Langflow version +## Modify your Langflow IDE deployment -Langflow is deployed with the `latest` version by default. +You can modify the Langflow IDE Helm chart's [`values.yaml`](https://github.com/langflow-ai/langflow-helm-charts/blob/main/charts/langflow-ide/values.yaml) file to customize your deployment. +The following sections describe some common modifications. -To specify a different Langflow version, set the `langflow.backend.image.tag` and `langflow.frontend.image.tag` values in the [values.yaml](https://github.com/langflow-ai/langflow-helm-charts/blob/main/charts/langflow-ide/values.yaml) file. +If you need to set secrets, Kubernetes secrets are recommended. + +### Deploy a different Langflow version + +The Langflow IDE Helm chart deploys the latest Langflow version by default. + +To specify a different Langflow version, set the `langflow.backend.image.tag` and `langflow.frontend.image.tag` values to your preferred version. +For example: ```yaml langflow: @@ -86,11 +96,17 @@ langflow: tag: "1.0.0a59" ``` -## Configure external storage +### Use external storage for the Langflow database -By default, the chart deploys a SQLite database stored in a local persistent disk. If you want to use an external PostgreSQL database, you can configure it in two ways: +The Langflow IDE Helm chart uses the default Langflow database configuration, specifically a SQLite database stored in a local persistent disk. + +If you want to use an [external PostgreSQL database](/configuration-custom-database), use `postgresql` chart or `externalDatabase` to configure the database connection in `values.yaml`. + + + + +Use the built-in PostgreSQL chart: -* Use the built-in PostgreSQL chart: ```yaml postgresql: enabled: true @@ -100,7 +116,11 @@ postgresql: database: "langflow-db" ``` -* Use an external database: + + + +If you don't want to use the built-in PostgreSQL chart, set `postgresql.enabled` to `false`, and then configure the database connection in `langflow.backend.externalDatabase`: + ```yaml postgresql: enabled: false @@ -126,9 +146,14 @@ langflow: enabled: false ``` -## Configure scaling + + -Scale the number of replicas and resources for both frontend and backend services: +### Configure scaling + +To configure scaling for the Langflow IDE Helm chart deployment, you must set `replicaCount` (horizontal scaling) and `resources` (vertical scaling) for both the `langflow.backend` and `langflow.frontend`. + +If your flows rely on a shared state, such as [built-in chat memory](/memory), you must also set up a shared database when scaling horizontally. ```yaml langflow: @@ -154,8 +179,8 @@ langflow: # memory: 512Mi ``` -If your flow relies on a shared state, such as built-in chat memory, you need to set up a shared database when scaling horizontally. - ## See also -For more examples of `langflow-ide` deployment, see the [Langflow Helm Charts repository](https://github.com/langflow-ai/langflow-helm-charts/tree/main/examples/langflow-ide). \ No newline at end of file +* [Best practices for Langflow on Kubernetes](/deployment-prod-best-practices) +* [Deploy the Langflow production environment on Kubernetes](/deployment-kubernetes-prod) +* [Langflow Helm Charts repository](https://github.com/langflow-ai/langflow-helm-charts) \ No newline at end of file diff --git a/docs/docs/Deployment/deployment-kubernetes-prod.mdx b/docs/docs/Deployment/deployment-kubernetes-prod.mdx index 4bcfef5f3..c9e374019 100644 --- a/docs/docs/Deployment/deployment-kubernetes-prod.mdx +++ b/docs/docs/Deployment/deployment-kubernetes-prod.mdx @@ -6,160 +6,176 @@ slug: /deployment-kubernetes-prod import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -The [Langflow Runtime](https://github.com/langflow-ai/langflow-helm-charts/blob/main/charts/langflow-runtime) chart is tailored for deploying applications in a production environment. It is focused on stability, performance, isolation, and security to ensure that applications run reliably and efficiently. +The [Langflow runtime Helm chart](https://github.com/langflow-ai/langflow-helm-charts/blob/main/charts/langflow-runtime) is tailored for deploying applications in a production environment. It is focused on stability, performance, isolation, and security to ensure that applications run reliably and efficiently. :::important -By default, the [Langflow runtime Helm chart](https://github.com/langflow-ai/langflow-helm-charts/blob/main/charts/langflow-runtime/values.yaml#L46) enables `readOnlyRootFilesystem: true` as a security best practice. This setting prevents modifications to the container's root filesystem at runtime, which is a recommended security measure in production environments. +For security reasons, the default Langflow runtime Helm chart sets [`readOnlyRootFilesystem: true`](https://github.com/langflow-ai/langflow-helm-charts/blob/main/charts/langflow-runtime/values.yaml#L46). This setting prevents modifications to the container's root filesystem at runtime, which is a recommended security measure in production environments. -Disabling `readOnlyRootFilesystem` reduces the security of your deployment. Only disable this setting if you understand the security implications and have implemented other security measures. +If `readOnlyRootFilesystem` is disabled (`false`), it degrades your deployment's security posture. Only disable this setting if you understand the security implications and you have implemented other security measures. For more information, see the [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/). ::: -### Prerequisites +## Prerequisites - A [Kubernetes](https://kubernetes.io/docs/setup/) server - [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl) - [Helm](https://helm.sh/docs/intro/install/) -### Install the Langflow runtime Helm chart +## Install the Langflow runtime Helm chart -1. Add the repository to Helm. +1. Add the repository to Helm: -```shell -helm repo add langflow https://langflow-ai.github.io/langflow-helm-charts -helm repo update -``` + ```shell + helm repo add langflow https://langflow-ai.github.io/langflow-helm-charts + helm repo update + ``` 2. Install the Langflow app with the default options in the `langflow` namespace. -If you have a created a [custom image with packaged flows](/deployment-docker#package-your-flow-as-a-docker-image), you can deploy Langflow by overriding the default [values.yaml](https://github.com/langflow-ai/langflow-helm-charts/blob/main/charts/langflow-runtime/values.yaml) file with the `--set` flag. + + -* Use a custom image with bundled flows: -```shell -helm install my-langflow-app langflow/langflow-runtime -n langflow --create-namespace --set image.repository=myuser/langflow-hello-world --set image.tag=1.0.0 -``` + If you have a [custom image with packaged flows](/deployment-docker#package-your-flow-as-a-docker-image), you can deploy Langflow by overriding the default [`values.yaml`](https://github.com/langflow-ai/langflow-helm-charts/blob/main/charts/langflow-runtime/values.yaml) with the `--set` flag: -* Alternatively, install the chart and download the flows from a URL with the `--set` flag: -```shell -helm install my-langflow-app-with-flow langflow/langflow-runtime \ - -n langflow \ - --create-namespace \ - --set 'downloadFlows.flows[0].url=https://raw.githubusercontent.com/langflow-ai/langflow/dev/tests/data/basic_example.json' -``` + ```shell + helm install my-langflow-app langflow/langflow-runtime -n langflow --create-namespace --set image.repository=myuser/langflow-hello-world --set image.tag=1.0.0 + ``` -:::important -You may need to escape the square brackets in this command if you are using a shell that requires it: -```shell -helm install my-langflow-app-with-flow langflow/langflow-runtime \ - -n langflow \ - --create-namespace \ - --set 'downloadFlows.flows\[0\].url=https://raw.githubusercontent.com/langflow-ai/langflow/dev/tests/data/basic_example.json' -``` -::: + + -3. Check the status of the pods. -```shell -kubectl get pods -n langflow -``` + Install the chart and download flows from a URL with the `--set` flag: -### Access the Langflow runtime + ```shell + helm install my-langflow-app-with-flow langflow/langflow-runtime \ + -n langflow \ + --create-namespace \ + --set 'downloadFlows.flows[0].url=https://raw.githubusercontent.com/langflow-ai/langflow/dev/tests/data/basic_example.json' + ``` -1. Get your service name. -```shell -kubectl get svc -n langflow -``` + If your shell requires escaping square brackets, modify the `--set` path as needed. + For example, `--set 'downloadFlows.flows\[0\].url=https://raw.githubusercontent.com/langflow-ai/langflow/dev/tests/data/basic_example.json'`. -The service name is your release name followed by `-langflow-runtime`. For example, if you used `helm install my-langflow-app-with-flow` the service name is `my-langflow-app-with-flow-langflow-runtime`. + + + +3. Check the status of the pods: + + ```shell + kubectl get pods -n langflow + ``` + +## Access the Langflow runtime + +1. Get your service name: + + ```shell + kubectl get svc -n langflow + ``` + + The service name is your release name suffixed by `-langflow-runtime`. For example, if you used `helm install my-langflow-app-with-flow`, then the service name is `my-langflow-app-with-flow-langflow-runtime`. 2. Enable port forwarding to access Langflow from your local machine: -```shell -kubectl port-forward -n langflow svc/my-langflow-app-with-flow-langflow-runtime 7860:7860 -``` + ```shell + kubectl port-forward -n langflow svc/my-langflow-app-with-flow-langflow-runtime 7860:7860 + ``` -3. Confirm you can access the API at `http://localhost:7860/api/v1/flows/` and view a list of flows. -```shell -curl -v http://localhost:7860/api/v1/flows/ -``` +3. Confirm you can access the API by calling `http://localhost:7860/api/v1/flows/`: -4. Execute the packaged flow. + ```shell + curl -v http://localhost:7860/api/v1/flows/ + ``` -The following command gets the first flow ID from the flows list and runs the flow. + A successful request returns a list of flows. -```shell -# Get flow ID -id=$(curl -s "http://localhost:7860/api/v1/flows/" | jq -r '.[0].id') +4. Run a packaged flow. +The following example gets the first flow ID from the flows list, and then runs the flow: -# Run flow -curl -X POST \ - "http://localhost:7860/api/v1/run/$id?stream=false" \ - -H 'Content-Type: application/json' \ - -d '{ - "input_value": "Hello!", - "output_type": "chat", - "input_type": "chat" - }' -``` + ```shell + # Get flow ID + id=$(curl -s "http://localhost:7860/api/v1/flows/" | jq -r '.[0].id') -### Configure secrets + # Run flow + curl -X POST \ + "http://localhost:7860/api/v1/run/$id?stream=false" \ + -H 'Content-Type: application/json' \ + -d '{ + "input_value": "Hello!", + "output_type": "chat", + "input_type": "chat" + }' + ``` -To inject secrets and Langflow global variables, use the `secrets` and `env` sections in the [values.yaml](https://github.com/langflow-ai/langflow-helm-charts/blob/main/charts/langflow-runtime/values.yaml) file. +## Configure secrets and environment variables -For example, the [example flow JSON](https://raw.githubusercontent.com/langflow-ai/langflow-helm-charts/refs/heads/main/examples/flows/basic-prompting-hello-world.json) uses a global variable that is a secret. When you export the flow as JSON, it's recommended to not include the secret. +Use the `.env` section of the Langflow runtime Helm chart's [`values.yaml`](https://github.com/langflow-ai/langflow-helm-charts/blob/main/charts/langflow-runtime/values.yaml) file to define environment variables for your Langflow deployment. +This includes built-in [Langflow environment variables](/environment-variables), as well as [global variables](/configuration-global-variables) used by your flows. -Instead, when importing the flow in the Langflow runtime, you can set the global variable in one of the following ways: +Langflow can source global variables from your runtime environment, such as Kubernetes secrets referenced in `values.yaml`. +For example, the Langflow runtime Helm chart's [example flow JSON](https://raw.githubusercontent.com/langflow-ai/langflow-helm-charts/refs/heads/main/examples/flows/basic-prompting-hello-world.json) uses a global variable that is a secret. +If you want to run this flow in your Langflow deployment on Kubernetes, you need to include the secret in your runtime configuration. - - +:::tip +When you export flows as JSON files, it's recommended to omit secrets. +Whether or not a secret is included depends on how you declare the secret in your flow and whether you use the **Save with my API keys** option. +For more information, see [Import and export flows](/concepts-flows-import). +::: + +### Set secrets + +Kubernetes secrets are the recommended way to store sensitive values and credentials. + +Use `secretKeyRef` to reference a Kubernetes secret in `values.yaml`: ```yaml env: - - name: openai_key_var + - name: OPENAI_API_KEY valueFrom: secretKeyRef: - name: openai-key + name: openai-credentials key: openai-key ``` -Or directly in the values file (not recommended for secret values): +
+Create and set secrets with `kubectl` and `helm` -```yaml -env: - - name: openai_key_var - value: "sk-...." -``` +You can use `kubectl` and `helm` commands to create and set secrets: - - +1. Create a secret: -1. Create the secret: -```shell -kubectl create secret generic openai-credentials \ - --namespace langflow \ - --from-literal=OPENAI_API_KEY=sk... -``` + ```shell + kubectl create secret generic openai-credentials \ + --namespace langflow \ + --from-literal=OPENAI_API_KEY=sk... + ``` -2. Verify the secret exists. The result is encrypted. -```shell -kubectl get secrets -n langflow openai-credentials -``` +2. Verify the secret exists: -3. Upgrade the Helm release to use the secret. -```shell -helm upgrade my-langflow-app-image langflow/langflow-runtime -n langflow \ - --reuse-values \ - --set "extraEnv[0].name=OPENAI_API_KEY" \ - --set "extraEnv[0].valueFrom.secretKeyRef.name=openai-credentials" \ - --set "extraEnv[0].valueFrom.secretKeyRef.key=OPENAI_API_KEY" -``` + ```shell + kubectl get secrets -n langflow openai-credentials + ``` - - + The result is encrypted. -### Configure the log level +3. Upgrade the Helm release to use the secret: -Set the log level and other Langflow configurations in the [values.yaml](https://github.com/langflow-ai/langflow-helm-charts/blob/main/charts/langflow-runtime/values.yaml) file. + ```shell + helm upgrade my-langflow-app-image langflow/langflow-runtime -n langflow \ + --reuse-values \ + --set "extraEnv[0].name=OPENAI_API_KEY" \ + --set "extraEnv[0].valueFrom.secretKeyRef.name=openai-credentials" \ + --set "extraEnv[0].valueFrom.secretKeyRef.key=OPENAI_API_KEY" + ``` + + Escape square brackets if required by your shell. + +
+ +### Set the log level and other configuration variables + +For non-sensitive variables, such as `LANGFLOW_LOG_LEVEL`, you can set the value directly in `values.yaml`: ```yaml env: @@ -167,25 +183,26 @@ env: value: "INFO" ``` -### Configure scaling +## Configure scaling -To scale the number of replicas for the Langflow appplication, change the `replicaCount` value in the [values.yaml](https://github.com/langflow-ai/langflow-helm-charts/blob/main/charts/langflow-runtime/values.yaml) file. +Use `replicaCount` and `resources` in the Langflow runtime Helm chart's [`values.yaml`](https://github.com/langflow-ai/langflow-helm-charts/blob/main/charts/langflow-runtime/values.yaml) file to configure scaling: -```yaml -replicaCount: 3 -``` +* **Horizontal scaling**: Use `replicaCount` to set the number of replicas for your Langflow deployment. -To scale the application vertically by increasing the resources for the pods, change the `resources` values in the [values.yaml](https://github.com/langflow-ai/langflow-helm-charts/blob/main/charts/langflow-runtime/values.yaml) file. - -```yaml -resources: - requests: - memory: "2Gi" - cpu: "1000m" -``` - -For more information about deploying Langflow on AWS EKS, Google GKE, or Azure AKS, see the [Langflow Helm Charts repository](https://github.com/langflow-ai/langflow-helm-charts). + ```yaml + replicaCount: 3 + ``` +* **Vertical scaling**: Use the `resources` section to adjust pod resources depending on your application's needs. + ```yaml + resources: + requests: + memory: "2Gi" + cpu: "1000m" + ``` +## See also +* [Best practices for Langflow on Kubernetes](/deployment-prod-best-practices) +* [Langflow Helm Charts repository](https://github.com/langflow-ai/langflow-helm-charts) \ No newline at end of file diff --git a/docs/docs/Deployment/deployment-prod-best-practices.mdx b/docs/docs/Deployment/deployment-prod-best-practices.mdx index 83601a666..da8a75a2a 100644 --- a/docs/docs/Deployment/deployment-prod-best-practices.mdx +++ b/docs/docs/Deployment/deployment-prod-best-practices.mdx @@ -1,59 +1,121 @@ --- -title: Langflow architecture and best practices on Kubernetes +title: Best practices for Langflow on Kubernetes slug: /deployment-prod-best-practices --- -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; +This guide provides best practices for deploying Langflow in production environments on Kubernetes. -Langflow can be deployed in two distinct environments. +## Resources and scaling -* [**Langflow IDE**](/deployment-kubernetes-dev): The **Langflow IDE** includes the frontend for visual development of your flow. The default [docker-compose.yml](https://github.com/langflow-ai/langflow/blob/main/docker_example/docker-compose.yml) file hosted in the Langflow repository builds the Langflow IDE image. The Langflow IDE can be deployed on [Docker](/deployment-docker) or [Kubernetes](/deployment-kubernetes-dev). -* [**Langflow runtime**](/deployment-kubernetes-prod): The **Langflow runtime** is a headless or backend-only mode. The server exposes your flow as an endpoint, and runs only the processes necessary to serve your flow, with PostgreSQL as the database for improved scalability. Use the Langflow **runtime** to deploy your flows if you don't require the frontend for visual development. The Langflow runtime can be deployed on [Docker](/deployment-docker) or [Kubernetes](/deployment-kubernetes-prod). +Langflow's minimum resource requirements vary by deployment type: -:::tip -You can start Langflow in headless mode with the `LANGFLOW_BACKEND_ONLY` [environment variable](/environment-variables). -::: +* **IDE (development)**: Deploy both the Langflow visual editor (frontend) and API (backend). Typically, this is used for development environments where developers use the visual editor to create and manage flows before packaging and serving them through a production runtime deployment. -Deploying on Kubernetes offers the following advantages: + The frontend service requires a minimum of 512Mi RAM and 0.3 CPU per instance with 1 replica. -* **Scalability**: Kubernetes allows you to scale the Langflow service to meet the demands of your workload. -* **Availability and resilience**: Kubernetes provides built-in resilience features, such as automatic failover and self-healing, to ensure that the Langflow service is always available. -* **Security**: Kubernetes provides security features, such as role-based access control and network isolation, to protect the Langflow service and its data. -* **Portability**: Kubernetes is a portable platform, which means that you can deploy the Langflow service to any Kubernetes cluster, on-premises or in the cloud. + The backend service requires a minimum of 1Gi RAM and 0.5 CPU per instance with 1 replica. -Langflow can be deployed on cloud deployments like **AWS EKS, Google GKE, or Azure AKS**. For more information about deploying Langflow on AWS EKS, Google GKE, or Azure AKS, see the [Langflow Helm charts repository](https://github.com/langflow-ai/langflow-helm-charts). +* **Runtime (production)**: Deploy the Langflow runtime for production flows, which is headless (backend only) service focused on serving the Langflow API. This is used for production environments where flows are executed programmatically without the need for the visual editor. -## Langflow deployment + Minimum requirements include 2Gi RAM and 1000m (1 CPU) per instance with 3 replicas. -A typical Langflow deployment includes: +For more information about Langflow deployment types, see [Langflow architecture on Kubernetes](/deployment-architecture). -* **Langflow API and visual editor**: The Langflow service is the core part of the Langflow platform. It provides a RESTful API for executing flows. -* **Kubernetes cluster**: The Kubernetes cluster provides a platform for deploying and managing the Langflow service and supporting services. -* **Persistent storage**: Persistent storage is used to store the Langflow service's data, such as models and training data. -* **Ingress controller**: The ingress controller provides a single entry point for traffic to the Langflow service. -* **Load balancer**: Balances traffic across multiple Langflow replicas. -* **Vector database**: If you are using Langflow for RAG, you can integrate with the vector database in Astra Serverless. +### Estimate, test, and adjust -![Langflow reference architecture on Kubernetes](/img/langflow-reference-architecture.png) +Start with the minimum recommended resources and replicas, then monitor and scale as needed based on your deployment's requirements and performance testing. +Consider the following factors in your resource estimation and performance testing: -## Environment isolation +* Flow complexity. +* Volume of concurrent users and requests. -It is recommended to deploy and run two separate environments for Langflow, with one environment reserved for development use and another for production use. + For IDE (development) deployments, consider that frontend activity also pings the backend service, so you typically need to scale both the frontend and backend together. -![Langflow environments](/img/langflow-env.png) +* Request payload content and size, particularly for file uploads in production deployments. +* Storage requirements for cache, file management, and the Langflow database. -* **The Langflow development environment** must include the Integrated Development Environment (IDE) for the full experience of Langflow, optimized for prototyping and testing new flows. -* **The Langflow production environment** executes the flow logic in production and enables Langflow flows as standalone services. + An [external PostgreSQL database](#use-an-external-postgresql-database) is recommended for production deployments. -## Why is it important to have separate deployments? +* Infrastructure options that might require more resources, such as multi-core CPUs. -This separation is designed to enhance security, optimize resource allocation, and streamline management. +### Use an external PostgreSQL database -* **Security** - * **Isolation**: By separating the development and production environments, you can better isolate different phases of the application lifecycle. This isolation minimizes the risk of development-related issues impacting the production environments. - * **Access control**: Different security policies and access controls can be applied to each environment. Developers may require broader access in the IDE for testing and debugging, while the runtime environment can be locked down with stricter security measures. - * **Reduced attack surface**: The runtime environment is configured to include only essential parts, reducing the attack surface and potential vulnerabilities. -* **Resource allocation** - * **Optimized resource usage and cost efficiency**: By separating the two environments, you can allocate resources more effectively. Each flow can be deployed independently, providing fine-grained resource control. - * **Scalability**: The runtime environment can be scaled independently based on application load and performance requirements, without affecting the development environment. +An external PostgreSQL database is recommended for production deployments to improve scalability and reliability as compared to the default SQLite database. + +Your resource allocation and replication strategy must be able to support the PostgreSQL service and storage. +For example, for a runtime (production) deployment, you might allocate 4Gi RAM, 2 CPU, and multiple replicas for high availability. +Tune PostgreSQL parameters, such as `work_mem` and `shared_buffers`, as needed based on resource requirements and usage metrics. + +Recommended configurations include: + +* Persistent storage to prevent data loss on container shutdown +* High Availability (HA) or Active-Active for automatic failover, scaling, and load balancing +* Shared databases for multi-instance deployments +* Shared storage, such as NFS or cloud storage, for multi-instance deployments to access large files stored on disk, such as in `/opt/langflow/data/`. + +For more information, see [Configure an external PostgreSQL database](/configuration-custom-database) and [Langflow database guide for enterprise DBAs](/enterprise-database-guide). + +### Use HPA for dynamic scaling + +Load balancing and dynamic scaling are recommended for runtime (production) deployments. + +For example, consider using Horizontal Pod Autoscaler (HPA) in Kubernetes to dynamically scale based on CPU or memory usage. +The following example shows a Langflow HPA configuration with CPU-based scaling: + +```yaml +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: langflow-runtime-hpa +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: langflow-runtime + minReplicas: 1 + maxReplicas: 10 + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 80 +``` + +## Failure points + +Langflow's reliability in production depends on mitigating key failure points, particularly around the database, file system, and instance availability: + +* **Database failures**: See [Langflow database guide for enterprise DBAs](/enterprise-database-guide). +* **File system failures**: Concurrency issues in file caching, such as `/app/data/.cache`, can cause IO errors in multi-instance setups. +To avoid this, use a shared, POSIX-compliant file system or cloud storage. +Use persistent volumes instead of ramdisk solutions that result in data loss on container shutdown. +* **Instance failures**: Deploy multiple replicas to avoid service disruptions when a single instance fails. Use health checks to detect and replace failed pods. +* **Network and dependency failures**: External APIs or services used in flows may fail, causing flow errors. Implement retry logic and error handling in flows or application code. Monitor network latency and dependency health. + +## Monitoring + +Effective monitoring ensures Langflow operates reliably and performs well under varying loads: + +* **Database monitoring**: See [Langflow database guide for enterprise DBAs](/enterprise-database-guide). +* **Application logs**: Collect and analyze logs for errors, warnings, and flow execution issues. Centralize logs using tools like ELK Stack or Fluentd. You can also inspect [Langflow logs](/logging). +* **Resource usage**: Track CPU, memory, and disk usage of Langflow instances. Use Prometheus and Grafana for real-time metrics collection and monitoring in Kubernetes. +* **API performance**: Monitor response times, error rates, and request throughput. Set alerts for high latency or error spikes. +* **Observability tools**: Integrate with [LangWatch](/integrations-langwatch) or [Opik](/integrations-opik) for detailed flow tracing and metrics. Use these tools to debug flow performance and optimize execution. + +## Security + +Running Langflow in production requires robust security measures to protect the application, data, and users. +Follow industry best practices and use secure Langflow configurations, such as the following: + +* **Container security**: Apply security best practices for containerized applications. For example, set `readOnlyRootFilesystem: true` in runtime (production) containers to prevent unauthorized modifications. Restrict access to files and codebases containing sensitive data and configuration files that shouldn't be exposed to unauthorized users. +* **Secrets management**: Store sensitive data like API keys and PostgreSQL credentials in Kubernetes secrets or external secrets managers like HashiCorp Vault. +* **Authentication, authorization, and access control**: Start your Langflow server with authentication enabled, as explained in [API keys and authentication](/api-keys-and-authentication). Restrict network and resource access with firewalls, network policies, network security groups, or VPCs. For example, restrict PostgreSQL database access to Langflow instances. +* **Encryption and privacy**: Follow industry best practices and legal requirements for data privacy and encryption of data in transit and at rest, including GDPR requirements, HTTPS, TLS, and SSL. For example, configure PostgreSQL with valid SSL certificates and append `?sslmode=require` or `?sslmode=verify-full` to the connection string to enable SSL for database connections. +* **Security posture maintenance**: Conduct regular security audits, keep current with software updates, and monitor for suspicious activity using intrusion detection systems. + +## See also + +* [Deploy the Langflow production environment on Kubernetes](/deployment-kubernetes-prod) +* [Langflow Helm Charts repository](https://github.com/langflow-ai/langflow-helm-charts) \ No newline at end of file diff --git a/docs/docs/Develop/develop-application.mdx b/docs/docs/Develop/develop-application.mdx index c1aa8be89..ee28cb8ee 100644 --- a/docs/docs/Develop/develop-application.mdx +++ b/docs/docs/Develop/develop-application.mdx @@ -236,4 +236,4 @@ For more information about deploying Langflow, see the following: * [Learn about Langflow deployments](/deployment-overview) * [Deploy Langflow on Docker](/deployment-docker) -* [Deploy your application to Kubernetes](/deployment-kubernetes-prod) \ No newline at end of file +* [Deploy the Langflow production environment on Kubernetes](/deployment-kubernetes-prod) \ No newline at end of file diff --git a/docs/docs/Develop/enterprise-database-guide.mdx b/docs/docs/Develop/enterprise-database-guide.mdx new file mode 100644 index 000000000..8c6a38564 --- /dev/null +++ b/docs/docs/Develop/enterprise-database-guide.mdx @@ -0,0 +1,286 @@ +--- +title: Langflow database guide for enterprise DBAs +slug: /enterprise-database-guide +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +The Langflow database stores data that is essential for more Langflow operations, including startup, flow execution, user interactions, and administrative tasks. +The database supports both frontend (visual editor) and backend (API) operations, making its availability critical to Langflow's stability and functionality. +For details about the database schema, see [Memory management options](/memory). + +This guide is designed for enterprise database administrators (DBAs) and operators responsible for deploying and managing Langflow in production environments. +It explains how to configure Langflow to use PostgreSQL, including high availability (HA) and active-active configurations, as well as best practices for monitoring, maintenance, and security. + +## Configure Langflow with PostgreSQL + +Langflow's default database is SQLite. +However, PostgreSQL is recommended for production deployments due to its scalability, performance, and robustness. + +The following steps explain how to configure Langflow to use PostgreSQL for a standalone or containerized deployment. +For more information, see [Configure an external PostgreSQL database](/configuration-custom-database). + +1. Set up PostgreSQL: + + 1. Deploy a PostgreSQL instance (version 12 or higher recommended) using a local server, Docker, or a managed cloud service. + 2. Create a database for Langflow. + 3. Create a PostgreSQL user with appropriate, minimal permissions to manage and write to the database, such as CREATE, SELECT, INSERT, UPDATE, DELETE on your Langflow tables. + +2. Obtain the connection string in the format `postgresql://user:password@host:port/dbname`, such as`postgresql://langflow:securepassword@postgres:5432/langflow`. + + For High Availability, use the virtual IP or proxy hostname instead of the direct database host. + For more information, see [High Availability for PostgreSQL](#high-availability-for-postgresql). + +3. Configure Langflow with the `.env` or `docker-compose.yml` files. + + + + + 1. Create a `.env` file in the `langflow` directory: + + ```shell + touch .env + ``` + + 2. Add the connection string to the `.env` file: + + ```text + LANGFLOW_DATABASE_URL="postgresql://langflow:securepassword@postgres:5432/langflow" + ``` + + For more environment variables, see the `.env.example` file in the Langflow repository. + + + + + Use the sample `docker-compose.yml` from the Langflow Repository. + You can use the default values or customize them as needed. + + ```yaml + version: '3' + services: + langflow: + image: langflowai/langflow:latest + ports: + - "7860:7860" + environment: + - LANGFLOW_DATABASE_URL=postgresql://langflow:langflow@postgres:5432/langflow + postgres: + image: postgres:16 + ports: + - "5432:5432" + environment: + - POSTGRES_USER=langflow + - POSTGRES_PASSWORD=langflow + - POSTGRES_DB=langflow + volumes: + - langflow-postgres:/var/lib/postgresql/data + volumes: + - langflow-postgres: + ``` + + + + + +4. Start Langflow with your PostgreSQL connection: + + + + + ```shell + uv run langflow run --env-file .env + ``` + + + + + Navigate to the directory containing `docker-compose.yml`, and then run `docker-compose up`. + + + + +5. Optional: Run migrations. + + Langflow, through SQLAlchemy and Alembic, uses migrations to manage its database schema. + Avoid manual schema changes to prevent conflicts with Langflow's built-in schema management. + + When you first connect to PostgreSQL, Langflow automatically runs migrations to create the necessary tables. + + To manually run migrations, run `langflow migration` to preview the changes, and then run `langflow migration --fix` to apply the changes. + + :::danger + Migrations are a destructive operation that can delete data. + Always run `langflow migration` first to preview changes before applying them with `--fix`. + For more information, see [Langflow CLI](/configuration-cli). + ::: + +6. To verify the configuration, create any flow using the Langflow visual editor or API, and then query your database to confirm the tables and activity are recorded there. The content of the flow doesn't matter; you only need to confirm that the flow is stored in your PostgreSQL database. +You can query the database in two ways: + + * Query the database container: + + ``` + docker exec -it psql -U langflow -d langflow + ``` + + * Use SQL: + + ``` + SELECT * FROM pg_stat_activity WHERE datname = 'langflow'; + ``` + +### High Availability for PostgreSQL {#high-availability-for-postgresql} + +To further improve performance, reliability, and scalability, use a High Availability (HA) or Active-Active HA PostgreSQL configuration. +This is recommended for production deployments to minimize downtime and ensure continuous operations if your database server fails, especially when multiple Langflow instances rely on the same database. + + + + +1. Set up streaming replication: + + 1. Configure one primary database for writes. + 2. Configure one or more replicas for reads and failover. + + Select either synchronous or asynchronous replication based on your latency and consistency requirements. + +2. Implement automatic failover using one of the following options: + + * Use an HA orchestrator, distributed configuration store, and traffic router, such as [Patroni](https://patroni.readthedocs.io/en/latest/), etcd or [Consul](https://developer.hashicorp.com/consul), and [HAProxy](https://www.haproxy.org/). + * Use [Pgpool-II](https://www.pgpool.net/docs/46/en/html/index.html) alone or add supporting services for more robust HA support. + * Use managed services that provide built-in HA with automatic failover, such as AWS RDS or Google Cloud SQL. + +3. Update your PostgreSQL connection string to point to the HA setup. +If you have a multi-instance deployment, make sure all of your Langflow instances connect to the same HA PostgreSQL database. + + The connection string you use depends on your HA configuration and services. + + * Use a virtual IP or DNS name that resolves to the current primary database, such as `postgresql://langflow:securepassword@db-proxy:5432/langflow?sslmode=require`. + * Use the provided endpoint for a managed service, such as `langflow.cluster-xyz.us-east-1.rds.amazonaws.com`. + +4. Optional: Implement load balancing for read-heavy workloads: + + 1. Use a connection pooler like [PgBouncer](https://www.pgbouncer.org/) to distribute read queries across replicas. + 2. Configure Langflow to use a single connection string pointing to the primary PostgreSQL database or proxy. + + + + +To implement Active-Active HA, you must deploy multiple Langflow instances, use load balancing to distribute traffic across the instances, and ensure all instances connect to the same HA PostgreSQL database: + +1. Deploy multiple Langflow instances using Kubernetes or Docker Swarm. + + You must configure your instances to use a shared PostgreSQL database. + For more information, see [Best practices for Langflow on Kubernetes](/deployment-prod-best-practices). + +2. Set up streaming replication: + + 1. Configure one primary database for writes. + 2. Configure one or more replicas for reads and failover. + + Select either synchronous or asynchronous replication based on your latency and consistency requirements. + +3. Implement automatic failover using one of the following options: + + * Use an HA orchestrator, distributed configuration store, and traffic router, such as [Patroni](https://patroni.readthedocs.io/en/latest/), etcd or [Consul](https://developer.hashicorp.com/consul), and [HAProxy](https://www.haproxy.org/). + * Use [Pgpool-II](https://www.pgpool.net/docs/46/en/html/index.html) alone or add supporting services for more robust HA support. + * Use managed services that provide built-in HA with automatic failover, such as AWS RDS or Google Cloud SQL. + +4. Update your PostgreSQL connection string to point to the HA setup. +Make sure all of your Langflow instances connect to the same HA PostgreSQL database. + + The connection string you use depends on your HA configuration and services: + + * Use a virtual IP or DNS name that resolves to the current primary database, such as `postgresql://langflow:securepassword@db-proxy:5432/langflow?sslmode=require`. + * Use the provided endpoint for a managed service, such as `langflow.cluster-xyz.us-east-1.rds.amazonaws.com`. + +5. Use a load balancer to distribute requests across your instances. + +The following example configuration is for a production deployment that has three `langflow-runtime` replicas, uses the Kubernetes load balancer service to distribute traffic to healthy pods, and uses the HA PostgreSQL database connection string. + +```yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: langflow-runtime +spec: + replicas: 3 + selector: + matchLabels: + app: langflow-runtime + template: + metadata: + labels: + app: langflow-runtime + spec: + containers: + - name: langflow + image: langflowai/langflow:latest + ports: + - containerPort: 7860 + env: + - name: LANGFLOW_DATABASE_URL + value: "postgresql://langflow:securepassword@db-proxy:5432/langflow?sslmode=require" +--- +apiVersion: v1 +kind: Service +metadata: + name: langflow-runtime +spec: + selector: + app: langflow-runtime + ports: + - port: 80 + targetPort: 7860 + type: LoadBalancer +``` + + + + +After implementing HA or Active-Active HA, monitor failover events and ensure replicas are in sync. +Langflow, through [SQLAlchemy](https://docs.sqlalchemy.org/en/20/), supports reconnection attempts, ensures recovery after failover, and reduces disruption once the database is back online. + +Although PostgreSQL handles concurrent connections well, you must still monitor for contention, deadlocks, or other performance degradation during high load. + +## Impact of database failure + +If the PostgreSQL database becomes unavailable, the following Langflow functions will fail: + +* **Flow Retrieval**: Cannot load new or existing flows from the database. +* **Flow Saving**: Unable to save new flows or updates to existing flows. +* **User Authentication**: Login and user management functions fail. +* **Project Collection Access**: Cannot access or share community/custom project collections. +* **Configuration Retrieval**: Unable to load application settings. +* **Configuration Updates**: Changes to settings cannot be saved. +* **Execution Log Access**: Cannot retrieve historical flow execution logs. +* **Log Writing**: New execution or system activity logs cannot be recorded. +* **Multi-User Collaboration**: Sharing flows or projects across users fails. +* **API Flow Loading**: API requests to load new flows (non-cached) fail. + +Flows already loaded in memory may continue to function with cached configurations. +However, any operation requiring database access fails until the database is restored. +For example, a cached flow might run, but it won't record logs or message history to the database. + +To minimize the possibility and impact of database failure, use [HA configurations](#high-availability-for-postgresql) and record backups regularly. +For example, you can use `pg_dump` to create logical backups or set up continuous archiving with write-ahead logs (WAL) for point-in-time recovery. +Test restoration procedures regularly to ensure your team understands how to execute them in a disaster recovery scenario. + +## Database monitoring + +Monitor your PostgreSQL database to ensure optimal performance and reliability: + +* Use tools like pgAdmin, Prometheus with PostgreSQL exporter, or cloud-based monitoring for PostgreSQL. +* Track performance metrics such as CPU, memory, and disk I/O usage. +* Monitor replica health, availability, lag, and synchronization. +For example, use `pg_stat_activity` to monitor connection counts and contention. +* Set up alerts and notifications for high latency, failover events, or replication issues. +* Enable PostgreSQL logging, such as `log_connections` and `log_statements`, to track access and changes. + +## See also + +* [Configure an external PostgreSQL database](/configuration-custom-database) +* [Langflow architecture on Kubernetes](/deployment-architecture) +* [Deploy the Langflow production environment on Kubernetes](/deployment-kubernetes-prod) \ No newline at end of file diff --git a/docs/docs/Develop/memory.mdx b/docs/docs/Develop/memory.mdx index 0f9d3204e..208ee43dd 100644 --- a/docs/docs/Develop/memory.mdx +++ b/docs/docs/Develop/memory.mdx @@ -26,17 +26,17 @@ For more information, see [Configure external memory](#configure-external-memory The following tables are stored in `langflow.db`: -• **User**: Stores user account information including credentials, permissions, and profiles. For more information, see [API keys and authentication](/api-keys-and-authentication). +• **User**: Stores user account information including credentials, permissions, profiles, and user management settings. For more information, see [API keys and authentication](/api-keys-and-authentication). -• **Flow**: Contains flow configurations. For more information, see [Build flows](/concepts-flows). +• **Flow**: Contains flow definitions, including nodes, edges, and components, stored as JSON or database records. For more information, see [Build flows](/concepts-flows). • **Message**: Stores chat messages and interactions that occur between components. For more information, see [Message objects](/data-types#message) and [Store chat memory](#store-chat-memory). • **Transaction**: Records execution history and results of flow runs. This information is used for [logging](/logging). -• **ApiKey**: Manages API authentication keys for Langflow users. Component API keys are stored in the **Variables** table. For more information, see [API keys and authentication](/api-keys-and-authentication). +• **ApiKey**: Manages Langflow API authentication keys. Component API keys are stored in the **Variables** table. For more information, see [API keys and authentication](/api-keys-and-authentication). -• **Project**: Provides a structure for flow storage. For more information, see [Manage flows in projects](/concepts-flows#projects). +• **Project**: Provides a structure for flow storage, including single-user projects and shared projects accessed by multiple users. For more information, see [Manage flows in projects](/concepts-flows#projects). • **Variables**: Stores global encrypted values and credentials. For more information, see [Global variables](/configuration-global-variables). diff --git a/docs/sidebars.js b/docs/sidebars.js index 8f68c23c7..689b4032b 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -119,6 +119,11 @@ module.exports = { label: "Use Session IDs" }, "Configuration/configuration-custom-database", + { + type: "doc", + id: "Develop/enterprise-database-guide", + label: "Database guide for enterprise administrators" + }, ], }, { @@ -190,10 +195,15 @@ module.exports = { type: "category", label: "Kubernetes", items: [ + { + type: "doc", + id: "Deployment/deployment-architecture", + label: "Deployment architecture" + }, { type: "doc", id: "Deployment/deployment-prod-best-practices", - label: "Langflow architecture and best practices" + label: "Best practices" }, { type: "doc", @@ -204,7 +214,7 @@ module.exports = { type: "doc", id: "Deployment/deployment-kubernetes-prod", label: "Deploy in production" - } + }, ] }, ],