Overview
IronClaw supports two database backends:- PostgreSQL - Production-grade, requires a running server
- libSQL - Embedded SQLite, zero dependencies, optional Turso cloud sync
PostgreSQL
Requirements
- PostgreSQL 15 or later
- pgvector extension (required for embeddings)
Installation
- macOS
- Ubuntu/Debian
- Docker
Configuration
Set the database URL in your environment or~/.ironclaw/.env:
Connection Pool
Configure the connection pool size:- Local development: 5-10 connections
- Production: 20-50 connections (depends on workload)
- Docker/VPS: Start with 10, adjust based on
pg_stat_activity
SSL/TLS Configuration
Control SSL mode for PostgreSQL connections:| Mode | Behavior |
|---|---|
disable | Never use TLS (plaintext only) |
prefer | Try TLS first, fall back to plaintext |
require | Require TLS; fail if unavailable |
- Local PostgreSQL:
disable(no TLS needed) - Managed databases (Neon, Supabase, RDS):
preferorrequire - VPS/self-hosted:
prefer(default, works everywhere)
Migrations
Migrations run automatically on first connection. To run manually:Cloud Providers
Neon
Neon
Neon provides serverless Postgres with automatic scaling.pgvector is pre-installed. Set
DATABASE_SSLMODE=require.Supabase
Supabase
Railway
Railway
AWS RDS
AWS RDS
Troubleshooting
pgvector not found
pgvector not found
Error:
pgvector extension not foundSolution:- macOS:
brew install pgvector - Ubuntu:
apt install postgresql-15-pgvector - Docker: Use
pgvector/pgvector:pg15image - Source: github.com/pgvector/pgvector#installation
PostgreSQL version too old
PostgreSQL version too old
Error:
PostgreSQL 14 detected. IronClaw requires PostgreSQL 15 or laterSolution: Upgrade PostgreSQL:- macOS:
brew upgrade postgresql - Ubuntu: Follow postgresql.org/download/linux/ubuntu/
- Docker: Use
pgvector/pgvector:pg15or later
Connection refused
Connection refused
Error: Check port:Check
connection refused or could not connect to serverCheck PostgreSQL is running:pg_hba.conf if connecting remotely.Authentication failed
Authentication failed
Error: Reset password:
password authentication failedCheck password:libSQL (Embedded)
Overview
libSQL is an embedded SQLite database with optional Turso cloud sync. No external database server required. Benefits:- Zero dependencies
- Single file storage
- Automatic migrations
- Optional remote sync
Local Setup
Turso Cloud Sync
Turso provides remote replicas for libSQL databases. Setup:-
Create a Turso database:
-
Get connection details:
-
Create an auth token:
-
Configure IronClaw:
- Local file (
LIBSQL_PATH) is the primary database - Changes sync to the remote replica (
LIBSQL_URL) - Other instances can read from the remote replica
Configuration Options
| Variable | Description | Default |
|---|---|---|
DATABASE_BACKEND | Backend type | postgres |
LIBSQL_PATH | Local database file | ~/.ironclaw/ironclaw.db |
LIBSQL_URL | Turso remote URL (optional) | - |
LIBSQL_AUTH_TOKEN | Turso auth token (required if URL is set) | - |
Migrations
Migrations run automatically on first connection (idempotentCREATE IF NOT EXISTS).
Limitations
- Concurrency: SQLite uses file-level locking (fine for single-user, not ideal for high-concurrency)
- Vector search: Uses JSON instead of native vector types (slower than pgvector)
- Backups: Copy the
.dbfile (or use Turso cloud backups)
When to Use libSQL
Good for:- Personal use / single-user
- Development / testing
- Lightweight deployments
- Portable installations
- Multiple concurrent users
- High-throughput workloads
- Large-scale vector search
- Production deployments
Switching Backends
To switch from PostgreSQL to libSQL (or vice versa):-
Export data (if needed):
-
Change configuration:
-
Re-run onboarding:
- Migrations run automatically on first connection.
Environment Variables
PostgreSQL
| Variable | Description | Default |
|---|---|---|
DATABASE_BACKEND | Backend type (postgres or libsql) | postgres |
DATABASE_URL | PostgreSQL connection URL | - |
DATABASE_POOL_SIZE | Max connections in pool | 10 |
DATABASE_SSLMODE | SSL mode (disable, prefer, require) | prefer |
libSQL
| Variable | Description | Default |
|---|---|---|
DATABASE_BACKEND | Backend type | postgres |
LIBSQL_PATH | Local database file | ~/.ironclaw/ironclaw.db |
LIBSQL_URL | Turso remote URL (optional) | - |
LIBSQL_AUTH_TOKEN | Turso auth token | - |
