Skip to content

OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.

Python

fix: add missing env variables from .env.example and docker compose (#984)

Lucas Oliveira8b90f955d33f
diff --git a/.env.example b/.env.example
index 2e9737fcf..f3bdc0f1f 100644
--- a/.env.example
+++ b/.env.example
@@ -45,6 +45,11 @@ OPENSEARCH_PASSWORD=
# Default: ./opensearch-data
OPENSEARCH_DATA_PATH=./opensearch-data
+# OpenSearch Connection
+OPENSEARCH_HOST=opensearch
+OPENSEARCH_PORT=9200
+OPENSEARCH_USERNAME=admin
+
# OpenSearch index name for storing documents
# Default: documents
# Change this if you want to use a different index name or avoid conflicts
@@ -136,3 +141,38 @@ NEXT_ALLOWED_DEV_ORIGINS=
# - e.g. INFO: 127.0.0.1:45132 - "GET /tasks HTTP/1.1" 200 OK
# - Default: true
# ACCESS_LOG=false
+
+# OpenRAG Configuration
+# The version tag for OpenRAG Docker images (e.g., 'latest', 'v1.0.0').
+# This is automatically managed by the TUI during updates to match the Python package version,
+# but can be pinned here to lock the deployment to a specific version when running OpenRAG with Make commands.
+OPENRAG_VERSION=latest
+
+# The local documents path for ingestion.
+OPENRAG_DOCUMENTS_PATH=./openrag-documents
+
+# Langflow Configuration
+# API Key for authenticating with Langflow.
+# If not provided, OpenRAG will automatically generate one using the superuser credentials
+# (LANGFLOW_SUPERUSER and LANGFLOW_SUPERUSER_PASSWORD).
+LANGFLOW_KEY=
+
+# Number of retry attempts when generating the Langflow API key (default: 15)
+LANGFLOW_KEY_RETRIES=
+
+# Delay in seconds between API key generation retry attempts (default: 2.0)
+LANGFLOW_KEY_RETRY_DELAY=
+
+# Version of Langflow (informational/future use)
+# LANGFLOW_VERSION=
+
+# Logging and Service
+# Format for log messages (default: json)
+LOG_FORMAT=
+# Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
+LOG_LEVEL=
+# Service name used in logs (default: openrag)
+SERVICE_NAME=openrag
+# Secret key for session management (auto-generated if not provided)
+SESSION_SECRET=
+
diff --git a/docker-compose.yml b/docker-compose.yml
index 7587e4350..b63c3378f 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -37,8 +37,8 @@ services:
depends_on:
- opensearch
environment:
- OPENSEARCH_HOSTS: '["https://opensearch:9200"]'
- OPENSEARCH_USERNAME: "admin"
+ OPENSEARCH_HOSTS: '["https://${OPENSEARCH_HOST:-opensearch}:${OPENSEARCH_PORT:-9200}"]'
+ OPENSEARCH_USERNAME: "${OPENSEARCH_USERNAME:-admin}"
OPENSEARCH_PASSWORD: ${OPENSEARCH_PASSWORD}
ports:
- "5601:5601"
@@ -52,7 +52,7 @@ services:
depends_on:
- langflow
environment:
- - OPENSEARCH_HOST=opensearch
+ - OPENSEARCH_HOST=${OPENSEARCH_HOST:-opensearch}
- LANGFLOW_URL=http://langflow:7860
- LANGFLOW_PUBLIC_URL=${LANGFLOW_PUBLIC_URL}
- LANGFLOW_AUTO_LOGIN=${LANGFLOW_AUTO_LOGIN}
@@ -64,8 +64,8 @@ services:
- DISABLE_INGEST_WITH_LANGFLOW=${DISABLE_INGEST_WITH_LANGFLOW:-false}
- INGEST_SAMPLE_DATA=${INGEST_SAMPLE_DATA:-true}
- NUDGES_FLOW_ID=${NUDGES_FLOW_ID}
- - OPENSEARCH_PORT=9200
- - OPENSEARCH_USERNAME=admin
+ - OPENSEARCH_PORT=${OPENSEARCH_PORT:-9200}
+ - OPENSEARCH_USERNAME=${OPENSEARCH_USERNAME:-admin}
- OPENSEARCH_PASSWORD=${OPENSEARCH_PASSWORD}
- OPENAI_API_KEY=${OPENAI_API_KEY}
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
@@ -81,6 +81,13 @@ services:
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}
- OPENSEARCH_INDEX_NAME=${OPENSEARCH_INDEX_NAME:-documents}
+ - LANGFLOW_KEY=${LANGFLOW_KEY}
+ - LANGFLOW_KEY_RETRIES=${LANGFLOW_KEY_RETRIES}
+ - LANGFLOW_KEY_RETRY_DELAY=${LANGFLOW_KEY_RETRY_DELAY}
+ - LANGFLOW_VERSION=${LANGFLOW_VERSION}
+ - LOG_FORMAT=${LOG_FORMAT}
+ - SERVICE_NAME=${SERVICE_NAME}
+ - SESSION_SECRET=${SESSION_SECRET}
- LOG_LEVEL=${LOG_LEVEL:-INFO}
- NO_COLOR=${NO_COLOR:-}
- ACCESS_LOG=${ACCESS_LOG:-true}
diff --git a/docs/docs/get-started/upgrade.mdx b/docs/docs/get-started/upgrade.mdx
index a2cc0815d..ee061a9a3 100644
--- a/docs/docs/get-started/upgrade.mdx
+++ b/docs/docs/get-started/upgrade.mdx
@@ -115,15 +115,12 @@ The commands to upgrade the package depend on how you installed OpenRAG.
6. In the OpenRAG TUI, click **Start Services**, and then wait while the services start.
- When you start services after upgrading the Python package, OpenRAG runs `docker compose pull` to get the appropriate container images matching the version specified in your OpenRAG `.env` file. Then, it recreates the containers with the new images using `docker compose up -d --force-recreate`.
-
- :::tip Pin container versions
- In the OpenRAG `.env` file, the `OPENRAG_VERSION` [environment variable](/reference/configuration#system-settings) is set to `latest` by default, which pulls the `latest` available container images.
- To pin a specific container image version, you can set `OPENRAG_VERSION` to the desired container image version, such as `OPENRAG_VERSION=0.1.33`.
-
- However, when you upgrade the Python package, OpenRAG automatically attempts to keep the `OPENRAG_VERSION` synchronized with the Python package version.
- You might need to edit the `.env` file after upgrading the Python package to enforce a different container version.
- The TUI warns you if it detects a version mismatch.
+ When you start services, the TUI dictates the container version at runtime. It overrides the `OPENRAG_VERSION` variable in your `.env` file to match the currently installed OpenRAG Python package version.
+
+ This ensures that your TUI and containers are always synchronized when using the TUI to manage services.
+
+ :::tip
+ If you want to use a specific container version different from your TUI version, you must use manual `docker compose` or `make` commands instead of the TUI, or you can downgrade your Python package version.
:::
If you get an error that `langflow container already exists` error during upgrade, see [Langflow container already exists during upgrade](/support/troubleshoot#langflow-container-already-exists-during-upgrade).
@@ -147,6 +144,10 @@ The commands to upgrade the package depend on how you installed OpenRAG.
```
By default, OpenRAG's `docker-compose` files pull the latest container images.
+ However, you can pin the `OPENRAG_VERSION` in your `.env` file to a specific version tag.
+
+ If you run OpenRAG using `make` commands or manual `docker compose` commands, the `OPENRAG_VERSION` variable is used exactly as defined in the `.env` file.
+ This allows you to pin the deployment to a specific version when managing the services manually.
3. After the containers start, access the OpenRAG application at `http://localhost:3000`.
diff --git a/docs/docs/reference/configuration.mdx b/docs/docs/reference/configuration.mdx
index 316abab34..348901607 100644
--- a/docs/docs/reference/configuration.mdx
+++ b/docs/docs/reference/configuration.mdx
@@ -108,13 +108,10 @@ For better security, it is recommended to set `LANGFLOW_SUPERUSER_PASSWORD` so t
| `LANGFUSE_HOST` | Not set | Leave empty for Langfuse Cloud. Required for self-hosted Langfuse deployments if `LANGFUSE_SECRET_KEY` and `LANGFUSE_PUBLIC_KEY` are set. The address must be relative to the OpenRAG container deployment. For example, `http://localhost:3002` or `http://host.docker.internal:3000`. |
| `LANGFLOW_TIMEOUT` | `2400` | Total Langflow HTTP timeout limit in seconds. Increase this value if you experience timeouts when ingesting very large PDFs. See also [`INGESTION_TIMEOUT`](#document-processing-settings).|
| `LANGFLOW_CONNECT_TIMEOUT` | `30` | Langflow HTTP connection timeout limit in seconds. Increase this value if you experience timeouts when ingesting very large PDFs. |
-
-<!-- Author's Note: Don't delete the commented-out variables. I am in the process of determining which ones can be set in the .env and which cannot. See issue #568 -->
-
-<!-- | `LANGFLOW_KEY` | Automatically generated | A Langflow API key to run flows with Langflow API calls. Because Langflow API keys are server-specific, allow OpenRAG to generate this key initially. You can create additional Langflow API keys after deploying OpenRAG. | -->
-<!-- | `LANGFLOW_KEY_RETRIES` | `15` | Number of retries for Langflow key generation. | -->
-<!-- | `LANGFLOW_KEY_RETRY_DELAY` | `2.0` | Delay between retries in seconds. | -->
-<!-- | `LANGFLOW_VERSION` | `OPENRAG_VERSION` | Langflow Docker image version. By default, OpenRAG uses the `OPENRAG_VERSION` for the Langflow Docker image version. | -->
+| `LANGFLOW_KEY` | Automatically generated | A Langflow API key to run flows with Langflow API calls. Because Langflow API keys are server-specific, allow OpenRAG to generate this key initially. You can create additional Langflow API keys after deploying OpenRAG. |
+| `LANGFLOW_KEY_RETRIES` | `15` | Number of retries for Langflow key generation. |
+| `LANGFLOW_KEY_RETRY_DELAY` | `2.0` | Delay between retries in seconds. |
+| `LANGFLOW_VERSION` | `OPENRAG_VERSION` | Langflow Docker image version. By default, OpenRAG uses the `OPENRAG_VERSION` for the Langflow Docker image version. **This variable is currently inactive and for information purposes only.** |
## OAuth and cloud storage connector settings {#oauth-and-cloud-storage-connector-settings}
@@ -141,10 +138,9 @@ Configure OpenSearch database authentication.
| `OPENSEARCH_DATA_PATH` | `./opensearch-data` | The path where OpenRAG creates your OpenSearch index data. This persists through updates. |
| `OPENSEARCH_PASSWORD` | Not set | Required. OpenSearch administrator password. Must adhere to the [OpenSearch password complexity requirements](https://docs.opensearch.org/latest/security/configuration/demo-configuration/#setting-up-a-custom-admin-password). You must set this directly in the `.env` or in the TUI's [**Basic/Advanced Setup**](/install-uvx#setup). |
| `OPENSEARCH_INDEX_NAME` | `documents` | The name of the [OpenSearch index](/knowledge#index). |
-
-<!-- | `OPENSEARCH_HOST` | `localhost` | OpenSearch service host. | -->
-<!-- | `OPENSEARCH_PORT` | `9200` | OpenSearch service port. | [if not configurable, edit other instances of OPENSEARCH_PORT in the docs] -->
-<!-- | `OPENSEARCH_USERNAME` | `admin` | OpenSearch administrator username. | -->
+| `OPENSEARCH_HOST` | `localhost` | OpenSearch service host. |
+| `OPENSEARCH_PORT` | `9200` | OpenSearch service port. |
+| `OPENSEARCH_USERNAME` | `admin` | OpenSearch administrator username. |
## System settings
@@ -159,9 +155,7 @@ Configure general system components, session management, and logging.
| `LANGFLOW_WORKERS` | `1` | Number of Langflow worker processes for concurrent request handling. Be mindful of hardware limitations to avoid overtaxing system resources. |
| `DOCLING_WORKERS` | `1` | Number of Docling worker processes for concurrent request handling. Be mindful of hardware limitations to avoid overtaxing system resources. |
| `ACCESS_LOG` | `true` | Whether to enable access logging for OpenRAG services, such as `INFO: 127.0.0.1:45132 - "GET /tasks HTTP/1.1" 200 OK`. Access logs provide information about incoming requests, and they can be useful for monitoring and debugging. |
-
-<!-- | `LOG_FORMAT` | Not set | Set to `json` to enabled JSON-formatted log output. If this variable isn't set, then the default logging format is used. | -->
-<!-- | `LOG_LEVEL` | `INFO` | Logging level. Can be one of `DEBUG`, `INFO`, `WARNING`, or `ERROR`. `DEBUG` provides the most detailed logs but can impact performance. | -->
-<!-- | `SERVICE_NAME` | `openrag` | Service name for logging. | -->
-<!-- | `SESSION_SECRET` | Automatically generated | Session management. | -->
-<!-- TBD: OPENRAG_VERSION -->
+| `LOG_FORMAT` | `json` | Set to `json` to enable JSON-formatted log output, or `text` for standard text logs. |
+| `LOG_LEVEL` | `INFO` | Logging level. Can be one of `DEBUG`, `INFO`, `WARNING`, `ERROR`, or `CRITICAL`. `DEBUG` provides the most detailed logs but can impact performance. |
+| `SERVICE_NAME` | `openrag` | Service name used in log entries. |
+| `SESSION_SECRET` | Automatically generated | Secret key for session management. If not provided, a secure random key is generated automatically. |
diff --git a/helm/openrag/templates/backend/deployment.yaml b/helm/openrag/templates/backend/deployment.yaml
index 199b81014..30ef91cf4 100644
--- a/helm/openrag/templates/backend/deployment.yaml
+++ b/helm/openrag/templates/backend/deployment.yaml
@@ -22,6 +22,7 @@ spec:
checksum/secret-langflow: {{ include (print $.Template.BasePath "/secrets/langflow-secret.yaml") . | sha256sum }}
checksum/config-flows: {{ include (print $.Template.BasePath "/configmaps/flow-ids-configmap.yaml") . | sha256sum }}
checksum/config-app: {{ include (print $.Template.BasePath "/configmaps/app-config-configmap.yaml") . | sha256sum }}
+ checksum/secret-backend: {{ include (print $.Template.BasePath "/secrets/backend-secret.yaml") . | sha256sum }}
spec:
serviceAccountName: {{ include "openrag.serviceAccountName" . }}
{{- with .Values.podSecurityContext }}
@@ -92,9 +93,27 @@ spec:
key: superuser
- name: LANGFLOW_SUPERUSER_PASSWORD
valueFrom:
- secretKeyRef:
name: {{ include "openrag.fullname" . }}-langflow
key: superuser-password
+ - name: LANGFLOW_KEY
+ value: {{ .Values.langflow.auth.apiKey | default "" | quote }}
+ - name: LANGFLOW_KEY_RETRIES
+ value: {{ .Values.langflow.auth.keyRetries | default "15" | quote }}
+ - name: LANGFLOW_KEY_RETRY_DELAY
+ value: {{ .Values.langflow.auth.keyRetryDelay | default "2.0" | quote }}
+ - name: LANGFLOW_VERSION
+ value: {{ .Values.langflow.image.tag | default .Values.global.imageTag | quote }}
+ - name: LOG_FORMAT
+ value: {{ .Values.backend.logFormat | default "json" | quote }}
+ - name: LOG_LEVEL
+ value: {{ .Values.backend.logLevel | default "INFO" | quote }}
+ - name: SERVICE_NAME
+ value: {{ .Values.backend.serviceName | default "openrag" | quote }}
+ - name: SESSION_SECRET
+ valueFrom:
+ secretKeyRef:
+ name: {{ include "openrag.fullname" . }}-backend
+ key: session-secret
# Flow IDs from ConfigMap
- name: LANGFLOW_CHAT_FLOW_ID
valueFrom:
diff --git a/helm/openrag/templates/secrets/backend-secret.yaml b/helm/openrag/templates/secrets/backend-secret.yaml
new file mode 100644
index 000000000..c4910e9a7
--- /dev/null
+++ b/helm/openrag/templates/secrets/backend-secret.yaml
@@ -0,0 +1,13 @@
+{{- if .Values.backend.enabled }}
+apiVersion: v1
+kind: Secret
+metadata:
+ name: {{ include "openrag.fullname" . }}-backend
+ namespace: {{ include "openrag.namespace" . }}
+ labels:
+ {{- include "openrag.labels" . | nindent 4 }}
+type: Opaque
+stringData:
+ # Generate a random 32-character alphanumeric string if not provided
+ session-secret: {{ .Values.backend.auth.sessionSecret | default (randAlphaNum 32) | quote }}
+{{- end }}
diff --git a/helm/openrag/values.yaml b/helm/openrag/values.yaml
index eb32e7607..e8612fcea 100644
--- a/helm/openrag/values.yaml
+++ b/helm/openrag/values.yaml
@@ -84,6 +84,10 @@ langflow:
autoLogin: false
superuser: "admin" # Langflow superuser username
superuserPassword: "" # Langflow superuser password (stored in secret)
+ superuserPassword: "" # Langflow superuser password (stored in secret)
+ apiKey: "" # Optional: pre-generated API key
+ keyRetries: 15 # Number of retries for key generation
+ keyRetryDelay: 2.0 # Delay between retries
secretKey: "" # Langflow secret key for JWT (stored in secret)
newUserIsActive: false
enableSuperuserCli: false
@@ -144,6 +148,15 @@ backend:
cpu: "4"
memory: "16Gi"
+ # Logging and Service
+ logFormat: "json" # json or text
+ logLevel: "INFO" # DEBUG, INFO, WARNING, ERROR
+ serviceName: "openrag"
+
+ # Authentication
+ auth:
+ sessionSecret: "" # Session secret (stored in secret, auto-generated if empty)
+
# Persistence for documents, keys, and config
persistence:
documents: