From 43d8f58c6139a6f8b570adc5c4eedc1fa1ab5dbf Mon Sep 17 00:00:00 2001 From: konturai-ops Date: Mon, 10 Aug 2026 15:27:44 +0000 Subject: [PATCH] sync: migrate sales-call-center deployment config to Gitea (2026-08-10) --- .gitignore | 18 ++ docker-compose.yml | 398 ++++++++++++++++++++++++++++++++++++++++++++ frontend.nginx.conf | 40 +++++ 3 files changed, 456 insertions(+) create mode 100644 .gitignore create mode 100644 docker-compose.yml create mode 100644 frontend.nginx.conf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6370798 --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +# deployment artifacts only — no secrets, no runtime data, no media +.env +.env.* +!.env.example +.data_pg/ +.data_local/ +.models/ +*.wav +*.pdf +*.pcm +*.pid +*.opts +*.bak-* +*.bak +*.TAG +__pycache__/ +*.pyc + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..af92681 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,398 @@ +name: sales-call-center + +x-app-env: &app_env + CC_DATA_DIR: /app/.data_local + DATABASE_URL: postgresql+psycopg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB} + SCHEMA_MANAGEMENT_MODE: migrations + AUTH_SERVICE_URL: http://auth-service:8000 + AUDIT_SERVICE_URL: http://audit-service:8000 + CUSTOMER_SERVICE_URL: http://customer-service:8000 + INTERACTION_SERVICE_URL: http://interaction-service:8000 + ROUTING_SERVICE_URL: http://routing-service:8000 + VOICE_ADAPTER_SERVICE_URL: http://voice-adapter-service:8000 + RECORDING_SERVICE_URL: http://recording-service:8000 + IVR_SERVICE_URL: http://ivr-service:8000 + EVENT_BUS_SERVICE_URL: http://event-bus-service:8000 + ASTERISK_BRIDGE_SERVICE_URL: http://asterisk-bridge-service:8000 + TELEGRAM_ADAPTER_SERVICE_URL: http://telegram-adapter-service:8000 + WHATSAPP_ADAPTER_SERVICE_URL: http://whatsapp-adapter-service:8000 + AI_ORCHESTRATOR_SERVICE_URL: http://ai-orchestrator-service:8000 + AI_VOICE_RUNTIME_SERVICE_URL: http://ai-voice-runtime-service:8000 + WEBCHAT_ADAPTER_SERVICE_URL: http://webchat-adapter-service:8000 + EMAIL_ADAPTER_SERVICE_URL: http://email-adapter-service:8000 + KB_SERVICE_URL: http://kb-service:8000 + REPORTING_SERVICE_URL: http://reporting-service:8000 + SUPERVISOR_SERVICE_URL: http://supervisor-service:8000 + SALES_SERVICE_URL: http://sales-service:8000 + LOCAL_STACK_PUBLIC_BASE_URL: https://sales.konturai.kz + ASTERISK_WEBRTC_WS_URL: wss://sales.konturai.kz/asterisk-ws + ASTERISK_BRIDGE_ENABLED: "0" + ASTERISK_CALLCONTROL_ENABLED: "0" + ASTERISK_IVR_FASTAGI_ENABLED: "0" + ASTERISK_WEBRTC_ENABLED: "0" + TELEGRAM_BOT_ENABLED: "0" + AI_TELEGRAM_ENABLED: "0" + WHATSAPP_OUTBOUND_ENABLED: "0" + AI_WHATSAPP_ENABLED: "0" + SALES_TELEGRAM_BRIDGE_ENABLED: "0" + SALES_VOICE_RUNTIME_ENABLED: "0" + AI_VOICE_ENABLED: "0" + AI_VOICE_AUDIOSOCKET_ENABLED: "0" + ERROR_TELEGRAM_ALERTS: "0" + EVENT_BUS_ENABLED: "0" + EVENT_BUS_CONSUMER_ENABLED: "0" + AI_VOICE_ASR_PROVIDER: ${AI_VOICE_ASR_PROVIDER:-elevenlabs} + AI_VOICE_TTS_PROVIDER: ${AI_VOICE_TTS_PROVIDER:-elevenlabs} + AI_VOICE_V2_STREAMING_ASR_BACKEND: ${AI_VOICE_V2_STREAMING_ASR_BACKEND:-elevenlabs_realtime} + AI_VOICE_V2_STREAMING_ASR_BASE_URL: http://streaming-asr-sidecar:8021 + AI_VOICE_V2_STREAMING_ASR_TIMEOUT_SECONDS: "4" + AI_VOICE_V2_STREAMING_ASR_PARTIAL_POLL_ENABLED: "1" + +x-service-defaults: &service_defaults + image: ${CALL_CENTER_IMAGE:-call-center-app:active-sales} + restart: unless-stopped + env_file: + - ./.env.production + environment: + <<: *app_env + volumes: + - ./.data_local:/app/.data_local + extra_hosts: + - host.docker.internal:host-gateway + healthcheck: + test: + - CMD + - python + - -c + - | + from urllib.request import urlopen + import sys + sys.exit(0 if urlopen("http://127.0.0.1:8000/health", timeout=2).getcode() == 200 else 1) + interval: 15s + timeout: 5s + retries: 10 + start_period: 10s + +services: + postgres: + image: postgres:16-alpine + container_name: sales-call-center-postgres + restart: unless-stopped + env_file: + - ./.env + volumes: + - ./.data_pg:/var/lib/postgresql/data + healthcheck: + test: + - CMD-SHELL + - pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB" + interval: 10s + timeout: 5s + retries: 12 + start_period: 15s + + migrate: + <<: *service_defaults + restart: "no" + depends_on: + postgres: + condition: service_healthy + command: ["python", "scripts/migrate_core_db.py"] + healthcheck: + disable: true + + auth-service: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: services.auth_service.app:app + + audit-service: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: services.audit_service.app:app + + customer-service: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: services.customer_service.app:app + + interaction-service: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: services.interaction_service.app:app + + routing-service: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: services.routing_service.app:app + + voice-adapter-service: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: services.voice_adapter_service.app:app + + recording-service: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: services.recording_service.app:app + CC_RECORDINGS_DIR: /app/.data_local/recordings + RECORDING_MAX_BYTES: 26214400 + + ivr-service: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: services.ivr_service.app:app + + telegram-adapter-service: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: services.telegram_adapter_service.app:app + + whatsapp-adapter-service: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: services.whatsapp_adapter_service.app:app + + ai-orchestrator-service: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: services.ai_orchestrator_service.app:app + + streaming-asr-sidecar: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + command: ["sh", "-c", "uvicorn $${APP_MODULE} --host 0.0.0.0 --port 8021"] + environment: + <<: *app_env + APP_MODULE: services.streaming_asr_sidecar_service.app:app + AI_VOICE_V2_STREAMING_ASR_MODEL: base + AI_VOICE_V2_STREAMING_ASR_COMPUTE_TYPE: int8 + AI_VOICE_V2_STREAMING_ASR_DEVICE: cpu + AI_VOICE_V2_STREAMING_ASR_CACHE_DIR: /models/faster_whisper + AI_VOICE_V2_STREAMING_ASR_SUPPORTED_LANGUAGES: ru + volumes: + - ./.data_local:/app/.data_local + - ./.models/faster_whisper:/models/faster_whisper + healthcheck: + test: + - CMD + - python + - -c + - | + from urllib.request import urlopen + import sys + sys.exit(0 if urlopen("http://127.0.0.1:8021/health", timeout=2).getcode() == 200 else 1) + interval: 15s + timeout: 5s + retries: 10 + start_period: 10s + + ai-voice-runtime-service: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + streaming-asr-sidecar: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: services.ai_voice_runtime_service.app:app + AI_VOICE_ENABLED: "1" + AI_VOICE_AUDIOSOCKET_ENABLED: "1" + SALES_VOICE_RUNTIME_ENABLED: "1" + ports: + - "9021:9019" + + webchat-adapter-service: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: services.webchat_adapter_service.app:app + + email-adapter-service: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: services.email_adapter_service.app:app + + kb-service: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: services.kb_service.app:app + + reporting-service: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: services.reporting_service.app:app + + supervisor-service: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: services.supervisor_service.app:app + + sales-service: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: services.sales_service.app:app + SALES_TELEGRAM_BRIDGE_ENABLED: "0" + SALES_VOICE_RUNTIME_ENABLED: "1" + + event-bus-service: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: services.event_bus_service.app:app + + asterisk-bridge-service: + <<: *service_defaults + depends_on: + postgres: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: services.asterisk_bridge_service.app:app + ASTERISK_IVR_FASTAGI_HOST: 0.0.0.0 + ASTERISK_IVR_FASTAGI_PORT: 4573 + ASTERISK_BRIDGE_ENABLED: "1" + AI_VOICE_ENABLED: "1" + ASTERISK_BRIDGE_FAILED_RETRY_ENABLED: "0" + + api-gateway: + <<: *service_defaults + container_name: sales-call-center-app + depends_on: + auth-service: + condition: service_healthy + audit-service: + condition: service_healthy + customer-service: + condition: service_healthy + interaction-service: + condition: service_healthy + routing-service: + condition: service_healthy + voice-adapter-service: + condition: service_healthy + recording-service: + condition: service_healthy + ivr-service: + condition: service_healthy + telegram-adapter-service: + condition: service_healthy + whatsapp-adapter-service: + condition: service_healthy + ai-orchestrator-service: + condition: service_healthy + ai-voice-runtime-service: + condition: service_healthy + webchat-adapter-service: + condition: service_healthy + email-adapter-service: + condition: service_healthy + kb-service: + condition: service_healthy + reporting-service: + condition: service_healthy + supervisor-service: + condition: service_healthy + sales-service: + condition: service_healthy + event-bus-service: + condition: service_healthy + asterisk-bridge-service: + condition: service_healthy + environment: + <<: *app_env + APP_MODULE: gateway.app:app + + frontend: + image: ${CALL_CENTER_FRONTEND_IMAGE:-omnichannel-contact-center:active-sales} + container_name: sales-call-center-frontend + restart: unless-stopped + depends_on: + api-gateway: + condition: service_healthy + ports: + - "127.0.0.1:3081:80" + volumes: + - ./frontend.nginx.conf:/etc/nginx/conf.d/default.conf:ro + networks: + - default + - common_network + +networks: + default: + name: sales-call-center_default + common_network: + external: true diff --git a/frontend.nginx.conf b/frontend.nginx.conf new file mode 100644 index 0000000..24e3d3c --- /dev/null +++ b/frontend.nginx.conf @@ -0,0 +1,40 @@ +resolver 127.0.0.11 valid=30s ipv6=off; +resolver_timeout 5s; + +server { + listen 80; + server_name _; + root /usr/share/nginx/html; + index index.html; + client_max_body_size 50m; + + location = /health { + set $api_gateway http://sales-call-center-app:8000; + proxy_pass $api_gateway/health; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location /proxy/ { + set $api_gateway http://sales-call-center-app:8000; + proxy_pass $api_gateway; + proxy_http_version 1.1; + proxy_read_timeout 600s; + proxy_send_timeout 600s; + proxy_connect_timeout 60s; + proxy_set_header Connection "upgrade"; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Host $host; + proxy_set_header Origin $http_origin; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + + location / { + try_files $uri $uri/ /index.html; + } +}