services:
  soketi:
    image: quay.io/soketi/soketi:1.6-16-alpine
    container_name: finaegis-websocket
    ports:
      - "${SOKETI_PORT:-6001}:6001"
      - "${SOKETI_METRICS_PORT:-9601}:9601"
    environment:
      SOKETI_DEBUG: "${SOKETI_DEBUG:-1}"
      SOKETI_DEFAULT_APP_ID: "${PUSHER_APP_ID:-finaegis-local}"
      SOKETI_DEFAULT_APP_KEY: "${PUSHER_APP_KEY:-finaegis-key}"
      SOKETI_DEFAULT_APP_SECRET: "${PUSHER_APP_SECRET:-finaegis-secret}"
      SOKETI_ADAPTER_DRIVER: "${SOKETI_ADAPTER_DRIVER:-local}"
      SOKETI_ADAPTER_REDIS_HOST: "${REDIS_HOST:-redis}"
      SOKETI_ADAPTER_REDIS_PORT: "${REDIS_PORT:-6379}"
      SOKETI_ADAPTER_REDIS_DB: "${SOKETI_REDIS_DB:-3}"
      # Rate limiting
      SOKETI_RATE_LIMITER_DRIVER: "${SOKETI_RATE_LIMITER_DRIVER:-local}"
      SOKETI_APP_MANAGER_DRIVER: "${SOKETI_APP_MANAGER_DRIVER:-array}"
      # SSL (optional - for production)
      SOKETI_SSL_CERT: ""
      SOKETI_SSL_KEY: ""
      # Metrics
      SOKETI_METRICS_ENABLED: "${SOKETI_METRICS_ENABLED:-true}"
      SOKETI_METRICS_DRIVER: prometheus
    healthcheck:
      test: ["CMD", "wget", "-q", "-O", "-", "http://localhost:6001/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s
    restart: unless-stopped
    networks:
      - finaegis

  # Optional: Redis for production scaling with multiple Soketi instances
  # Uncomment if SOKETI_ADAPTER_DRIVER=redis
  # redis:
  #   image: redis:7-alpine
  #   container_name: finaegis-websocket-redis
  #   ports:
  #     - "6380:6379"
  #   volumes:
  #     - redis-data:/data
  #   restart: unless-stopped
  #   networks:
  #     - finaegis

networks:
  finaegis:
    driver: bridge

# volumes:
#   redis-data:
