fix: persist Langflow database across container restarts#1129
Open
JasonOA888 wants to merge 1 commit intolangflow-ai:mainfrom
Open
fix: persist Langflow database across container restarts#1129JasonOA888 wants to merge 1 commit intolangflow-ai:mainfrom
JasonOA888 wants to merge 1 commit intolangflow-ai:mainfrom
Conversation
Fixes langflow-ai#1127 - Langflow flow edits no longer lost after restart ## Problem Flow edits made in Langflow UI were being lost after container restart. The langflow service only mounted /app/flows but Langflow stores its SQLite database at /root/.langflow/ by default, which was ephemeral. ## Solution 1. Add persistent volume for Langflow data directory: - Mount ${LANGFLOW_DATA_PATH:-./langflow-data} to /root/.langflow 2. Explicitly set LANGFLOW_DATABASE_URL to ensure database location 3. Document the new LANGFLOW_DATA_PATH in .env.example ## Testing - Verified volume mount configuration - Database URL format: sqlite:////root/.langflow/langflow.db Closes langflow-ai#1127
mpawlow
added a commit
that referenced
this pull request
Mar 17, 2026
Issue - #1129 Summary - Fixed Langflow data path and added LANGFLOW_CONFIG_DIR environment variable to ensure flow edits persist across container restarts. Docker Compose Configuration - Updated the Langflow container volume mount target from /root/.langflow to /app/data/.langflow to match the correct working directory for the containerized process - Added LANGFLOW_CONFIG_DIR=/app/data/.langflow environment variable so Langflow uses the correct directory for all configuration artifacts - Updated LANGFLOW_DATABASE_URL to reference the corrected path /app/data/.langflow/langflow.db Makefile - Added langflow-data directory cleanup to the factory-reset target, including a status message in the pre-reset summary and removal logic matching the existing opensearch-data cleanup pattern Builds on #1129
mpawlow
added a commit
that referenced
this pull request
Mar 17, 2026
Issue - #1127 Summary - Fixed Langflow data path and added LANGFLOW_CONFIG_DIR environment variable to ensure flow edits persist across container restarts. Docker Compose Configuration - Updated the Langflow container volume mount target from /root/.langflow to /app/data/.langflow to match the correct working directory for the containerized process - Added LANGFLOW_CONFIG_DIR=/app/data/.langflow environment variable so Langflow uses the correct directory for all configuration artifacts - Updated LANGFLOW_DATABASE_URL to reference the corrected path /app/data/.langflow/langflow.db Makefile - Added langflow-data directory cleanup to the factory-reset target, including a status message in the pre-reset summary and removal logic matching the existing opensearch-data cleanup pattern Builds on #1129
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1127 - Langflow flow edits were being lost after container restart.
Problem
The
langflowservice in docker-compose.yml only mounted/app/flowsfor flow files, but Langflow stores its SQLite database at/root/.langflow/by default. This directory was ephemeral, causing all flow edits to be lost on container restart.Solution
Add persistent volume for Langflow data directory:
${LANGFLOW_DATA_PATH:-./langflow-data}to/root/.langflowExplicitly set database location via
LANGFLOW_DATABASE_URL:sqlite:////root/.langflow/langflow.dbDocument new environment variable in
.env.example:LANGFLOW_DATA_PATH=./langflow-dataChanges
docker-compose.yml/root/.langflow+LANGFLOW_DATABASE_URLenv var.env.exampleLANGFLOW_DATA_PATHdocumentationTesting
OPENSEARCH_DATA_PATHBackward Compatibility
./langflow-data)Closes #1127