Emoncms docker container that works with local database (for openwrt and other)

hi there - I compiled some emoncms container that use local database . this way it can be used on more platforms architectures as the original emoncms-docker only works with amd64 ( as that what docker maridb container limited it too)


with amd64,arm64,mips64, arm7, arm6 and i386

if using on openwrt here a quick howto
download firmware for your device – Index of /releases/22.03.2/targets/

I use opensouce router base- BPI- R1, BPi-R2v1, BPI-R3 ( as they have build in SATA plus loads of other hardware) but can apply to many many other more simpler devices. you just may have to apply overlay first to get storage capacity

flash sd with openwrt - “startup disk creator”
resize partion with - “kde partition manager”

boot openwrt

ssh [email protected]

opkg update

opkg install docker docker-compose dockerd luci-app-dockerman nano bash mosquitto-client-ssl mosquitto-ssl

mkdir /svr
mkdir /svr/mysql

opkg install mariadb-client mariadb-client-extra mariadb-server mariadb-server-extra openvpn-openssl luci-app-openvpn

nano /etc/config/mysqld
→ option enabled ‘1’

opkg update && opkg install block-mount e2fsprogs kmod-fs-ext4 kmod-usb-storage kmod-usb2 kmod-usb3


log into webportal to setup overlay and/or openvpn port forwarding
add overlay disk if using one ( ie SSD or USB stick)
System> Mount Points > Mount points > add

openvpn port forwarding refer to this site
Howto - free/cheap VPN port forwarding for Starlink type systems (portmap.io) - Network and Wireless Configuration - OpenWrt Forum

backup - primary ( for faster system recovery in case of catastrophic failure)

now configure mariadb
mariadb -u root

you can use these or edit for your custom settings

CREATE USER 'emoncms'@'localhost' IDENTIFIED BY 'qwerty0987';
GRANT ALL PRIVILEGES ON *.* TO 'emoncms'@'localhost';

change openwrt webport from 80 to something else ie 88

nano /etc/config/uhttpd


select appropriate container for your device
docker pull sash999/emoncms_localdb:arm6
docker pull sash999/emoncms_localdb:arm7
docker pull sash999/emoncms_localdb:386
docker pull sash999/emoncms_localdb:mips64
docker pull sash999/emoncms_localdb:arm64
docker pull sash999/emoncms_localdb:amd64
(if you need other let me know I will see if I can compile)
once finished downloading container

now log into webportal ( new port address )

go to docker > container then press add

Name emoncms
image - sash999/emoncms_localdb
network - host-host
timezone- “what ever your timezone is”

save then then connect

if you wish custom setting emoncms setting once it started you can go to edit> console > connect then cd /var/www/emoncms then nano settings.ini

I See when using docker – localhost refers to within the docker container system. refers to the host environment so choose carefully whether you use localhost or it depends on what and where you have to communicate with
adjust as you like --I did not install redis container as I use a ssd overlay . if you wish to use redis
docker pull redis
and setup in docker

i will post git hub for it a little bit later as I clean it it up a bit

For those who might be curious – I’ve been testing on my bpi-r1 routers and it’s been working fine. (the emoncms docker image) Just can not get into using emoncms personally. But I created another docker image - zoneminder, to work within the OpenWrt enviroment along with emoncms. But I still prefer Domoticz and integrated as one as I have my live MQTT screen for viewing live data and just use Domoticz for historical data.
The BPi-R1 supports two network camera easily with load of <60%, but can support 3-4 in monitor mode, and the openwrt router still functions properly, handling zigbee2mqtt domoticz calls. As well as a functioning router

If anyone is interested in trying the openwrt environment, here’s a link on how to set it up.

I will now test on a quad core BPi and Intel bases as I’ve hit the limit of what I can do on BPi-r1 stably.

Have you ever tried DietPI as a lightweight install?

Lat time I tried ZoneMinder is was hellish for resources. Perhaps it has changed.

I tried it and many many other pi OS… I always come back to openwrt as it lightest , “easiest” and least buggy of the OSes-- even though it a bugger to work with sometimes . as you have compile software through a build engine … . everything that I run on my BPi-R1 normally from NAS, zigbeehub automation and databases etc… is normally only around ~10 - 14% cpu. normal pi OSes, it running double or triple that for the same operations

counter question have you ever tried openwrt as OS. try loading what you normally do on a PI (and your docker containers you usually use)… then do the same on openwrt . I am very sure you will be very pleasantly surprised. though you will not have desktop with openwrt you will have a web interface to do everything
here a snap shot of my openwrt energy monitor that was built 2018. and still going strong it cpu usage is quite low considering how much i really have going on in the router

other pi OS were choking on it and hitting constant bottle necks when ever there was cpu spike ie data base visualization chronogaf

Only as router SW. I don’t do docker, so there is no reason for me to use it. If I do need a lightweight OS I use DietPi - I know it so it is easy to use. However, virtually all the bits that were once on Pis are now on my PVE setup which I find far more intuitive than Docker.

No worries - I do not use docker either, just something I’ve been experimenting with lately.
I have been running everything I do off a single ~5w open source router .

1 Like