This document outlines common approaches for horizontally scaling the chat application and securing deployments for enterprise environments. The container and Kubernetes manifests use Daphne as the ASGI server to maximise concurrency for WebSocket traffic.
- Deploy the application on Kubernetes using the provided Helm chart or Kustomize overlays.
- Enable a HorizontalPodAutoscaler to automatically adjust the number of Daphne worker pods based on CPU or custom metrics.
- Redis and MySQL can be run in managed services like Amazon ElastiCache and RDS for better reliability.
- Use a managed MySQL cluster with primary/replica topology.
- Configure Redis in a highly available mode with persistence enabled.
- Enforce HTTPS everywhere and terminate TLS with a modern cipher suite.
- Rotate secrets using your cloud provider's secret manager.
- Review
OWASP_SECURITY.mdfor a checklist of common hardening steps.
- Export metrics to Prometheus as shown in
prometheus.ymland visualise them with Grafana. - Enable tracing via OpenTelemetry for deeper insights into latency bottlenecks.
When running multiple Daphne instances, route traffic through a load balancer that supports sticky sessions or configure Redis as the channel layer's backend for shared state. These guidelines provide a baseline for operating the application at scale in production environments.