Skip to content

fix: persist Langflow database across container restarts#1167

Open
mpawlow wants to merge 2 commits intomainfrom
mp/fix/GH-1127-langflow-flow-edits-not-persisted
Open

fix: persist Langflow database across container restarts#1167
mpawlow wants to merge 2 commits intomainfrom
mp/fix/GH-1127-langflow-flow-edits-not-persisted

Conversation

@mpawlow
Copy link
Collaborator

@mpawlow mpawlow commented Mar 17, 2026

Issue

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

Closes #1127

Builds on #1129

Co-authored by @JasonOA888

JasonOA888 and others added 2 commits March 17, 2026 08:30
Fixes #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 #1127
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
@mpawlow mpawlow self-assigned this Mar 17, 2026
@mpawlow mpawlow changed the title DRAFT: fix: persist Langflow database across container restarts fix: persist Langflow database across container restarts Mar 17, 2026
@github-actions github-actions bot added the bug 🔴 Something isn't working. label Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🔴 Something isn't working. docker

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Langflow flow edits are not persisting after restart.

2 participants