Zum Hauptinhalt springen
FIM One supports two database backends: SQLite (default, zero-config) and PostgreSQL (recommended for production). The backend is determined by the DATABASE_URL environment variable.
start.sh and the Docker entrypoint run the Alembic migrations on every start, so tables are created automatically — no manual migration step is required.

SQLite vs PostgreSQL

Lokale Entwicklung: SQLite funktioniert sofort – kein Datenbankserver, kein Redis, nichts zu konfigurieren. Einfach mit dem Programmieren beginnen.Produktion: Mit Docker Compose bereitstellen und PostgreSQL + Redis werden automatisch bereitgestellt. Keine manuelle Datenbankeinrichtung erforderlich.

Known Limitation: SQLite Concurrent Streaming

SQLite can become a bottleneck under concurrent load.FIM One uses Server-Sent Events (SSE) for streaming AI responses. During streaming, each active SSE connection holds a database connection from the pool for the duration of the stream. SQLite enforces a global write lock, meaning only one write operation can proceed at a time — all other writes queue behind it.Even though the connection pool supports up to 15 simultaneous connections (pool_size=10 + max_overflow=5), the bottleneck is the lock itself, not the pool. When multiple users are chatting simultaneously, their write operations (saving messages, updating token counts) serialize against each other.Symptoms you may observe:
  • Conversation list loads slowly while another user is streaming
  • Settings pages feel sluggish during active chat sessions
  • API responses are delayed when multiple streams are active
Recommendation: If you have more than 2-3 concurrent users, switch to PostgreSQL. PostgreSQL uses MVCC (Multi-Version Concurrency Control) with row-level locking, so concurrent reads and writes proceed independently without blocking each other.

Connection Pool Configuration

FIM One configures SQLAlchemy connection pool settings internally for each backend. These are tuned defaults that do not require environment variables (the SQLite pool can be resized with SQLITE_POOL_SIZE / SQLITE_MAX_OVERFLOW) — they are applied automatically based on the DATABASE_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-Einstellungen

PostgreSQL verwaltet Parallelität nativ über MVCC, daher steuern die Pool-Einstellungen hauptsächlich die Ressourcennutzung statt Konflikte. Das 30-Minuten-Recycling-Intervall vermeidet Probleme mit Firewalls, Load Balancern oder verwalteten Datenbankdiensten, die untätige TCP-Verbindungen stillschweigend trennen.

Wechsel zu PostgreSQL

Schritt 1: Starten Sie eine PostgreSQL-Instanz

Der schnellste Weg ist mit Docker:

Schritt 2: DATABASE_URL festlegen

Fügen Sie die folgende Zeile in Ihrer .env-Datei hinzu oder aktualisieren Sie sie:

Schritt 3: FIM One neu starten

Tabellen werden beim ersten Start automatisch erstellt. Es ist keine manuelle Schema-Migration erforderlich.
Vorhandene SQLite-Daten werden nicht automatisch migriert. Das Wechseln von DATABASE_URL von SQLite zu PostgreSQL beginnt mit einer frischen Datenbank. Wenn Sie vorhandene Gespräche, Agenten oder Konnektoren in SQLite haben, die Sie beibehalten möchten, siehe den Abschnitt Datenmigration unten.
If you deploy with Docker Compose, PostgreSQL and Redis are already included and auto-configured — there is nothing extra to set up. The docker-compose.yml sets DATABASE_URL internally — your .env value is overridden:
No additional database setup is needed when using Docker Compose.

Datenmigration

Es gibt kein integriertes Migrationstool von SQLite zu PostgreSQL. Für die meisten Bereitstellungen hängt der empfohlene Ansatz von Ihrer Situation ab: Neue Bereitstellung (keine vorhandenen Daten): Setzen Sie einfach DATABASE_URL auf Ihre PostgreSQL-Verbindungszeichenfolge und starten Sie FIM One. Alle Tabellen werden automatisch erstellt. Vorhandene Daten, die beibehalten werden müssen: Manuelle Export/Import ist erforderlich. Der allgemeine Ansatz:
  1. Exportieren Sie Daten aus SQLite mit einem Tool wie sqlite3 CLI oder einem Python-Skript
  2. Transformieren Sie die Daten nach Bedarf (SQLite und PostgreSQL haben geringfügige Typunterschiede)
  3. Importieren Sie in PostgreSQL mit psql, pg_restore oder Skripten auf Anwendungsebene
Für die meisten Benutzer, die von einer Entwicklungsumgebung zu einer Produktionsumgebung wechseln, ist es einfacher, mit PostgreSQL neu anzufangen und Ihre Agenten und Konnektoren über die Benutzeroberfläche neu zu erstellen. Der Gesprächsverlauf ist normalerweise nicht kritisch genug, um eine manuelle Migration zu rechtfertigen.