DATABASE_URL environment variable.
SQLite vs PostgreSQL
Known Limitation: SQLite Concurrent Streaming
Connection Pool Configuration
FIM One configures SQLAlchemy connection pool settings internally for each backend. These are tuned defaults that do not require environment variables — they are applied automatically based on theDATABASE_URL scheme. Understanding them helps explain runtime behavior.
SQLite Pool Settings
WAL mode and the 30-second busy timeout are set via SQLite PRAGMAs on every new connection. This combination ensures that short-lived reads (loading a conversation list, fetching settings) are not blocked by long-running write transactions, and that concurrent writes queue gracefully instead of failing.
PostgreSQL Pool Settings
PostgreSQL handles concurrency natively via MVCC, so the pool settings primarily control resource usage rather than contention. The 30-minute recycle interval avoids issues with firewalls, load balancers, or managed database services that silently drop idle TCP connections.
Switching to PostgreSQL
Step 1: Start a PostgreSQL Instance
The quickest way is with Docker:Step 2: Set the DATABASE_URL
Add or update the following line in your.env file:
Step 3: Restart FIM One
Existing SQLite data is not migrated automatically. Switching
DATABASE_URL from SQLite to PostgreSQL starts with a fresh database. If you have existing conversations, agents, or connectors in SQLite that you need to preserve, see the Data Migration section below.Docker Compose (Recommended for Production)
If you deploy with Docker Compose, PostgreSQL and Redis are already included and auto-configured — there is nothing extra to set up. Thedocker-compose.yml sets DATABASE_URL internally — your .env value is overridden:
Data Migration
There is no built-in migration tool from SQLite to PostgreSQL. For most deployments, the recommended approach depends on your situation: Fresh deployment (no existing data): Simply setDATABASE_URL to your PostgreSQL connection string and start FIM One. All tables are created automatically.
Existing data that must be preserved: Manual export/import is required. The general approach:
- Export data from SQLite using a tool like
sqlite3CLI or a Python script - Transform the data as needed (SQLite and PostgreSQL have minor type differences)
- Import into PostgreSQL using
psql,pg_restore, or application-level insert scripts