version: '3.9'

services:
  mosquitto:
    image: eclipse-mosquitto:2
    volumes:
      - mosquitto_conf:/mosquitto/config
      - mosquitto_data:/mosquitto/data
      - mosquitto_log:/mosquitto/log
    networks:
      - traefik-public
    ports:
      - target: 1883
        published: 1883
        mode: host
    deploy:
      replicas: 1
      placement:
        constraints:
          - "node.labels.role==core"

volumes:
  mosquitto_conf:
    driver: local
  mosquitto_data:
    driver: local
  mosquitto_log:
    driver: local

networks:
  traefik-public:
    external: true
