From e1ad9ae2ac6b396a17d9efd4a17d4fbf5a520982 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Thu, 19 Dec 2019 13:17:35 +0100 Subject: [PATCH] mosquitto: Collection of small improvements (#910) * mosquitto: Prettier YAML & JSON files * mosquitto: Sort build.json * mosquitto: Update add-on URL * mosquitto: Code styling on Dockerfile * mosquitto: Tweaks documentation --- mosquitto/Dockerfile | 18 ++++++++++++--- mosquitto/README.md | 43 ++++++++++++++++++----------------- mosquitto/azure-pipelines.yml | 15 ++++++------ mosquitto/build.json | 4 ++-- mosquitto/config.json | 8 +++---- 5 files changed, 49 insertions(+), 39 deletions(-) diff --git a/mosquitto/Dockerfile b/mosquitto/Dockerfile index 360fc41..8883747 100644 --- a/mosquitto/Dockerfile +++ b/mosquitto/Dockerfile @@ -5,15 +5,27 @@ FROM $BUILD_FROM WORKDIR /usr/src ARG MOSQUITTO_AUTH_VERSION RUN apk add --no-cache \ - mosquitto curl openssl musl socat pwgen \ + curl \ + mosquitto \ + musl \ + openssl \ + pwgen \ + socat \ && apk add --no-cache --virtual .build-dependencies \ - build-base git mosquitto-dev curl-dev openssl-dev \ - && git clone --depth 1 -b ${MOSQUITTO_AUTH_VERSION} https://github.com/pvizeli/mosquitto-auth-plug \ + build-base \ + curl-dev \ + git \ + mosquitto-dev \ + openssl-dev \ + \ + && git clone --depth 1 -b "${MOSQUITTO_AUTH_VERSION}" \ + https://github.com/pvizeli/mosquitto-auth-plug \ && cd mosquitto-auth-plug \ && cp config.mk.in config.mk \ && make \ && mkdir -p /usr/share/mosquitto \ && cp -f auth-plug.so /usr/share/mosquitto \ + \ && apk del .build-dependencies \ && rm -fr /usr/src/mosquitto-auth-plug diff --git a/mosquitto/README.md b/mosquitto/README.md index 99c3758..b822f3f 100644 --- a/mosquitto/README.md +++ b/mosquitto/README.md @@ -10,7 +10,7 @@ You can use this add-on to install Eclipse Mosquitto, which is an open-source (E ## Installation -The installation of this add-on is straightforward and easy to do. +Follow these steps to get the add-on installed on your system: 1. Navigate in your Home Assistant frontend to **Hass.io** -> **Add-on Store**. 2. Find the "Mosquitto broker" add-on and click it. @@ -24,7 +24,8 @@ The add-on has a couple of options available. To get the add-on running: 2. Have some patience and wait a couple of minutes. 3. Check the add-on log output to see the result. -Create a new user for MQTT via the **Configuration** -> **Users (manage users)**. (Note: This name cannot be "homeassistant" or "addon") +Create a new user for MQTT via the **Configuration** -> **Users (manage users)**. +Note: This name cannot be `homeassistant` or `addon`, those are reserved usernames. To use the Mosquitto as a broker, go to the integration page and install the configuration with one click: @@ -102,38 +103,38 @@ It is possible to restrict access to topics based upon the user logged in to Mos See the following links for more information: -* [Mosquitto topic restrictions](http://www.steves-internet-guide.com/topic-restriction-mosquitto-configuration/) -* [Mosquitto.conf man page](https://mosquitto.org/man/mosquitto-conf-5.html) +- [Mosquitto topic restrictions](http://www.steves-internet-guide.com/topic-restriction-mosquitto-configuration/) +- [Mosquitto.conf man page](https://mosquitto.org/man/mosquitto-conf-5.html) Add the following configuration to enable **unrestricted** access to all topics. 1. Enable the customize flag -```json - "customize": { - "active": true, - "folder": "mosquitto" - }, -``` + ```json + "customize": { + "active": true, + "folder": "mosquitto" + }, + ``` 2. Create `/share/mosquitto/acl.conf` with the contents: -```text -acl_file /share/mosquitto/accesscontrollist -``` + ```text + acl_file /share/mosquitto/accesscontrollist + ``` 3. Create `/share/mosquitto/accesscontrollist` with the contents: -```text -user [YOUR_MQTT_USER] -topic readwrite # -``` + ```text + user [YOUR_MQTT_USER] + topic readwrite # + ``` The `/share` folder can be accessed via SMB, or on the host filesystem under `/usr/share/hassio/share`. ## Known issues and limitations -* Since version 4.1 of the add-on, an explicit ACL definition is now required if you plan to use legacy logins and `"anonymous": true` [see these instructions](#access-control-lists-acls). +- Since version 4.1 of the add-on, an explicit ACL definition is now required if you plan to use legacy logins and `"anonymous": true` [see these instructions](#access-control-lists-acls). ## Support @@ -141,9 +142,9 @@ Got questions? You have several options to get them answered: -* The [Home Assistant Discord Chat Server][discord]. -* The Home Assistant [Community Forum][forum]. -* Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit] +- The [Home Assistant Discord Chat Server][discord]. +- The Home Assistant [Community Forum][forum]. +- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit] In case you've found a bug, please [open an issue on our GitHub][issue]. diff --git a/mosquitto/azure-pipelines.yml b/mosquitto/azure-pipelines.yml index 7a70749..d7c76b5 100644 --- a/mosquitto/azure-pipelines.yml +++ b/mosquitto/azure-pipelines.yml @@ -3,20 +3,19 @@ trigger: branches: include: - - master + - master paths: include: - - mosquitto/* + - mosquitto/* pr: none variables: - name: versionBuilder - value: '2.0' + value: "2.0" - group: docker - jobs: -- template: /.azure/azp-template-addon.yml - parameters: - addon: 'mosquitto' - arch: '--all' + - template: /.azure/azp-template-addon.yml + parameters: + addon: "mosquitto" + arch: "--all" diff --git a/mosquitto/build.json b/mosquitto/build.json index bbbc2e0..cf2f348 100644 --- a/mosquitto/build.json +++ b/mosquitto/build.json @@ -1,10 +1,10 @@ { "build_from": { + "aarch64": "homeassistant/aarch64-base:3.10", "amd64": "homeassistant/amd64-base:3.10", - "i386": "homeassistant/i386-base:3.10", "armhf": "homeassistant/armhf-base:3.10", "armv7": "homeassistant/armv7-base:3.10", - "aarch64": "homeassistant/aarch64-base:3.10" + "i386": "homeassistant/i386-base:3.10" }, "args": { "MOSQUITTO_AUTH_VERSION": "0.1.4" diff --git a/mosquitto/config.json b/mosquitto/config.json index 3bb1089..9f4f419 100644 --- a/mosquitto/config.json +++ b/mosquitto/config.json @@ -3,7 +3,7 @@ "version": "5.1", "slug": "mosquitto", "description": "An Open Source MQTT broker", - "url": "https://home-assistant.io/addons/mosquitto/", + "url": "https://github.com/home-assistant/hassio-addons/tree/master/mosquitto", "arch": ["armhf", "armv7", "aarch64", "amd64", "i386"], "startup": "system", "boot": "auto", @@ -16,7 +16,7 @@ "1884/tcp": 1884, "8883/tcp": 8883, "8884/tcp": 8884 - }, + }, "options": { "logins": [], "anonymous": false, @@ -29,9 +29,7 @@ "require_certificate": false }, "schema": { - "logins": [ - {"username": "str", "password": "str"} - ], + "logins": [{ "username": "str", "password": "str" }], "anonymous": "bool", "customize": { "active": "bool",