flag92 flag92
Deploy

Production-grade Chatwoot + Dify on Kubernetes

Multi-node K8s deploy of Chatwoot + Dify with HPA, Ingress, cert-manager and PVC — end to end.

Kubernetes (1.28+) 180 min

Prereqs#

  • A K8s cluster (GKE / EKS / ACK / kubeadm)
  • ≥ 3 nodes, 4 vCPU / 8 GB each
  • Domain with cert-manager-issued TLS

Topology#

support.example.com

dify.example.com

Ingress · NGINX

Chatwoot Service

Dify Service

Chatwoot Pods

Dify Pods

PostgreSQL
StatefulSet or external RDS

Redis · StatefulSet

Weaviate · StatefulSet

Step 1 — base components#

helm install ingress-nginx ingress-nginx/ingress-nginx \
  --namespace ingress-nginx --create-namespace

helm install cert-manager jetstack/cert-manager \
  --namespace cert-manager --create-namespace \
  --set installCRDs=true

kubectl apply -f cluster-issuer.yaml

Step 2 — Chatwoot via Helm#

helm repo add chatwoot https://chatwoot.github.io/charts
helm install chatwoot chatwoot/chatwoot \
  --namespace chatwoot --create-namespace \
  -f chatwoot-values.yaml

Key values:

ingress:
  enabled: true
  className: nginx
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
  hosts:
    - host: support.example.com
  tls:
    - hosts: [support.example.com]
      secretName: chatwoot-tls

postgresql:
  enabled: true
  persistence:
    size: 80Gi

redis:
  enabled: true

Step 3 — Dify (manifests; no official Helm yet)#

git clone https://github.com/langgenius/dify
cd dify/kubernetes
kubectl create namespace dify
kubectl -n dify apply -f .

Switch api and worker to Deployments and add HPAs:

apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: dify-api
  namespace: dify
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: dify-api
  minReplicas: 2
  maxReplicas: 10
  metrics:
    - type: Resource
      resource:
        name: cpu
        target: { type: Utilization, averageUtilization: 70 }

Step 4 — observability#

helm install kube-prometheus-stack prometheus-community/kube-prometheus-stack \
  --namespace monitoring --create-namespace

Grafana for pod CPU / memory, ingress RPS.

Gotchas#

  • PVC must be ReadWriteMany for Chatwoot multi-replica attachment dir
  • Sidekiq queue saturation — separate HPA for Sidekiq
  • Cold starts — set behavior.stabilizationWindowSeconds on Dify worker HPA

Cost reference#

ClusterNodesGCP monthly
Test3 × e2-medium~$60
Small prod3 × n2-standard-4~$280
Mid prod6 × n2-standard-4~$560

Search

Press ⌘ K to open