Skip to content

Part 4 · Production Infra — Redis, Docker, Kubernetes

quill works on your laptop. Part 4 is about making it run somewhere that isn’t your laptop — and survive there. This is the part the user asked for by name: how Rust actually integrates with Redis, Docker, and Kubernetes. We add each in the order a real service adopts them: a cache and rate limiter first (Redis), then reproducible packaging (Docker), then an orchestrator that keeps it alive and scales it (Kubernetes).

┌──────────────── Kubernetes ────────────────┐
│ Deployment (quill) Deployment (worker) │
│ │ ▲ HPA scales on load │ │
Internet ─► Ingress─┼──► Service ─► pods ◄── probes ──► pods │
│ │ │ │
│ ▼ ▼ │
│ ┌────────┐ ┌────────┐ ┌───────────┐ │
│ │Postgres│ │ Redis │ │ Secrets/ │ │
│ │ │ │(cache/ │ │ ConfigMap │ │
│ └────────┘ │ queue) │ └───────────┘ │
│ └────────┘ │
└─────────────────────────────────────────────┘
  • Redis, three ways: cache rendered post pages, rate-limit the AI endpoints per user, and back the Part 3 job queue with a real store instead of an in-process channel.
  • Docker: a multi-stage build that compiles the Rust workspace and ships a tiny, non-root image (distroless or scratch-ish), plus a docker-compose.yml that brings up quill + Postgres + Redis for local development.
  • Kubernetes: Deployments for the web and worker binaries, a Service and Ingress, ConfigMaps and Secrets for config, liveness/readiness probes wired to your /health, rolling deploys, graceful shutdown, resource requests/limits, and a HorizontalPodAutoscaler.
ToolRole in quillWhy it earns its place
Rediscache · rate limit · queueshared, fast, atomic ops other pods can see
Dockerreproducible packaging”runs on my machine” → “runs anywhere,” tiny attack surface
Kubernetesorchestrationrestarts, rolls out, and scales pods without you watching
probeshealth signalingK8s only routes traffic to pods that say they’re ready
HPAautoscalingmore load → more pods → back down when quiet
ChTitleYou addThe idea it teaches
1Rediscache, per-key rate limit, queuewhen to reach past Postgres for a shared, fast store
2Dockermulti-stage build, composesmall non-root images, caching layers, local infra
3KubernetesDeployments, Service, probesthe reconcile loop, config vs secrets, rolling deploys
4Scale & resilienceHPA, limits, graceful shutdownautoscaling signals, backpressure, zero-downtime deploys

Once it compiles, what does it take to run for real users? Part 4’s answer: make failure and scale someone else’s problem — declaratively. You stop running the process and start describing the state you want; Kubernetes reconciles reality to match. Your job becomes writing honest health checks and resource limits so the orchestrator can do its job.

Next: Part 5 · Observability →