version: "3.8"

services:
  router:
    build:
      context: ./services/router
      dockerfile: Dockerfile
    container_name: dagi-router-node2
    ports:
      - "127.0.0.1:9102:8000"
    environment:
      - NODE_ID=NODA2
      - DAGI_ROUTER_CONFIG=/app/router-config.yml
      - MEMORY_SERVICE_URL=http://memory-service:8000
      - NATS_URL=nats://dagi-nats:4222
      - QDRANT_HOST=qdrant-node2
      - QDRANT_PORT=6333
      - DATABASE_URL=postgresql://daarion:daarion_secret_node2@postgres-node2:5432/daarion_memory
      - NEO4J_BOLT_URL=bolt://neo4j-node2:7687
      - NEO4J_USER=neo4j
      - NEO4J_PASSWORD=daarion_node2_secret
      - CITY_SERVICE_URL=http://city-service:7001
      - PIECES_OS_URL=http://host.docker.internal:39300
      - NOTION_API_KEY=${NOTION_API_KEY:-}
    volumes:
      - ./router-config.yml:/app/router-config.yml:ro
      - ./logs:/app/logs
    extra_hosts:
      - "host.docker.internal:host-gateway"
      - "city-service:host-gateway"
      - "daarion-city-service:host-gateway"
    depends_on:
      - dagi-nats
    networks:
      - dagi-network
      - dagi-memory-network
    restart: unless-stopped

  gateway:
    build:
      context: ./gateway-bot
      dockerfile: Dockerfile
    container_name: dagi-gateway-node2
    ports:
      - "9300:9300"
    environment:
      - ROUTER_URL=http://router:8000
      - DAARWIZZ_NAME=DAARWIZZ
      - DAARWIZZ_PROMPT_PATH=/app/gateway-bot/daarwizz_prompt.txt
      - MEMORY_SERVICE_URL=http://memory-service:8000
    volumes:
      - ./logs:/app/logs
    depends_on:
      - router
    networks:
      - dagi-network
    restart: unless-stopped

  aurora-service:
    build:
      context: ./services/aurora-service
      dockerfile: Dockerfile
    container_name: aurora-service-node2
    ports:
      - "127.0.0.1:9401:9401"
    environment:
      - AURORA_DATA_DIR=/data/aurora
      - AURORA_PUBLIC_BASE_URL=http://127.0.0.1:9401
      - AURORA_CORS_ORIGINS=*
      - AURORA_MODELS_DIR=/data/aurora/models
      - AURORA_FORCE_CPU=false
      - AURORA_PREFER_MPS=true
      - AURORA_ENABLE_VIDEOTOOLBOX=true
    volumes:
      - aurora-data:/data
    networks:
      - dagi-network
    restart: unless-stopped

  dagi-nats:
    image: nats:2.10-alpine
    container_name: dagi-nats-node2
    ports:
      - "4222:4222"
      - "8222:8222"
    command: -c /etc/nats/nats-server.conf
    volumes:
      - ./nats-server.conf:/etc/nats/nats-server.conf:ro
    networks:
      - dagi-network
    restart: unless-stopped
    
  swapper-service:
    build:
      context: ./services/swapper-service
      dockerfile: Dockerfile
    container_name: swapper-service-node2
    ports:
      - "127.0.0.1:8890:8890"
    extra_hosts:
      - "host.docker.internal:host-gateway"
    environment:
      - OLLAMA_BASE_URL=http://host.docker.internal:11434
      - SWAPPER_CONFIG_PATH=/app/config/swapper_config_node2.yaml
      - SWAPPER_MODE=single-active
      - MODEL_SWAP_TIMEOUT=300
    volumes:
      - ./services/swapper-service/config:/app/config:ro
      - ./logs:/app/logs
    networks:
      - dagi-network
    restart: unless-stopped

networks:
  dagi-network:
    driver: bridge
    name: dagi-network-node2
  dagi-memory-network:
    external: true
    name: dagi-memory-network-node2

volumes:
  aurora-data:
    driver: local
