# ==============================================
# AZEROTHCORE TOOLS DOCKER COMPOSE
# ==============================================
# Web interfaces and monitoring tools for AzerothCore
# This stack connects to the core AzerothCore database

services:
  # PHPMyAdmin Database Management Interface
  ac-phpmyadmin:
    image: phpmyadmin/phpmyadmin:latest
    container_name: ac-phpmyadmin
    environment:
      PMA_HOST: ${PMA_HOST:-ac-mysql}
      PMA_PORT: ${PMA_PORT:-3306}
      PMA_USER: ${PMA_USER:-root}
      PMA_PASSWORD: ${MYSQL_ROOT_PASSWORD:-password}
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-password}
      PMA_ARBITRARY: ${PMA_ARBITRARY:-1}
      PMA_ABSOLUTE_URI: ${PMA_ABSOLUTE_URI:-}
      UPLOAD_LIMIT: ${PMA_UPLOAD_LIMIT:-300M}
      MEMORY_LIMIT: ${PMA_MEMORY_LIMIT:-512M}
      MAX_EXECUTION_TIME: ${PMA_MAX_EXECUTION_TIME:-600}
    ports:
      - "${PMA_EXTERNAL_PORT:-8081}:80"
    restart: unless-stopped
    networks:
      - azerothcore

  # Keira3 Database Editor (Production Ready)
  ac-keira3:
    image: uprightbass360/keira3:latest
    container_name: ac-keira3
    restart: unless-stopped
    environment:
      - NODE_ENV=production
      - KEIRA_PORT=8080
      - KEIRA_HOST=0.0.0.0
      - KEIRA_DATABASE_HOST=${KEIRA_DATABASE_HOST:-ac-mysql}
      - KEIRA_DATABASE_PORT=${KEIRA_DATABASE_PORT:-3306}
      - KEIRA_DATABASE_USER=root
      - KEIRA_DATABASE_PASSWORD=${MYSQL_ROOT_PASSWORD:-password}
      - KEIRA_DATABASE_NAME=acore_world
    ports:
      - "${KEIRA3_EXTERNAL_PORT:-4201}:8080"
    deploy:
      resources:
        limits:
          memory: 512M
          cpus: '0.5'
        reservations:
          memory: 256M
          cpus: '0.25'
    healthcheck:
      test: ["CMD", "sh", "-c", "curl -f http://localhost:8080/health || nc -z localhost 8080 || exit 1"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
    logging:
      driver: json-file
      options:
        max-size: "10m"
        max-file: "3"
    security_opt:
      - no-new-privileges:true
    networks:
      - azerothcore

networks:

  azerothcore:
    external: true
    name: azerothcore