services:
  lightrag:
    container_name: lightrag
    image: git.baked.rocks/vasceannie/lightrag:latest
    build:
      context: .
      dockerfile: Dockerfile
      tags:
        - git.baked.rocks/vasceannie/lightrag:latest
    # network_mode: host
    networks:
      - rag-net
    ports:
      - "${PORT:-9621}:9621"
    volumes:
      - ./data/rag_storage:/app/data/rag_storage
      - ./data/inputs:/app/data/inputs
      - ./config.ini:/app/config.ini
      - ./.env:/app/.env
    env_file:
      - .env
    environment:
      - TIMEOUT=${TIMEOUT:-180}
      - LLM_TIMEOUT=${LLM_TIMEOUT:-180}
    restart: unless-stopped
    extra_hosts:
      - "host.docker.internal:host-gateway"
      # - "q.lab:192.168.50.210"
  neo4j:
    image: neo4j:latest
    container_name: memory-neo4j
    networks:
      - rag-net
    healthcheck:
      test: ["CMD-SHELL", "wget --quiet --tries=1 --spider http://localhost:7474 || exit 1"]
      interval: 10s
      timeout: 5s
      retries: 5
      start_period: 30s # Neo4j 2025 needs time to initialize metadata
    # env_file:
    #   - .env
    ports:
      - "7474:7474" # HTTP
      - "7687:7687" # Bolt (Standard port)
    volumes:
      - memory_neo4j_data:/data
      - memory_neo4j_logs:/logs
    restart: unless-stopped
    environment:
      - NEO4J_AUTH=${NEO4J_USER:-neo4j}/${NEO4J_PASSWORD:-squirtle123}
      # Recommended for 2025 versions to ensure performance:
      - NEO4J_PLUGINS=["apoc"] 
      - NEO4J_dbms_memory_heap_max__size=1G
      - NEO4J_server_config_strict__validation_enabled=false 

volumes:
  memory_neo4j_data:
    name: memory_neo4j_data
  memory_neo4j_logs:
    name: memory_neo4j_logs
networks:
  rag-net:
    driver: bridge
    name: rag-net
