QASYNTAX
DevOps · 2026-11-28 · By Denis Sidorenko

Simple Production Deployments with FastAPI, Docker Compose, and Caddy

When you don't need Kubernetes yet: how to ship a fast, TLS-secured Python service on a single Linux VPS.

Keep Infrastructure Proportional to the Workload

Not every web app or internal tool needs a multi-node Kubernetes cluster on day one. A clean Docker Compose + Caddy setup on a Linux VPS gives you:

  • Automatic Let's Encrypt HTTPS with zero manual certificate renewals
  • Reproducible container builds via a single build.sh script
  • Healthchecks and automatic restarts with restart: unless-stopped
  • Easy migration path to Kubernetes later when traffic actually demands it

Security Basics to Include From Day One

  • Bind the application container to an internal Docker network (expose, not ports).
  • Let Caddy terminate TLS and add security headers (X-Content-Type-Options, X-Frame-Options, Referrer-Policy).
  • Keep secrets in .env outside of Git and back up your SQLite volume daily.

← Back to all articles