I'm working on a smart house IOT university project and I have set of questions regarding terminology and solutions, my project steps are as following:
Frontend interface where he can see devices values and turn off/on devices. (Done)
CRUD API that interacts with the Frontend. (Done)
Dockerized Mosquitto-broker over websockets on cloud. (SEMI done)
API to SUB/PUB + Create users/roles/groups and interacts with the broker. (Semi done)
RaspberryPi set as home Gateway, its the house ID that scans for equipment over Bluetooth, connects and get values / turn off / turn on devices based on user demand. ( 0 Thoughts )
Terminology for step 3 4:
- My plan is to host my docker container that has mosquitto service in it and its configurations, and then host on another server a Rest-API on Render.com and hopefully interact with the docker container from the web browser that's sending POST/GET to the API, I've considered this approach because I don't know any other approach, I don't know if I can HOST an API and mosquitto service under one container. PS: I'm new to docker.
Progress and Problems:
Step 1 Done.
Step 2 Done.
Step 3: I've setup my mosquitto with dynamic security and did all conf's necessary to get it working in docker and it is working, I can publish and subscribe over Websocket:9001 using Mqtt-NodeJs-Client problem now is finding a free hosting service to host my docker container. Considering ( terminology for step 3 4).
Step 4: While trying to make a Rest-API that interacts with broker, I've noticed that I can't make Roles/Groups/Users from Mqtt-NodeJs-Client, I did some research and according to Mosquitto-dynamic-security documentation:
publishClientSend:
$CONTROL/dynamic-security/#- this allows the client to control the Dynamic security plugin.All control of the plugin after initial installation is through the MQTT topic API at
$CONTROL/dynamic-security/v1. This allows integrations to be built, but isn't the best choice for people to use directly. Themosquitto_ctrlcommand provided with Mosquitto implements support for the dynamic security plugin API, as described below. Other options include the Cedalo-MMC which is an open source web based tool for controlling the plugin and other features. The Management Center is not part of the Mosquitto project.As noted above we can publish to
$CONTROL/dynamic-security/#I've thought of doing so from the API to create users / groups / roles and add users to groups and I failed, there's lack of documentation, on further researches "correct me if I'm wrong I lack docker experience" but I think we can create some SH/BASH scripts on the container that usesmosquitto_ctrlfor dynamic security plugin to create users / groups and roles on demand, I've thought i can make the API somehow tell the hosted docker container to execute those scripts but I thought asking would be better than engaging.I haven't touched on this part at all, I'm thinking I can make a communication between RasberryPi and broker just like I did with Web interface and broker via Websockets.
Please provide any information, business terminology, or even workflow on how things should go, additionally my main problem at the moment is making this API work and being able to make users, groups, roles and add users to groups from a web browser not from a CLI.