Hello,
I was wondering about possibilities of implementing Big Clown dongle into existing installation of Node-RED running on Docker on RPi 3B+.
Hi,
you can run bcg in separate docker container, I have similar setup running on kubernetes. You need just ensure, that user running bcg in docker container has proper access rights to dongle device – I created OS user on host with same UID as user in container and added him to dialout group (dialout is used for debian based distros). Then you need to propagate dongle device into container.
I created simple startup skript (start.sh):
#!/bin/bash
# some sane default values for configuration variables
# not using localhost as we know for sure there is no MQTT broker there
MQTT_HOST=${MQTT_HOST:-mosquitto}
MQTT_PORT=${MQTT_PORT:-1883}
DEV=( $(bcg devices | grep USB) )
if [ -z "${DEV[0]}" ]
then
echo "No BigClown dongle found!"
exit 1
fi
if [ "${#DEV[*]}" -gt 1 ]
then
echo "WARNING: Multiple BigClown dongles found, only first one is used: ${DEV[@]}"
fi
exec bcg --device "${DEV[0]}" --mqtt-host "$MQTT_HOST" --mqtt-port "$MQTT_PORT"
$PARAMS
and Dockerfile:
# BigClown Gateway
FROM python:3-slim
VOLUME /tmp
# Dependencies
RUN pip3 install --upgrade --no-cache-dir bcg bcf bch ; \
adduser --disabled-password --gecos='BigClown Gateway,,,' --uid 23912 --home /bcg bcg; chown bcg:bcg /tmp ; adduser bcg dialout
USER bcg
WORKDIR /bcg
COPY --chown=bcg:bcg start.sh /bcg/
CMD ["/bcg/start.sh"]
Hi @geproha,
so you have node-red in a docker.
You can run bcg without beign dockered. But bcg
and node-red communicate over MQTT. Do you have also some MQTT broker running on your system or in the node-red docker container? If not, then just follow ubuntu installation steps and install mosquitto and bcg. Then in your node-red docker you have to open MQTT port 1883
to reach from docker to your system.
Of course, you can dockerize bcg/mosquitto. In any case, you’ll have to use system IP address in your node-red MQTT nodes, because if you use localhost
in your docker, it points to your node-red docker, not to your system whre mosquitto is running.
I’m not expert in Docker, but if you give me answers to questions above, I’ll ask colleague @Karel who is experienced and can give you specific commands how to set-up things.