version: '3.8'

services:
  notifier:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: notifier
    ports:
      - "8080:8080"   # REST API
      - "50051:50051" # gRPC
      - "9090:9090"   # Metrics (future)
      - "8081:8081"   # Health check (future)
    volumes:
      - ./config.yaml:/app/config.yaml:ro
      - notifier-data:/var/lib/notifier
    environment:
      - NOTIFIER_SERVER_MODE=both
      - NOTIFIER_LOGGING_LEVEL=info
    restart: unless-stopped
    networks:
      - notifier-net
    healthcheck:
      test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 10s

  # Optional: Kafka for distributed queue
  # kafka:
  #   image: confluentinc/cp-kafka:latest
  #   container_name: kafka
  #   ports:
  #     - "9092:9092"
  #   environment:
  #     KAFKA_BROKER_ID: 1
  #     KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
  #     KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092
  #     KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
  #   depends_on:
  #     - zookeeper
  #   networks:
  #     - notifier-net

  # zookeeper:
  #   image: confluentinc/cp-zookeeper:latest
  #   container_name: zookeeper
  #   ports:
  #     - "2181:2181"
  #   environment:
  #     ZOOKEEPER_CLIENT_PORT: 2181
  #     ZOOKEEPER_TICK_TIME: 2000
  #   networks:
  #     - notifier-net

  # Optional: Prometheus for metrics collection
  # prometheus:
  #   image: prom/prometheus:latest
  #   container_name: prometheus
  #   ports:
  #     - "9091:9090"
  #   volumes:
  #     - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
  #     - prometheus-data:/prometheus
  #   command:
  #     - '--config.file=/etc/prometheus/prometheus.yml'
  #     - '--storage.tsdb.path=/prometheus'
  #   networks:
  #     - notifier-net

  # Optional: Grafana for visualization
  # grafana:
  #   image: grafana/grafana:latest
  #   container_name: grafana
  #   ports:
  #     - "3000:3000"
  #   environment:
  #     - GF_SECURITY_ADMIN_PASSWORD=admin
  #   volumes:
  #     - grafana-data:/var/lib/grafana
  #   depends_on:
  #     - prometheus
  #   networks:
  #     - notifier-net

networks:
  notifier-net:
    driver: bridge

volumes:
  notifier-data:
  # prometheus-data:
  # grafana-data:
