services:
  # Redis/Kvrocks for session storage
  kvrocks:
    image: apache/kvrocks:latest
    command: --bind 0.0.0.0 --dir /data
    ports:
      - "6666:6666"
    volumes:
      - ./data/kvrocks:/data

  # Use the real hytale-auth-server with debug wrapper
  auth-server:
    build:
      context: ../../hytale-auth-server
      dockerfile: ../Hytale-F2P/local-dev/Dockerfile.debug
    ports:
      - "3000:3000"
      - "3443:3443"
    environment:
      - PORT=3000
      - HTTPS_PORT=3443
      - DOMAIN=localhost:3443
      - USE_TLS=false
      - DATA_DIR=/app/data
      - REDIS_URL=redis://kvrocks:6666
      - ADMIN_PASSWORD=localdev
      - DEBUG_MODE=true
      - KEY_ID=2025-10-01-sanasol
    volumes:
      - ./data/auth:/app/data
      # Mount debug wrapper as entry point
      - ./debug-wrapper.js:/app/src/debug-wrapper.js:ro
    depends_on:
      - kvrocks
    healthcheck:
      test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/health"]
      interval: 5s
      timeout: 3s
      retries: 10

networks:
  default:
    name: hytale-local-dev
