From litestar-skills
Auto-activate for Dockerfile, docker-compose.yml, railway.json, railway.toml, Procfile, cloudbuild.yaml, app.yaml, service.yaml, `.github/workflows/deploy*`, deploy.sh, systemd unit files, or `granian` / `litestar run` in deployment context. Litestar deployment across targets: Docker multi-stage builds (standard + distroless), Docker Compose, Railway, Cloud Run, GKE, systemd. Produces Dockerfiles, compose files, K8s manifests, Railway configs, Cloud Run service.yaml, systemd units, CI/CD workflows, health-check endpoints. Key patterns: uv for packages, Bun for frontend builds, tini as PID 1, non-root UID 65532, UV_COMPILE_BYTECODE=1, STOPSIGNAL SIGINT, distroless prod images, separate SAQ worker containers, Vite asset pipeline in Docker, LITESTAR_APP env var. Use when: deploying a Litestar app, writing Dockerfiles, Docker Compose, Railway/Cloud Run/GKE, systemd, or CI/CD pipelines with asset builds. Not for non-Litestar Python apps — Litestar has specific Granian/entrypoint/lifespan conventions.
npx claudepluginhub litestar-org/litestar-skills --plugin litestar-skillsThis skill uses the workspace's default tool permissions.
Production deployment patterns for Litestar ASGI applications across Docker, Railway, Kubernetes/GKE, Cloud Run, and systemd. Covers multi-stage Dockerfiles, distroless images, asset pipelines, worker containers, and health-check integration.
Guides Payload CMS config (payload.config.ts), collections, fields, hooks, access control, APIs. Debugs validation errors, security, relationships, queries, transactions, hook behavior.
Builds scalable data pipelines, modern data warehouses, and real-time streaming architectures using Spark, dbt, Airflow, Kafka, and cloud platforms like Snowflake, BigQuery.
Builds production Apache Airflow DAGs with best practices for operators, sensors, testing, and deployment. For data pipelines, workflow orchestration, and batch job scheduling.
Production deployment patterns for Litestar ASGI applications across Docker, Railway, Kubernetes/GKE, Cloud Run, and systemd. Covers multi-stage Dockerfiles, distroless images, asset pipelines, worker containers, and health-check integration.
All deployment paths use Granian (via litestar-granian) as the ASGI server, uv for Python package management, and Bun for frontend asset builds.
Build vs. deploy split: this skill is about running Litestar artifacts in production. For producing those artifacts — wheel bundling with embedded Vite assets, PyApp onefile binaries, GitHub Actions CI/release pipelines — see litestar-build.
from __future__ import annotations is allowed in consumer-app modules (Dockerfiles, deploy scripts, settings).T | None).litestar run (which delegates to Granian when litestar-granian is installed).@dataclass settings — never hardcode secrets or connection strings.| Target | Reference | Key File |
|---|---|---|
| Docker (standard multi-stage) | references/docker-standard.md | Dockerfile |
| Docker (distroless production) | references/docker-distroless.md | Dockerfile.distroless |
| SAQ worker container | references/docker-workers.md | Dockerfile.worker |
| Docker Compose (app + infra) | references/docker-compose.md | docker-compose.yml |
| Railway | references/railway.md | railway.app.json |
| Kubernetes / GKE | references/kubernetes.md | deploy.py, templates/ |
| Cloud Run | references/cloud-run.md | service.yaml |
| systemd native | references/systemd.md | litestar.service |
# Web server
ENTRYPOINT ["tini", "--"]
CMD ["litestar", "run", "--host", "0.0.0.0", "--port", "8000"]
# SAQ worker (separate container)
ENTRYPOINT ["tini", "--"]
CMD ["app", "workers", "run"]
LITESTAR_APP="app.server.asgi:create_app" # app discovery
DATABASE_URL="postgresql+asyncpg://..." # async driver
SAQ_REDIS_URL="redis://cache:6379/0" # worker queue
SECRET_KEY="..." # session signing
<workflow>
Docker Compose for local/staging. Railway for rapid PaaS. GKE/K8s for production at scale. Cloud Run for serverless containers. systemd for bare-metal.
Start from Dockerfile.distroless for production (preferred). Use standard multi-stage for environments that need a shell. Use Dockerfile.dev for local Docker development. Always pin ARG PYTHON_VERSION=3.13.
Copy Bun lockfiles first (layer caching), install JS deps, then bun run build and uv run app assets build. Assets must be in the wheel before uv build.
SAQ workers use the same build stages but a different CMD (app workers run). No port exposed, no health-check HTTP endpoint. Set SAQ_USE_SERVER_LIFESPAN=false.
Build images in CI, push to registry, deploy via railway up, gcloud run deploy, or kubectl apply. Tag images with git SHA for production — never deploy latest to prod.
Expose /health on the API container. K8s uses startupProbe + livenessProbe + readinessProbe on /health:8000. Cloud Run and Railway use the same endpoint for readiness.
gcr.io/distroless/cc-debian12:nonroot) has no shell, no apt, minimal CVE surface. Use slim only when you need a shell for debugging.nonroot user. Create with useradd --system --uid 65532 in standard images.uv sync --frozen --no-dev in builder, uv pip install wheel in runner.ENTRYPOINT ["tini", "--"].STOPSIGNAL SIGINT or Granian ignores the signal and gets SIGKILL after timeout.docker buildx with --platform linux/amd64,linux/arm64. Distroless Dockerfile handles arch-specific lib paths via TARGETARCH.node_modules into production images./health. K8s probes hit this path. Cloud Run and Railway use it for readiness.USER nonroot in Dockerfile. runAsNonRoot: true in K8s pod security context.ARG PYTHON_VERSION=3.13 at the top. Never use python:latest.DATABASE_POOL_DISABLED=true, SAQ_USE_SERVER_LIFESPAN=false, SAQ_WEB_ENABLED=false during build to prevent the app from trying to connect to databases during asset compilation.Before shipping a Litestar deployment, verify:
ARG PYTHON_VERSION is pinned (not latest)COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ presentUV_COMPILE_BYTECODE=1 and UV_LINK_MODE=copy set in builderuv build creates wheel; runner installs wheel (not editable)ENTRYPOINT ["tini", "--"] setSTOPSIGNAL SIGINT set (for Granian graceful shutdown)LITESTAR_APP env var set/health endpoint exists and is used by probes/readiness checksdepends_on uses condition: service_healthySee references/docker-distroless.md for a complete 4-stage distroless Dockerfile with multi-arch support, Vite asset build, and non-root execution.
For a full local stack (app + worker + migrator + PostgreSQL + Valkey), see references/docker-compose.md.
For Kubernetes production deployment with HPA, Ingress, and GKE Workload Identity, see references/kubernetes.md.
</example>litestar run@dataclass settings pattern