- Initialize Docker Swarm cluster for container orchestration
- Deploy all services using infrastructure-as-code approach
- Configure domain mappings and TLS certificates
- Validate deployment health across all components
- Establish operational procedures for updates and maintenance
- Infrastructure meeting hardware requirements
- Docker Engine >= 24 installed on all nodes
- Network connectivity between cluster nodes
- Domain names configured and DNS records pointing to your cluster
- TLS/SSL certificates for HTTPS endpoints
Initialize Docker Swarm (manager node)
Docker Swarm provides native clustering and orchestration for Docker containers. Initialize Swarm on your primary manager node:- Deploy 3 or 5 manager nodes (odd numbers for quorum)
- Distribute manager nodes across availability zones when possible
- Use worker nodes for application workloads, managers for orchestration only
Clone the repository
Clone the CometChat on-premise repository to access deployment scripts and configuration files:Deploy the complete infrastructure
Run the following from the repository root on the Swarm manager node:- Initializes required Docker volumes for persistent data
- Creates secure overlay networks for service communication
- Deploys all services defined in
docker-compose.ymlwith proper dependencies - Starts components in the correct order (data stores → backend services → frontend)
- Applies health checks and restart policies
NGINX reverse proxy
NGINX serves as the edge layer, handling TLS termination, API routing, WebSocket protocol upgrades, and proxy buffering for optimal performance. Configuration files to update: Each service has a dedicated NGINX configuration file that must be updated with your production domain:chatapi.conf- Chat API routing and WebSocket upgrade rulesextensions.conf- Extensions API routingmgmtapi.conf- Management API routingnotifications.conf- Notifications service routingdashboard.conf- Frontend dashboard routingglobalwebhooks.conf- Webhooks service routingmoderation.conf- Moderation service routingwebsocket.conf- WebSocket gateway routing
- TLS/SSL Termination: Decrypt HTTPS traffic at the edge, communicate with backend services over encrypted overlay network
- Load Balancing: Distribute requests across service replicas using round-robin or least-connections algorithms
- WebSocket Upgrades: Handle HTTP to WebSocket protocol upgrades for real-time connections
- Request Buffering: Buffer client requests to protect backend services from slow clients
- Rate Limiting: Protect services from abuse and DDoS attacks (configure as needed)
.conf file:
- Use TLS 1.2 or higher only
- Configure strong cipher suites
- Enable HSTS (HTTP Strict Transport Security)
- Implement rate limiting for public endpoints
Domain configuration
Deployments require updating domain references across multiple services and configuration files. Replace all instances of<your-domain> with your actual domain.
Services requiring domain configuration:
- Chat API - Core messaging service endpoints
- Management API - Administrative and configuration endpoints
- Extensions - Custom extension endpoints
- Notifications - Push notification service
- Moderation - Content moderation service
- Webhooks - Outbound webhook delivery
- Data Sync Service - Data synchronization
- NGINX - Reverse proxy routing rules
websocket.chat.example.com). Mismatched domains will cause WebSocket connection failures.
Configuration checklist:
- Update all service environment variables with your domains
- Update NGINX configuration files with matching domains
- Verify DNS records point to your cluster load balancer
- Configure TLS certificates for all public-facing domains
- Test domain resolution from external networks
Useful commands (Swarm operations)
General service management
Stack operations
Troubleshooting commands
Health check endpoints
After deployment, verify all services are healthy by checking their health endpoints:| Component | URL |
|---|---|
| Dashboard | https://app.example.com |
| Chat API | https://api.example.com/health-check |
| Client API | https://apiclient.example.com/health-check |
| Management API | https://apimgmt.example.com/health-check |
| Notifications | https://notifications.example.com/health-check |
| Moderation | https://rule.example.com/health |
| WebSocket | https://websocket.example.com/v1/health |
| Webhooks | https://webhooks.example.com/v1/webhooks/health-check |
example.com with your actual domain.
Health check validation:
- HTTP 200 status code indicates healthy service
- HTTP 503 or connection errors indicate service issues requiring investigation