Hi,
I have a pipeline producing docker images with the complete stack onboard : mariadb, redis, apache, php, mosquitto and the main modules (sync, postprocess, backup)
So it is a kind of virtual twin for the physical emonpi, but without emonhub…
for an ephemeral test :
docker pull alexjunk/emoncms
docker run --rm -it alexjunk/emoncms
To get the container IP address : docker network inspect bridge
To send mqtt datas from the host if 172.17.0.2 is the container IP : mosquitto_pub -h 172.17.0.2 -u "emonpi" -P "emonpimqtt2016" -t 'emon/test/t3' -m 15
To run on a local network, use docker run -p :
docker run --rm -it -p 8080:80 alexjunk/emoncms
if 192.168.1.13
is the host IP, then emoncms can be reached via http://192.168.1.13:8080
The previous commands use the latest tag but you can find various images on the HUB
It is easy to use a client container to run a client app using emoncms databases or sending datas to it.
You just have to share the same network namespace :
docker run --rm --name=emoncms -it alexjunk/emoncms
the Dockerfile for a python client could be something like that :
ARG BUILD_FROM=alpine:3.16
FROM $BUILD_FROM
RUN set -x;\
apk update && apk upgrade;\
apk add --no-cache python3 py3-pip;\
python3 -m pip install --no-cache-dir mysql-connector-python redis paho-mqtt==1.6.1
RUN set -x;\
wget https://raw.githubusercontent.com/dromotherm/sandbox/master/emoncms/client_dockerfile/test.py
build :
docker build -t emoncms_client .
use :
docker run --rm --network=container:emoncms -it emoncms_client
Once connected :
python3 test.py
More on https://docker-emoncms.github.io
[Revised on request of @alexandrecuer – Moderator (RW)]