Replies: 3 comments
-
|
the problem is that docker containers are ephemeral by default. when you delete and recreate container, all data inside is lost. you need to use docker volumes to persist data. langflow stores data in sqlite by default. here is how to set it up: # docker-compose.yml
services:
langflow:
image: langflowai/langflow:latest
ports:
- "7860:7860"
volumes:
- langflow_data:/app/langflow
environment:
- LANGFLOW_DATABASE_URL=sqlite:////app/langflow/langflow.db
- LANGFLOW_CONFIG_DIR=/app/langflow
volumes:
langflow_data:the key points:
if you prefer to use host directory instead of docker volume: volumes:
- ./langflow_data:/app/langflowthis mounts local folder, easier to backup. for production, consider using postgres instead of sqlite: environment:
- LANGFLOW_DATABASE_URL=postgresql://user:pass@db:5432/langflow
services:
db:
image: postgres:15
volumes:
- postgres_data:/var/lib/postgresql/dataafter setting up volumes, your users, flows, and logs will persist across container restarts and recreations. |
Beta Was this translation helpful? Give feedback.
-
|
Data loss on container restart means you need to mount persistent volumes. Solution: Docker volumes # docker-compose.yml
services:
langflow:
image: langflowai/langflow
volumes:
- langflow_data:/app/langflow # Main data
- ./data:/root/.langflow # User data
environment:
- LANGFLOW_DATABASE_URL=sqlite:////root/.langflow/langflow.db
volumes:
langflow_data:Key paths to persist:
For production: Use external PostgreSQL services:
langflow:
environment:
- LANGFLOW_DATABASE_URL=postgresql://user:pass@postgres:5432/langflow
postgres:
image: postgres:15
volumes:
- postgres_data:/var/lib/postgresql/dataBackup strategy: # Backup SQLite
docker cp langflow:/root/.langflow/langflow.db ./backup/
# Or with PostgreSQL
pg_dump langflow > backup.sqlVerify persistence: docker-compose down
docker-compose up -d
# Check if users and flows still existWe deploy persistent Langflow at Revolution AI — external PostgreSQL is recommended for production reliability. |
Beta Was this translation helpful? Give feedback.
-
|
Data persistence in Langflow — several options: 1. SQLite (default) # Already persistent if you mount the volume
volumes:
- ./langflow_data:/app/langflow2. PostgreSQL (recommended for production) environment:
LANGFLOW_DATABASE_URL: postgresql://user:pass@postgres:5432/langflow3. Redis for sessions/cache environment:
LANGFLOW_CACHE_TYPE: redis
LANGFLOW_REDIS_URL: redis://redis:6379What gets persisted:
Backup strategy: # SQLite backup
cp langflow.db langflow_backup_$(date +%Y%m%d).db
# PostgreSQL
pg_dump langflow > backup.sqlFor flow versioning:
curl http://localhost:7860/api/v1/flows/export/all > flows.jsonWe deploy Langflow with full persistence at RevolutionAI. What's your deployment — Docker, K8s, or bare metal? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
May I ask a question: I am running on a Docker container and have configured user login authentication? However, why is it that after deleting and restarting my container, all the previously created users and process data are gone? How should I persist the data? Including users, logs, project data created by users, etc
Beta Was this translation helpful? Give feedback.
All reactions