# Production Deployment URL: /docs/deployment/production/ Section: deployment Tags: production, pounce, docker, metrics, rate-limit -------------------------------------------------------------------------------- Overview Chirp apps run on Pounce, a production-grade ASGI server with enterprise features built-in. Phase 5 (Automatic) WebSocket compression — 60% bandwidth reduction HTTP/2 support — Multiplexed streams, server push Graceful shutdown — Finishes active requests on SIGTERM Zero-downtime reload — kill -SIGUSR1 for hot code updates OpenTelemetry — Distributed tracing (configurable) Phase 6 (Configurable) Prometheus metrics — /metrics endpoint for monitoring Per-IP rate limiting — Token bucket algorithm Request queueing — Load shedding during traffic spikes Sentry integration — Error tracking and reporting Hot reload — Zero-downtime worker replacement Quick Start Development Mode from chirp import App, AppConfig app = App(AppConfig(debug=True)) @app.route("/") def index(): return "Hello!" app.run() # Single worker, auto-reload Production Mode from chirp import App, AppConfig config = AppConfig( debug=False, secret_key="your-secret-key-here", workers=4, metrics_enabled=True, rate_limit_enabled=True, ) app = App(config=config) @app.route("/") def index(): return "Hello, Production!" app.run() # Multi-worker, Phase 5 & 6 features CLI Production Mode chirp run myapp:app --production --workers 4 --metrics --rate-limit Custom Port Checks If your CLI checks whether a port is free before calling app.run() (e.g. to avoid split-brain or show a clearer error), use SO_REUSEADDR in that check. Otherwise you'll block restarts when the port is in TIME_WAIT (30–120 seconds after shutdown). The server already uses SO_REUSEADDR; your check should match. import socket def is_port_in_use(host: str, port: int) -> bool: """Return True if another process is actively listening on host:port.""" try: with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s: s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind((host, port)) return False except OSError: return True Without SO_REUSEADDR, the check fails when the port is in TIME_WAIT even though the server would bind successfully. When you can't identify the process holding the port, include a TIME_WAIT hint in your error message (e.g. "wait 30–60s or use a different port"). Docker FROM python:3.14-slim WORKDIR /app COPY . . RUN pip install bengal-chirp CMD ["chirp", "run", "myapp:app", "--production", "--workers", "4"] Configuration Config Default Description workers 0 (auto) Worker count (0 = CPU count) metrics_enabled False Prometheus /metrics endpoint rate_limit_enabled False Per-IP rate limiting request_queue_enabled False Request queueing and load shedding sentry_dsn None Sentry error tracking ssl_certfile None TLS certificate (enables HTTP/2) ssl_keyfile None TLS private key Full Guide For detailed deployment instructions, TLS setup, Kubernetes, and advanced configuration, see the full deployment guide in the repository: docs/deployment/production.md -------------------------------------------------------------------------------- Metadata: - Word Count: 373 - Reading Time: 2 minutes