# ============================================ # WeLe Agentic AI — deployment # # Runs alongside the existing CRM stack rather than inside it. Joining the # CRM's network (`whatsapp-crm_default`) lets this service reach `redis` and # `whatsapp-api` by name, without publishing anything extra or duplicating a # Redis on a 3.7 GB box. # # The voice service is not here on purpose — it needs a CUDA GPU. See DEPLOY.md. # ============================================ services: agentic-ai: build: . image: wele/agentic-ai:latest container_name: wele-agentic-ai restart: always # Host 4000 is free. The CRM's chat-service also listens on 4000, but only # inside its own container — it publishes nothing, so there is no clash. ports: - "4000:4000" env_file: - .env environment: - NODE_ENV=production - PORT=4000 # English-only keeps one TTS voice resident (~200 MB). Tamil is built and # tested — VOICE_LANGUAGES=en,ta plus a multilingual STT_MODEL enables it, # at roughly 200 MB more. - VOICE_LANGUAGES=en - STT_MODEL=onnx-community/whisper-tiny.en # Reuse the CRM's Redis by service name on the shared network. # Keys are namespaced with REDIS_PREFIX, so the two never collide. - REDIS_ENABLED=true - REDIS_HOST=redis - REDIS_PORT=6379 # Quoted: a trailing colon makes YAML parse this as a map, not a string. - "REDIS_PREFIX=agentic:" # Writes go through the CRM's own REST routes so its lead scoring, # socket events and audit trail still fire. Reached over the shared # network, so this never leaves the host. - "CRM_API_BASE=http://whatsapp-api:3000" # Must match the CRM's JWT_SECRET — that is how a CRM login is accepted # here with the same role and permissions. Sourced from .env so the # secret is never written into this file. - CRM_JWT_SECRET=${CRM_JWT_SECRET:?set CRM_JWT_SECRET in .env — must equal the CRM JWT_SECRET} - MONGODB_URI=${MONGODB_URI:?set MONGODB_URI in .env} volumes: # Generated xlsx/pdf/pptx survive rebuilds; swept on a TTL by the app. - artifacts:/app/storage/artifacts # Speech models are fetched from HuggingFace on first use (~200 MB). # Without this they re-download on every restart and the first voice turn # after a deploy stalls for a minute. - speech_cache:/app/.transformers-cache # A 2 vCPU / 3.7 GB host already runs the CRM, chat-service, Redis and # Milvus. Capping this container keeps a runaway turn from starving them. # # 1 GB, not 768 MB: the speech models are resident once voice is used — # measured 729 MB (Whisper tiny.en 415 MB + MMS-TTS English 203 MB + VAD # 28 MB + the agent itself). 768 MB left no headroom, and an OOM kill takes # text chat down with voice. Text-only sessions stay near 80 MB. deploy: resources: limits: memory: 1024M logging: driver: json-file options: max-size: "10m" max-file: "3" networks: - crm networks: crm: # Created by the CRM's own compose project; we attach, never own it. name: whatsapp-crm_default external: true volumes: artifacts: speech_cache: