# https://github.com/IceWhaleTech/CasaOS-AppStore/blob/main/CONTRIBUTING.md

name: mosquitto
services:
  mosquitto:
    container_name: mosquitto
    command: >
      sh -c '
        if [ ! -f "/mosquitto/config/mosquitto.conf" ]; then
          echo -n "No config file found. Create one... "
          {
            echo "# config generated on $(date +%Y.%m.%d\ %H:%M:%S)"
            echo "allow_anonymous true"
            echo "listener 1883"
            echo "persistence true"
            echo "persistence_location /mosquitto/data/"
            echo "log_dest file /mosquitto/log/mosquitto.log"
          } > /mosquitto/config/mosquitto.conf
          if [ $? -eq 0 ]; then
            echo "done."
          else
            echo "error."
            exit 1
          fi
        fi
        echo "Starting Mosquitto"
        /usr/sbin/mosquitto -c /mosquitto/config/mosquitto.conf'
    image: eclipse-mosquitto:2
    labels:
      icon: https://raw.githubusercontent.com/mr-manuel/CasaOS-HomeAutomation-AppStore/latest/Apps/Mosquitto/icon.png
      traefik.enable: false
    network_mode: bridge
    ports:
      - target: 1883
        published: "1883"
        protocol: tcp
    restart: unless-stopped
    volumes:
      - type: bind
        source: /DATA/AppData/mosquitto/config
        target: /mosquitto/config
      - type: bind
        source: /DATA/AppData/mosquitto/data
        target: /mosquitto/data
    x-casaos:
      ports:
        - container: "1883"
          description:
            en_us: ""
      volumes:
        - container: /mosquitto/config
          description:
            en_us: Contains all configuration files.
        - container: /mosquitto/data
          description:
            en_us: Contains all data files.
x-casaos:
  architectures:
    - amd64
    - arm64
    - arm
  author: mr-manuel
  category: Home Automation
  description:
    en_us: |
      Visit [Eclipse Mosquitto](https://mosquitto.org) for more details. Check the [documentation](https://mosquitto.org/documentation/) for further settings.
  developer: Eclipse Mosquitto
  icon: https://raw.githubusercontent.com/mr-manuel/CasaOS-HomeAutomation-AppStore/latest/Apps/Mosquitto/icon.png
  # index: "/"
  main: mosquitto
  # port_map: "1883"
  project_url: https://github.com/mr-manuel/CasaOS-HomeAutomation-AppStore
  store_app_id: mosquitto
  tagline:
    en_us: |
      Eclipse Mosquitto is an open source (EPL/EDL licensed) message broker that implements the MQTT protocol versions 5.0, 3.1.1 and 3.1. Mosquitto is lightweight and is suitable for use on all devices from low power single board computers to full servers.
  thumbnail: https://raw.githubusercontent.com/mr-manuel/CasaOS-HomeAutomation-AppStore/latest/Apps/Mosquitto/icon.png
  tips:
    before_install:
      en_us: |
        The MQTT broker will be reachable at port `1883`.

        [Website](https://mosquitto.org) &bull; [Documentation](https://mosquitto.org/documentation/)
  title:
    en_us: Mosquitto
