ragflow_config.yaml
Overview
The ragflow_config.yaml file is a Kubernetes configuration manifest that defines ConfigMaps for the Ragflow application. ConfigMaps are Kubernetes objects used to store non-confidential configuration data in key-value pairs or configuration files, which can then be mounted into pods or accessed by containers at runtime.
This file serves two main purposes:
Ragflow Service Configuration:
It dynamically injects the Ragflow service configuration and LLM (Large Language Model) factory definitions into ConfigMaps from Helm chart values. This enables flexible and environment-specific configuration management.Nginx Configuration for Ragflow Web Service:
It provides Nginx configuration files as ConfigMaps to configure the Nginx server that acts as a reverse proxy and static file server for the Ragflow web UI and API backend.
Detailed Explanation
Kubernetes ConfigMaps in this file
The file consists of two distinct ConfigMap resources:
1. ragflow-service-config ConfigMap
Kind: ConfigMap
metadata.name:
ragflow-service-configPurpose: Stores Ragflow service configurations and LLM factories in YAML and JSON format respectively.
Data keys:
local.service_conf.yaml: Contains the service configuration in YAML format.llm_factories.json: Contains LLM factory definitions in pretty JSON format.
Template Logic
This portion uses Helm templating syntax to inject values:
{{- with .Values.ragflow.service_conf }}
local.service_conf.yaml: |
{{- . | toYaml | nindent 4 }}
{{- end }}
{{- with .Values.ragflow.llm_factories }}
llm_factories.json: |
{{- . | toPrettyJson | nindent 4 }}
{{- end }}
.Values.ragflow.service_conf: Expected to be a YAML-serializable object holding Ragflow service configuration..Values.ragflow.llm_factories: Expected to be a JSON-serializable object defining LLM factories used by Ragflow.
Usage Example:
If in your Helm values you have:
ragflow:
service_conf:
someSetting: true
llm_factories:
factory1:
type: openai
api_key: "xxx"
These will be rendered into the ConfigMap as YAML and JSON respectively, then mounted into the Ragflow pods.
2. nginx-config ConfigMap
Kind: ConfigMap
metadata.name:
nginx-configPurpose: Provides the entire Nginx server configuration necessary to serve the Ragflow web application and proxy API requests.
Data keys:
ragflow.conf: Main Nginx server block configuration.proxy.conf: Proxy-related configuration snippets included in the server block.nginx.conf: Global Nginx configuration.
Key Configuration Details
ragflow.conf
Listens on port 80 for all server names (
_).Serves static files from
/ragflow/web/dist.Enables gzip compression with high compression level and specific MIME types.
Proxies API requests matching
/v1or/apito the backend service onlocalhost:9380.Serves single page application (SPA) with fallback to
index.htmlfor unmatched routes.Sets long cache expiration headers (10 years) on static assets (
/static/css,/static/js,/static/media).
proxy.conf
Sets standard proxy headers for host, client IP, and protocol.
Uses HTTP/1.1 and disables connection persistence to avoid connection reuse issues.
Disables proxy buffering and extends read and send timeouts to 3600 seconds (1 hour), likely to support long-running API calls.
nginx.conf
Runs Nginx as
rootuser (likely within a container).Configures worker processes and connections.
Sets up logging formats and locations.
Enables sendfile for efficient static file serving.
Increases client max body size to 128 MB, accommodating large uploads.
Includes the
ragflow.confserver block from/etc/nginx/conf.d/.
Interaction with Other Parts of the System
Ragflow Service Pods:
Theragflow-service-configConfigMap data is typically mounted into Ragflow service containers or accessed by the application to configure internal services and LLM factories dynamically.Nginx Pods or Containers:
Thenginx-configConfigMap is mounted into the Nginx container(s) to provide the necessary configurations for serving the web UI and proxying API requests to the Ragflow backend.Helm Chart Integration:
This file uses Helm templating constructs ({{- with ... }}) expecting values from the Helm chartvalues.yamlfile. It facilitates environment-specific config injection during deployment.
Important Implementation Details
Helm Template Usage:
The dynamic insertion of the service configuration and LLM factory JSON is done using Helm’stoYamlandtoPrettyJsonfunctions, with indentation handled bynindent. This ensures clean, readable, and valid YAML/JSON output within ConfigMaps.Nginx Configuration for SPA and API Proxying:
The Nginx config handles both static frontend serving and proxying API calls to the backend, which is a common approach in modern web applications using a decoupled frontend and backend.Long Cache Expiration:
Static assets are cached aggressively (expires 10y), optimizing client performance by reducing repeated downloads.Timeout Tuning:
Proxy timeouts set to 3600s allow for long-running requests, which may be important for certain Ragflow API calls.
Visual Diagram
The following flowchart illustrates the relationships and data flow between configuration sources and consumers within this file:
flowchart TD
A[Helm Chart Values]
B[ragflow-service-config ConfigMap]
C[nginx-config ConfigMap]
D[Ragflow Service Pods]
E[Nginx Pods/Containers]
A -->|Injects service_conf & llm_factories| B
A -->|Static Nginx config (fixed)| C
B -->|Mounted or accessed| D
C -->|Mounted as config files| E
E -->|Serves static web UI| Users[End Users]
E -->|Proxies API requests| D
Summary
ragflow_config.yaml defines two Kubernetes ConfigMaps:
ragflow-service-configfor dynamic Ragflow service and LLM factory configurations.nginx-configfor Nginx server configuration serving the frontend and proxying backend API.
It uses Helm templating to flexibly inject configuration data from deployment values.
Nginx is configured for gzip compression, SPA fallback routing, caching static assets, and proxying API requests with tuned timeouts.
These configurations integrate directly with Ragflow backend service pods and Nginx frontend pods, enabling a fully configured deployment environment.
This file is critical for configuring the Ragflow application’s runtime behavior and web server setup in a Kubernetes environment.
End of documentation for ragflow_config.yaml