docker-compose.yml, Coolify can build, run, route, and TLS-terminate the
Cognee API for you, so you go from “it works on my laptop” to a public HTTPS endpoint without
writing any infrastructure code.
This guide deploys the Cognee API server (the cognee service). It uses a slim,
Coolify-friendly compose so the deployment is reliable on a modest server, and explains how to
add the optional services (databases, MCP server, UI) when you need them.
Architecture
By default Cognee uses file-based databases (SQLite + LanceDB + Ladybug, Cognee’s embedded graph engine), so a working deployment needs no external database — just one API key.Prerequisites
- A server (VPS or bare metal) running a 64-bit Linux distro (Debian/Ubuntu recommended). Coolify itself idles at ~0.6–1 GB RAM, so plan for 4 GB+ even though the documented minimum is 2 GB.
- A running Coolify instance (v4). If you don’t have one yet, follow Step 1 below first.
- An LLM API key. Cognee defaults to OpenAI, so an OpenAI key works out of the box
(
LLM_API_KEY); any supported provider can be configured later. - (Optional) a domain name with a DNS
Arecord pointing at your server, for a clean HTTPS URL. Coolify can also hand out a freesslip.iohostname.
Deployment at a glance
Step 1 — Install Coolify (skip if you already have it)
On a fresh server, run the official one-line installer as root (or withsudo):
http://<your-server-ip>:8000 and register the first account — the
first user to register owns the instance, so do this immediately. Ports used by Coolify:
22 (SSH), 80 / 443 (proxy + SSL), and 8000 / 6001 / 6002 (dashboard, realtime,
terminal). Lock 8000 down to your own IP once you’re set up.
Coolify’s proxy needs ports 80/443. If another reverse proxy or PaaS already owns them on
the same host, free them first — two proxies can’t bind the same ports.
Step 2 — Add Cognee as a Docker Compose resource
- Open (or create) a Project and pick an environment (e.g. production).
- Click Create New Resource and choose Public Repository.
- Paste the repository URL (the upstream repo or your fork):
- Coolify defaults the build pack to Nixpacks — open that dropdown and select Docker Compose.
- Set Branch to
main, Base Directory to/, and Docker Compose Location to the compose file you want to deploy (see below).
Use a slim, Coolify-friendly compose
Cognee’s rootdocker-compose.yml is tuned for local development and has three rough edges
on Coolify. Knowing them saves hours:
The fix is a small, production-oriented compose that uses the official prebuilt image
(
cognee/cognee:main), declares no custom network, has a single service (no profiles), injects
config via Coolify environment variables, and persists data on a named volume. (It also drops the
repo compose’s published 5678 debugger port.) Commit this file to your fork and point
Docker Compose Location at it, or paste it via Coolify’s raw compose editor:
docker-compose.coolify.yml
Reference: services in the full repo compose
If you do deploy the upstreamdocker-compose.yml, this is what it contains. Only services
without a profiles: key start under plain Docker Compose — the cognee API (8000) and
redisinsight (5540):
Ports are host mappings;
cognee-mcp listens on 8000 inside its container (mapped to host 8001).
Step 3 — Configure environment variables
Open the resource’s Environment Variables tab. Add variables one-by-one in Normal View, or switch to Developer View to paste a block ofKEY=VALUE lines at once. Cognee reads
variables straight from the container environment (they take precedence over any .env file),
so whatever you set here is applied on the next deploy.
The only variable you must set is the API key:
Step 4 — Persist data and choose your databases
File-based (default, zero setup). Cognee defaults to SQLite (relational), LanceDB (vector) and Ladybug (graph) — Ladybug is Cognee’s embedded graph engine; Kuzu is also supported. To survive redeploys, keep them on a named volume — Coolify persists named volumes automatically (it appends the resource UUID to the name). The slim compose does this withcognee_data plus DATA_ROOT_DIRECTORY / SYSTEM_ROOT_DIRECTORY.
External databases (optional). To move onto Postgres or Neo4j, set the matching provider
variables — pointing only DB_HOST at a server is not enough. Run the database as a separate
Coolify resource, or add its service directly to your compose (declared normally, since Coolify
won’t gate it behind a profile):
Step 5 — Expose the API: domain, port & SSL
Thecognee service listens on port 8000. To publish it through Coolify’s proxy with
automatic HTTPS, assign a domain to the service — either in its Domains field, or with
Coolify’s magic variable in the compose:
COGNEE) with the container port appended (_8000).
Entering an https:// domain makes Coolify request and auto-renew a Let’s Encrypt
certificate via Traefik. (Magic variables in a Git-sourced compose require Coolify
v4.0.0-beta.411+; on older builds, assign the domain in the service’s Domains field instead.)
Let’s Encrypt needs the domain’s DNS
A record pointing at the server and ports 80/443
open, and it won’t validate behind Cloudflare’s proxied (“orange cloud”) mode. Publishing a
ports: mapping alone exposes plain HTTP on the host and bypasses the proxy/SSL — use a
domain assignment for managed TLS.Step 6 — Deploy and verify
Click Deploy and open the Logs. A healthy start runs the database migrations and then Gunicorn binds the server:ENV=prod, Gunicorn logs at error level, so the startup banner is quiet — rely on the
health check below to confirm readiness.
Check the health endpoint — a ready instance returns HTTP 200:
/health returns HTTP 503 with
{"status": "not ready", "health": "unhealthy", …} — there is no separate “starting” state, and a
degraded-but-usable instance still returns 200. For a component-by-component breakdown call
GET /health/detailed, and the interactive API docs live at /docs.
With default settings Cognee runs in multi-tenant mode (
ENABLE_BACKEND_ACCESS_CONTROL=True),
so API endpoints require an authenticated user — but /health and /docs stay open, which is
all you need to confirm a successful deployment.Production hardening
Before exposing Cognee publicly, review these defaults:- Authentication.
ENABLE_BACKEND_ACCESS_CONTROL=True(default) requires auth on the API —REQUIRE_AUTHENTICATION=Falseis ignored while access control is on. Create a user, or for a single-user setup behind a token setENABLE_BACKEND_ACCESS_CONTROL=False. - JWT secret. Change
FASTAPI_USERS_JWT_SECRET(defaultsuper_secret) to a long random string, identical across replicas. - CORS. Replace the default
*inCORS_ALLOWED_ORIGINSwith your real front-end origin(s). - Secrets. Never commit API keys — set them only as Coolify environment variables.
Troubleshooting
Cost estimate
Cognee runs comfortably on a small VPS; the main variable cost is LLM API usage.
LLM token costs are separate and depend on your provider, model, and how much data you ingest.
Next Steps
API Reference
Explore the API you just deployed and build your graph with
add → cognify → search.MCP Server
Connect Cognee to your IDE by also deploying the MCP server (
cognee/cognee-mcp).Need Help?
Join our community for Coolify deployment support.