Use your own PostgreSQL
Run Lore against an existing PostgreSQL instance with pgvector and optional Chinese full-text search extensions.
Use your own PostgreSQL when you already operate a database service, need managed backups, or do not want the installer-managed PostgreSQL container.
You have two paths with external PostgreSQL:
- Still use Docker Compose for the Lore Web and Redis containers, but point
DATABASE_URLat your external database. This path is covered below in "Compose Web container with external PostgreSQL." - Run Lore Web without Docker entirely. This requires building or running the Lore Web container image directly with your own orchestrator. The
DATABASE_URLandSNAPSHOT_DATA_DIRrequirements are the same.
Lore only needs one server environment variable to point at it:
The server code accepts postgresql://, postgres://, and normalizes postgresql+...:// URLs. Non-local hosts use SSL automatically unless the URL disables it with sslmode=disable or equivalent.
Required database capabilities
| Capability | Required | Why |
|---|---|---|
| PostgreSQL with pgvector support | yes | memory views store embedding vectors in vector columns |
CREATE EXTENSION vector | yes | initial migration creates pgvector |
CREATE EXTENSION pg_jieba | recommended | preferred tokenizer for Chinese full-text search |
CREATE EXTENSION zhparser | optional fallback | used if pg_jieba cannot be created |
| ordinary schema DDL | yes | migrations create tables, indexes, and app settings |
The initial migration runs this sequence:
If neither pg_jieba nor zhparser is available, Lore still starts, but Chinese lexical recall is weaker. Semantic recall still depends on embedding configuration from /setup.
Create database and role
Example owner-style setup:
For a stricter production setup, run the first migration as an owner role that can create extensions, then run the Web server with a restricted role that can read/write the Lore schema. Do not point production at a role that lacks migration permission before the initial migration has completed.
Install extensions
The easiest path is the Lore PostgreSQL image:
That image is built from postgres/Dockerfile: it starts from pgvector/pgvector:pg16, builds zhparser, builds pg_jieba, and appends:
If you operate PostgreSQL yourself, mirror that requirement:
- Install pgvector for your PostgreSQL major version.
- Install
pg_jiebaif you need high-quality Chinese recall. - Add
pg_jiebatoshared_preload_libraries. - Restart PostgreSQL.
- Create
vectorandpg_jiebain the Lore database, or let Lore's first migration create them.
pg_jieba cannot be fully enabled by CREATE EXTENSION alone if the server library was not preloaded.
Compose Web container with external PostgreSQL
If you still use the repository docker-compose.yml for the Web and Redis containers, set .env like this:
Then either remove the bundled postgres service from your local Compose file or leave it unused. If you also operate Redis externally, replace REDIS_URL. If Redis is empty or unreachable during startup, Lore falls back to an in-process local cache; this is acceptable for one Web process but not ideal for multi-instance deployments.
Verify before connecting agents
Run these checks from the Web server host:
Then open /setup and complete embedding and View LLM configuration. Database connectivity alone is not enough for useful recall.
When you want the installer to configure only local agents against this existing server, pass the server URL: