# Mosquitto Broker for Smart City Simulator
# Usage: docker compose -f docker-compose.yml -f docker-compose.mosquitto.yml up -d
version: '3.8'

services:
  mosquitto:
    image: eclipse-mosquitto:latest
    container_name: smart-city-mosquitto
    restart: unless-stopped
    networks:
      - smartcity-shared
      - traefik-public
    ports:
      - "1883:1883"
      - "9001:9001"
    volumes:
      - mosquitto-data:/mosquitto/data
      - mosquitto-logs:/mosquitto/log
    command: mosquitto -c /mosquitto/config/mosquitto.conf
    healthcheck:
      test: ["CMD", "nc", "-z", "localhost", "1883"]
      interval: 30s
      timeout: 10s
      retries: 3

volumes:
  mosquitto-data:
  mosquitto-logs:

networks:
  smartcity-shared:
    external: true
  traefik-public:
    external: true
