Skip to content

Self-Hosting EpistemicDB

Create a docker-compose.yml:

yaml
version: '3.9'
services:
  epistemicdb:
    image: epistemicdb/server:0.1.0
    ports:
      - "5433:5433"
    environment:
      - DATABASE_URL=postgresql://postgres:postgres@postgres:5432/epistemicdb
      - OPENAI_API_KEY=${OPENAI_API_KEY}
      - EDB_ADMIN_KEY=${EDB_ADMIN_KEY}
      - EDB_PORT=5433
    depends_on:
      postgres:
        condition: service_healthy

  postgres:
    image: pgvector/pgvector:pg16
    environment:
      POSTGRES_DB: epistemicdb
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
    ports:
      - "5432:5432"
    volumes:
      - edb_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 5s
      timeout: 5s
      retries: 5

volumes:
  edb_data:

Start with:

bash
docker compose up -d

Building from source

bash
git clone <repo> && cd epistemicdb
npm ci
npm run build -w packages/eql
npm run build -w packages/server
docker build . -t epistemicdb/server:0.1.0

Environment variables

VariableRequiredDefaultDescription
DATABASE_URLYesPostgreSQL connection string
EDB_PORTNo5433Server port
OPENAI_API_KEYNoFor embedding generation
EDB_ADMIN_KEYNoAdmin API key for bootstrapping

Health check

bash
curl http://localhost:5433/health

Returns:

json
{
  "status": "ok",
  "version": "0.1.0",
  "uptime_seconds": 42,
  "watch_subscriptions": 0
}

API endpoints

MethodPathAuthDescription
POST/queryYesExecute EQL
POST/query/validateYesValidate EQL
GET/schemaNoSchema info
GET/healthNoHealth check
GET/metricsNoPrometheus metrics
POST/projectsAdminCreate project
GET/DELETE/projects/:idAdminManage project
POST/GET/PATCH/DELETE/koYesKO CRUD
POST/DELETE/GET/watchYesHTTP subscriptions
WS/watch/wsQueryWebSocket subscriptions

Released under the MIT License.