version: '3.8'

services:
  emqx:
    image: emqx/emqx:latest
    container_name: emqx
    restart: unless-stopped
    environment:
      - EMQX_NAME=emqx
      - EMQX_HOST=iot.lambicall.com
      - EMQX_DASHBOARD__DEFAULT_USERNAME=admin
      - EMQX_DASHBOARD__DEFAULT_PASSWORD=public
    ports:
      # MQTT TCP port
      - "1883:1883"
      # MQTT SSL/TLS port
      - "8883:8883"
      # MQTT WebSocket port
      - "8083:8083"
      # MQTT WebSocket SSL/TLS port
      - "8084:8084"
      # Dashboard and REST API
      - "18083:18083"
    volumes:
      - ./data:/opt/emqx/data
      - ./log:/opt/emqx/log
      - ./etc:/opt/emqx/etc
    networks:
      - emqx-network
    healthcheck:
      test: ["CMD", "/opt/emqx/bin/emqx", "ping"]
      interval: 10s
      timeout: 10s
      retries: 5
      start_period: 30s

networks:
  emqx-network:
    driver: bridge
