Skip to main content
Scope: a single-instance pilot deployment — not a public self-serve offering yet. docker-compose.yml remains the reference for local development; this page covers actually putting the API online, as documented in docs/DEPLOY.md.

Image

The Dockerfile (multi-stage, built on uv) produces an image that, on container start, applies Alembic migrations and then launches uvicorn on port 8100.
One instance at a time: alembic upgrade head runs on every container start (see the CMD below), and several instances starting simultaneously would race on migrations. Split “run migrations” and “start the app” into two separate steps before scaling past one instance.
haki (sdk/python) is an editable path dependency ([tool.uv.sources] in pyproject.toml), so the SDK source has to be in the build context before uv sync — not just app/. That’s why the Dockerfile copies sdk/python before the first uv sync pass.
Chosen because it’s plain Docker underneath (no strong lock-in) and Fly offers a managed Postgres with the pgvector extension.
1

Detect the Dockerfile

Creates fly.toml.
2

Managed Postgres

3

Enable pgvector

Once on the database, after fly postgres attach (Alembic migrations assume CREATE EXTENSION IF NOT EXISTS vector, already present in alembic/versions/0001_initial.py — nothing else needed on Fly’s side beyond a Postgres image that supports the extension).
4

Environment variables

fly secrets set NAME=value for each — see .env.example at the repo root for the full list and each variable’s role.
5

Deploy

Console (Next.js)

Deployed separately on Vercel (a natural fit for Next.js):
Variables to set on Vercel: NEXT_PUBLIC_HAKI_API_URL (the API’s Fly.io URL), NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY / CLERK_SECRET_KEY (Clerk), HAKI_CONSOLE_SERVICE_KEY (same value as on the API side — never NEXT_PUBLIC_*, it must never reach the browser).

Backups

Not covered by this page — see the production audit (backups section): a prerequisite before accepting any third-party data at all, handled separately from going live itself.