Skip to content

Split dmozdb into separate backend + web OKE workloads#2

Merged
poly-glot merged 2 commits into
mainfrom
feature/split-web-backend
Jun 6, 2026
Merged

Split dmozdb into separate backend + web OKE workloads#2
poly-glot merged 2 commits into
mainfrom
feature/split-web-backend

Conversation

@poly-glot

Copy link
Copy Markdown
Owner

Why

Fixes the 100-VU CrashLoopBackOff: the combined pod let Deno's SSR boot CPU starve the backend's health probe. Splitting them isolates the fault and lets SSR scale horizontally.

What

  • Backend: standalone StatefulSet (binds 0.0.0.0); DMOZDB_TRUSTED now accepts CIDRs so cross-pod clients (pod 10.244.0.0/16 + node 10.0.1.0/24) are allowed. tcpSocket probes.
  • Web: horizontally-scaled Deployment + HPA (min 2 / max 4, 70% CPU) behind the existing Traefik ingress; reaches the backend over a ClusterIP service.
  • State: users/sessions move to a shared in-cluster denokv StatefulSet (KV Connect).
  • Images: combined image split into Dockerfile.backend + Dockerfile.web; CD builds + pushes both (arm64, tag-suffixed in one OCIR repo).
  • NetworkPolicies (declarative; flannel won't enforce), metrics-server kustomization, one-shot scripts/migrate-kv.ts.

Verification

  • zig build test exit 0 (Linux + Zig 0.15.2 container), incl. new CIDR tests.
  • cd web && deno task check exit 0.
  • Full overlay server-dry-runs clean (StatefulSet needs a one-time --cascade=orphan recreate — immutable volumeClaimTemplate removal).

Cutover note

First deploy is a controlled manual cutover (delete STS --cascade=orphan → apply); CD's plain apply would fail on the immutable StatefulSet change. Done before merge so the merge-triggered CD apply is idempotent.

poly-glot added 2 commits June 5, 2026 20:15
Separate the Deno/Fresh frontend from the Zig backend so SSR scales
horizontally and a frontend CPU spike can no longer starve the backend
health probe (the 100-VU CrashLoopBackOff root cause).

- Backend: standalone StatefulSet binding 0.0.0.0; add CIDR support to
  DMOZDB_TRUSTED so cross-pod clients (pod + node subnet) are allowed.
- Web: horizontally-scaled Deployment + HPA (min 2 / max 4) behind the
  Traefik ingress; reaches the backend over a ClusterIP service.
- Users/sessions move to a shared in-cluster denokv StatefulSet (KV Connect).
- Split the combined image into Dockerfile.backend + Dockerfile.web; CD
  builds and pushes both (arm64, tag-suffixed in one OCIR repo).
- NetworkPolicies (best-effort under flannel), metrics-server install,
  and a one-shot users.db -> denokv migration script.
The first split cutover is manual (StatefulSet needs a one-time
--cascade=orphan recreate), so PRs must build+push the images without
triggering the deploy job. Tag PR builds with the PR head SHA.
@poly-glot
poly-glot merged commit 2dc556f into main Jun 6, 2026
2 checks passed
@poly-glot
poly-glot deleted the feature/split-web-backend branch June 6, 2026 12:29
poly-glot added a commit that referenced this pull request Jun 7, 2026
Split dmozdb into separate backend + web OKE workloads
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant