services: # ============ PROXY - holds all API secrets ============ proxy: build: ./proxy container_name: proxy restart: unless-stopped # Uncomment to expose port (set PROXY_PORT in .env): # ports: # - "${PROXY_PORT:-3200}:3200" environment: - TZ=${TZ:-Europe/Moscow} - LOG_RAW=${LOG_RAW:-false} volumes: - ./workspace/_shared:/data networks: - agent-net secrets: - base_url - api_key - zai_api_key - model_name healthcheck: test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:3200/health')"] interval: 10s timeout: 5s retries: 3 start_period: 5s deploy: resources: limits: cpus: '0.5' memory: 256M # ============ TOOLS API - Single source of truth for tools ============ tools-api: build: ./tools-api container_name: tools-api restart: unless-stopped # Uncomment to expose port (set TOOLS_API_PORT in .env): # ports: # - "${TOOLS_API_PORT:-8100}:8100" environment: - TZ=${TZ:-Europe/Moscow} - WORKSPACE_ROOT=/workspace volumes: - ./workspace/_shared:/data - ./workspace:/workspace:ro # Read-only access to scan for skills networks: - agent-net healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8100/health"] interval: 10s timeout: 5s retries: 3 start_period: 5s deploy: resources: limits: cpus: '0.3' memory: 192M # ============ MCP TEST SERVER ============ mcp-test: build: ./mcp-test container_name: mcp-test restart: unless-stopped networks: - agent-net healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8200/health"] interval: 10s timeout: 5s retries: 3 start_period: 5s deploy: resources: limits: cpus: '0.2' memory: 128M # ============ SCHEDULER - Persistent task scheduling ============ scheduler: build: ./scheduler container_name: scheduler restart: unless-stopped # Uncomment to expose port (set SCHEDULER_PORT in .env): # ports: # - "${SCHEDULER_PORT:-8400}:8400" environment: - TZ=${TZ:-Europe/Moscow} - DATA_DIR=/data - CORE_URL=http://core:4000 - BOT_URL=http://bot:4001 volumes: - ./workspace/_shared:/data # Persistent task storage networks: - agent-net healthcheck: test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8400/health')"] interval: 10s timeout: 5s retries: 3 start_period: 5s deploy: resources: limits: cpus: '0.3' memory: 128M # ============ GOOGLE WORKSPACE MCP - Gmail, Calendar, Drive ============ google-workspace-mcp: build: ./google-workspace-mcp container_name: google-workspace-mcp restart: unless-stopped ports: - "${GOOGLE_MCP_PORT:-8500}:8500" # For OAuth callback (not used, auth via Admin UI) environment: - TZ=${TZ:-Europe/Moscow} - GOOGLE_MCP_CREDENTIALS_DIR=/app/store_creds - OAUTHLIB_INSECURE_TRANSPORT=1 - PORT=8500 - TOOL_TIER=core # OAuth handled via Admin UI with user-configured credentials volumes: - ./workspace/_shared/google_creds:/app/store_creds networks: - agent-net healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8500/health"] interval: 30s timeout: 10s retries: 3 start_period: 30s deploy: resources: limits: cpus: '0.5' memory: 512M # ============ DOCKER MCP - Docker management via MCP ============ docker-mcp: build: ./docker-mcp container_name: docker-mcp restart: unless-stopped volumes: - /var/run/docker.sock:/var/run/docker.sock - ${PWD}:/workspace:ro # Access to compose files (uses current directory) networks: - agent-net healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8300/health"] interval: 10s timeout: 5s retries: 3 start_period: 10s deploy: resources: limits: cpus: '0.5' memory: 256M # ============ CORE - Agent + Tools + HTTP API ============ core: build: ./core container_name: core restart: unless-stopped # Uncomment to expose port (set CORE_PORT in .env): # ports: # - "${CORE_PORT:-4000}:4000" depends_on: proxy: condition: service_healthy tools-api: condition: service_healthy scheduler: condition: service_healthy environment: - TZ=${TZ:-Europe/Moscow} - PROXY_URL=http://proxy:3200 - TOOLS_API_URL=http://tools-api:8100 - SCHEDULER_URL=http://scheduler:8400 - WORKSPACE=/workspace - WORKSPACE_HOST_PATH=${PWD}/workspace - EXPOSED_PORTS=5000-5099 - AGENT_CWD=/workspace - API_PORT=4000 - BOT_URL=http://bot:4001 - USERBOT_URL=http://userbot:8080 - LOG_LEVEL=${LOG_LEVEL:-INFO} - ADMIN_USER_ID=${ADMIN_USER_ID:-809532582} - ACCESS_MODE=${ACCESS_MODE:-public} secrets: - model_name volumes: - ./workspace:/workspace - ./workspace/_shared:/data # Skills, shared data, and admin config - /var/run/docker.sock:/var/run/docker.sock - ./workspace/_shared/google_creds:/data/google_creds # Share Google credentials with MCP networks: - agent-net cap_drop: - ALL cap_add: - CHOWN - SETUID - SETGID - NET_BIND_SERVICE security_opt: - no-new-privileges:true deploy: resources: limits: cpus: '2.0' memory: 2G pids: 300 reservations: cpus: '0.5' memory: 512M tmpfs: - /tmp:size=100M,mode=1777 healthcheck: test: ["CMD", "curl", "-f", "http://localhost:4000/health"] interval: 30s timeout: 10s retries: 3 start_period: 15s # ============ BOT - Telegram Bot (Telegraf) ============ bot: build: ./bot container_name: bot restart: unless-stopped # Uncomment to expose port (set BOT_PORT in .env): # ports: # - "${BOT_PORT:-4001}:4001" depends_on: core: condition: service_healthy environment: - TZ=${TZ:-Europe/Moscow} - CORE_URL=http://core:4000 - PROXY_URL=http://proxy:3200 - BOT_PORT=4001 - MAX_CONCURRENT_USERS=10 - ADMIN_USER_ID=${ADMIN_USER_ID:-809532582} # Access Control (admin, allowlist, public, pairing) - ACCESS_MODE=${ACCESS_MODE:-admin} - ALLOWED_USERS=${ALLOWED_USERS:-} # ASR (Speech-to-Text) - Faster-Whisper - ASR_URL=${ASR_URL:-http://host.docker.internal:8080} - ASR_MAX_DURATION=${ASR_MAX_DURATION:-120} - ASR_TIMEOUT=${ASR_TIMEOUT:-60} - ASR_LANGUAGE=${ASR_LANGUAGE:-ru} secrets: - telegram_token - model_name volumes: - ./workspace/_shared:/data # For pairing.json storage networks: - agent-net deploy: resources: limits: cpus: '0.5' memory: 512M healthcheck: test: ["CMD", "curl", "-f", "http://localhost:4001/health"] interval: 30s timeout: 10s retries: 3 start_period: 10s # ============ USERBOT - Telethon agent ============ userbot: build: ./userbot container_name: userbot restart: unless-stopped # Uncomment to expose port (set USERBOT_PORT in .env): # ports: # - "${USERBOT_PORT:-8080}:8080" profiles: - userbot depends_on: core: condition: service_healthy environment: - TZ=${TZ:-Europe/Moscow} - CORE_URL=http://core:4000 - RESPONSE_CHANCE_DM=1.0 - RESPONSE_CHANCE_GROUP=0.1 - RESPONSE_CHANCE_MENTION=1.0 - RESPONSE_CHANCE_REPLY=1.0 - COOLDOWN_SECONDS=0 - OWNER_ID=${OWNER_ID:-809532582,65341407} - OWNER_ONLY=true secrets: - telegram_api_id - telegram_api_hash - telegram_phone volumes: - ./userbot/session:/app/session networks: - agent-net deploy: resources: limits: cpus: '0.5' memory: 256M # ============ ADMIN - React Web Panel ============ # SECURITY: Basic Auth + localhost binding. Use SSH tunnel for remote access admin: build: ./admin container_name: admin restart: unless-stopped ports: - "${ADMIN_PORT:-3000}:3000" # Protected by Basic Auth (change via ADMIN_PORT env) environment: - TZ=${TZ:-Europe/Moscow} - ADMIN_USER=${ADMIN_USER:-admin} - ADMIN_PASSWORD_FILE=/run/secrets/admin_password secrets: - admin_password depends_on: core: condition: service_healthy networks: - agent-net healthcheck: test: ["CMD-SHELL", "curl -sf http://localhost:3000/health || exit 1"] interval: 30s timeout: 5s retries: 3 start_period: 10s deploy: resources: limits: cpus: '0.2' memory: 128M # ============ SECRETS ============ secrets: telegram_token: file: ./secrets/telegram_token.txt base_url: file: ./secrets/base_url.txt api_key: file: ./secrets/api_key.txt zai_api_key: file: ./secrets/zai_api_key.txt gdrive_client_id: file: ./secrets/gdrive_client_id.txt gdrive_client_secret: file: ./secrets/gdrive_client_secret.txt telegram_api_id: file: ./secrets/telegram_api_id.txt telegram_api_hash: file: ./secrets/telegram_api_hash.txt telegram_phone: file: ./secrets/telegram_phone.txt model_name: file: ./secrets/model_name.txt admin_password: file: ./secrets/admin_password.txt networks: agent-net: driver: bridge internal: false