Using Your Own PostgreSQL

The Docker Compose file and the Kubernetes files bring their own database, and you need nothing on this page. Read it only if AI Knowledge Fabric should use a PostgreSQL server you run yourself.


1. What the database needs

  • PostgreSQL 16. Other versions are not supported.

  • An empty database for the app, for example AIKnowledgeFabric. The app creates its tables itself.

  • A database user that owns this database and may create logins (CREATEROLE). Each Topic, GraphRAG Topic and Agent stores and reads its chat history in this database with a login of its own, which can reach only that Topic’s or Agent’s chats. The app creates this login when the Topic or Agent starts, disables it when it stops and removes it when it is deleted.

Without CREATEROLE the app starts, but no Topic, GraphRAG Topic or Agent starts: it shows an error that names the missing right.

For example, as an administrator of the server:

CREATE ROLE aiknowledgefabric LOGIN CREATEROLE PASSWORD 'choose-a-password';
CREATE DATABASE "AIKnowledgeFabric" OWNER aiknowledgefabric;

The user does not need to be a superuser.


2. What the app needs to know

Set these in the app’s environment (see Supported settings):

Setting Value

DB_URL

jdbc:postgresql://<server>:5432/AIKnowledgeFabric

DB_USERNAME, DB_PASSWORD

the user from section 1

TOPIC_HISTORY_DB_URL

Your server’s address as a Topic container (Docker) or pod (Kubernetes) sees it. By default Topics look for the database on the Docker host, and the shipped files point it at their own database.


3. Reaching the server from Topics

Topics and GraphRAG Topics connect to the database themselves, so the server must accept connections from them, not only from the app:

  • Docker: a Topic runs in a container of its own, on Docker’s default network. TOPIC_HISTORY_DB_URL must be an address that works from there: not localhost, and not a name on the Compose file’s network such as postgres. A server on the Docker host itself is host.docker.internal with its published port.

  • Kubernetes: Topic pods connect from the app’s namespace. If a network policy or a firewall protects the server, allow the servers of Topics and GraphRAG Topics as well (label cyrock.ai/role with the value all or chat).

If a Topic cannot reach the database, it still answers, but every answer stands alone: it does not remember earlier messages of the chat.