litestar-deployment

Deploy Litestar ASGI applications to Docker, Railway, Kubernetes, Cloud Run, and systemd.

Updated Aug 17, 2026
One-click install
npx skills add https://github.com/renjianguo666/litecms --skill litestar-deployment-renjianguo666
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: litestar-deployment
Source: https://github.com/renjianguo666/litecms/tree/main/.agents/skills/litestar-deployment
Command: npx skills add https://github.com/renjianguo666/litecms --skill litestar-deployment-renjianguo666

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Deploying a Litestar application to production involves many moving parts: multi-stage Dockerfiles, non-root users, signal handling, health checks, worker containers, and platform-specific configuration. This Skill provides tested deployment patterns so you avoid common pitfalls like broken graceful shutdowns, bloated images, and misconfigured probes. ## Core Features & Use Cases - Production Dockerfiles: Multi-stage builds with distroless runtime images, uv package management, Bun frontend asset builds, and multi-architecture (amd64/arm64) support. - Multi-Platform Targets: Ready-made configurations for Docker Compose, Railway, Kubernetes/GKE (HPA, Ingress, Workload Identity), Cloud Run, and systemd units. - Worker Separation: Dedicated SAQ worker container patterns with correct lifecycle settings and no HTTP exposure. - Use Case: You need to ship a Litestar app to GKE. The Skill gives you a distroless Dockerfile, Deployment/Service/HPA/Ingress manifests with health probes on /health, and a separate worker Deployment with a 120-second termination grace period. ## Quick Start Ask the AI to generate a production distroless Dockerfile and Kubernetes deployment manifests for your Litestar application with a separate SAQ worker container.

Frequently Asked Questions about litestar-deployment

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I deploy a Litestar app with Docker in production?▼

Use a multi-stage Dockerfile with a distroless runtime base (gcr.io/distroless/cc-debian12:nonroot), install dependencies with uv, build frontend assets with Bun inside the builder stage, and run with tini as PID 1 plus STOPSIGNAL SIGINT for Granian graceful shutdown.

How to run SAQ workers in Docker or Kubernetes?▼

Deploy SAQ workers as a separate container using the same image but a different CMD (app workers run), with no exposed port and no HTTP probes. Set SAQ_USE_SERVER_LIFESPAN=false and use a longer terminationGracePeriodSeconds (120s) so in-flight tasks finish.

Distroless vs slim Python image for production containers?▼

Distroless images have no shell or package manager, giving a smaller CVE surface and roughly 80-120MB images, but no docker exec debugging. Use slim-based images only when you need a shell or exec-based health probes.

Can I deploy Litestar to Railway with a Dockerfile?▼

Yes, Railway supports Dockerfile builds via railway.json with builder set to DOCKERFILE. Avoid BuildKit cache mounts since Railway's builder does not support them, use the $PORT variable in the start command, and never enable sleep mode for worker services.

Why does my Litestar container not shut down gracefully?▼

Docker sends SIGTERM by default, but Granian handles SIGINT for graceful shutdown. Set STOPSIGNAL SIGINT in the Dockerfile or KillSignal=SIGINT in systemd units, and run tini as PID 1 for proper signal forwarding.

Does Cloud Run work for Litestar background workers?▼

Cloud Run is a poor fit for SAQ workers because it scales on HTTP traffic and can scale to zero. Deploy workers on GKE, Compute Engine, or Cloud Run Jobs instead, or set min-instances to 1 with always-on CPU if you must use Cloud Run.