Skip to content

Deployment

Prepare the servers

Requirement
OS 64-bit Linux, x86_64 or arm64: Ubuntu 24.04 LTS, Debian 13, RHEL or Rocky 9 and similar. macOS and Windows (WSL 2) for development
Containers Docker Engine 27+ with Compose v2 for a single host; Kubernetes 1.30+ for clusters
Python 3.11 to 3.13, only if you install the packages directly instead of using the images
Outbound network PyPI and Docker Hub while building; your LLM endpoint if you use one. Nothing else
Storage SSD. Kafka and the databases need persistent volumes
Time NTP on every host (traces and Kafka timestamps)

Ports, all on the internal network unless you publish them:

Port Service Publish to
3100 parser API Your apps only (loopback or private network). Never the internet
3000 Grafana Operators
9092 Kafka Internal only
5432, 3306, 27017 PostgreSQL, MySQL, MongoDB Internal only
6379 Redis Internal only
4318, 8428, 3200 OTLP, VictoriaMetrics, Tempo Internal only

Where each module runs

Module Kind Install with Typical placement
qaechi-parser (library) Library pip install qaechi-parser Inside your Python app
parser API Server Image from qaechi-stack, or pip install "qaechi-parser[server,...]" App network, behind your gateway
parser worker Server Same image, command qaechi-parser worker CPU nodes; scale with replicas
qaechi-sink Server Image from qaechi-stack, or pip install "qaechi-sink[kafka,...]" Near your database
Kafka Infrastructure Apache Kafka 4.4 (KRaft) or a managed service such as Amazon MSK Private subnet
Job store Infrastructure PostgreSQL, MySQL or MongoDB, self-hosted or managed Private subnet
Result cache and rate limit Infrastructure Redis 7+ or compatible (Valkey, Amazon ElastiCache), shared by the API and every worker Private subnet
Observability Infrastructure VictoriaMetrics, Tempo, Grafana (in qaechi-stack) or your own OTLP backend Ops network

Server sizes

Starting points; very large PDFs need more memory per worker. Measure your own documents with scripts/loadtest.py in qaechi-stack.

By stack

Stack Minimum Recommended Notes
Library 1 vCPU, 1 GB RAM 2 vCPU, 2 GB Inside your app's own limits
Lite (one host) 2 vCPU, 4 GB RAM, 20 GB SSD 4 vCPU, 8 GB, 50 GB Parser, VictoriaMetrics, Tempo, Grafana
Scale (one host) 4 vCPU, 8 GB RAM, 50 GB SSD 8 vCPU, 16 GB, 100 GB Everything in one Compose project; good for PoC and moderate volume
Scale (production) see below Split across hosts or a cluster

By component, production

Component Each instance How many
parser API 1 vCPU, 1 GB 2 or more, behind a load balancer
Worker process 1 vCPU, 1 to 2 GB As many as you need, up to the job topic's partitions
qaechi-sink 0.5 vCPU, 512 MB 1 or 2
Kafka broker 2 vCPU, 8 GB, 100 GB SSD 3 (or a managed service)
Database 2 vCPU, 8 GB, 50 GB SSD 1 primary plus a standby (or a managed service)
Redis 1 vCPU, 2 GB 1 (or a managed service)
Observability 2 vCPU, 4 GB, 50 GB SSD 1

Databases

Choose with the URL scheme. The same databases work for the parser's job store (QAECHI_DATABASE_URL) and for the sink's target (QAECHI_SINK_TARGET).

Database URL Job store Sink target
PostgreSQL 14+, Amazon RDS and Aurora PostgreSQL, Neon, Cloud SQL postgresql://user:pass@host:5432/db Yes Yes
Supabase Connection string from the dashboard, with ?sslmode=require (direct or pooler) Yes Yes
MySQL 8.4+, MariaDB 11+, Aurora MySQL mysql://user:pass@host:3306/db (?ssl=true for managed) Yes Yes
MongoDB 7+, MongoDB Atlas, Amazon DocumentDB mongodb://... or mongodb+srv://... Yes Yes
Your application over HTTPS https://your-app/hooks/qaechi (HMAC-signed) Yes
Anything else Implement the small Store or Target interface Plugin Plugin

Run a stack

git clone https://github.com/qaechi/qaechi-stack && cd qaechi-stack
cp .env.example .env        # set the passwords and the internal token
docker compose --env-file versions.env --env-file .env -f stacks/scale/docker-compose.yml up -d --build --wait
scripts/smoke.sh scale

Security checklist

  • Keep the parser API off the internet. It trusts callers that hold the internal token; put your own authentication in front of it.
  • Store passwords and tokens in a secret manager, not in images or Git.
  • Every image in qaechi-stack is pinned to an exact version and scanned in CI; rebuild when a new qaechi-stack release ships security updates.
  • On Supabase, enable Row Level Security on the sink's tables before exposing them through its API.
  • Documents may contain personal data: the parser deletes its temporary copies after each job, and logs never contain document text.