Emoncms docker container in ingress mode

Last summer, I started working on a docker container for emoncms

I’ve just introduced (in version alpine3.19_emoncms11.5.0 and latest tag) the ingress facility, ie the possibility to run it inside another application, the two applications just behaving together as a single one.
The most evident use case is with home-assistant :

More explained here on how to use ingress with other reverse proxy than home-assistant core : How to deal with ingress version ? · Open-Building-Management/emoncms · Discussion #17 · GitHub

I think I have solved a backup problem that the addon was facing when restoring datas through the home-assistant backup tool. I hope the patch is OK and so feedback on that is welcome.

Best

Alex

2 Likes

Thanks @alexandrecuer, looks great!

@alexandrecuer - going to have another look at this. It is an excellent piece of work :grinning:

@alexandrecuer Thanks for creating this, it’s working great for me so far.

I’ve got all my applications running in docker containers on a rpi5 including HomeAssistant.

I installed Your docker emoncms 11.5.0 using docker compose last weekend and have been able to access it as a standalone app while away from home after adding it to my existing HA setup of npm/ nginx.
I manually backed up my existing emoncms rpi4 data using the emoncms backup script and restored the data to the docker emoncms running on a rpi5 and the restore went fine.
I’ve just added an emonesp to my emontx setup and it’s now posting data via mqtt to the docker emoncms fine. The docker emoncms is also sending and receiving data to my openevse charger via the api and via mqtt.
Apart from a hiccup getting the emontx running with wifi, this was so quick to setup using docker compose.
What I don’t understand is why you created it as an addon for the non docker version of HA, instead of possibly adding it via HACS to the docker version of HA, or am I missing something.

Thanks for the feedback

When i started this, i did not know HACS and right now i know very little about it. At the very beginning i just wanted to have a standalone container for emoncms. But @borpin told me it could be nice to also have this container working as a addon for home assistant. At that time i did not know home assistant, so i installed home assistant operating system and when i realized the mods were very light i just turned it into a addon. Maybe it could be be adapted another time to work through HACS :slight_smile:

OK now I understand :smiley:
It’s working great standalone for me anyway.

The key thing about this IMHO, is that a user who currently has HA, now simply needs a TXn with an ESP and an EmonVS.

Then they have an outstanding power measurement system linked to HA.

If that can then seamlessly send the data to HA as well, you have the best of both worlds.

No, HACS is for Custom Integrations not addons. What HACS installs is part of the HomeAssistant Core ‘docker’, while addons are additional Docker instances. This is something that is easily confused.

@nrgbod - you are confusing 2 issues here. The Docker version of HA is just that, a Docker version of the HomeAssistant Core without the underlying HAOS.

Thanks @Borpin, I also thought that HACS only concerned integrations, but I wasn’t sure.

1 Like

The key thing about this standalone Docker version of emoncms (IMHO), is that a user who currently has HA, now simply needs a TXn with an ESP and an EmonVS.

Then they have an outstanding power measurement system linked to HA.

If that can then seamlessly send the data to HA as well, you have the best of both worlds.

1 Like

Or just an emontx and a raspberry pi with home assistant onboard and a usb radio key.

For my info, have you had a chance to test the restoration process in ha ?

Hi @alexandrecuer just updated :slight_smile:

So I run a slighly odd setup in that I have ‘local’ SSL certificates and run the main HA as an internal HTTPS domain (valid sub domains but not routable).

The log is showing

AH00526: Syntax error on line 16 of /etc/apache2/conf.d/emoncms.conf:
SSLCertificateFile: file '/var/www/fullchain.pem' does not exist or is empty

Config

image

as I do for other addons (e.g. AdGuard) which work.

I also notice that for AdGuard, it doesn’t specify a port, the Node-RED addon does.

you need to give the full path for CRT_FILE and KEY_FILE, for example
/addon_configs/a0d7b954_nginxproxymanager/letsencrypt/live/npm-1/cert.pem

you need to find where are your certificates, then can be in /addon_configs if they comes from nginx proxy manager or from another addon

But anyway as it is in ingress mode, you dont need to add certificates

I’m running Home Assistant Core 2024.5, Supeervisor 2024.04.4, Operating System 12.2, frontend 20240501.0. When I go to Addon I cannot fine the “emoncms” addon. Do I need to update something for this to appear? I’m currently getting my data from my emoncms via config yaml entries.

To integrate the addon in the store, just follow this :

In the store panel you need to click on the button at the top right, then on repositories to add the github repo of the addon

Home assistant is still fairly new to me. What do I need to change in the configuration?

Nothing I think

here are the steps :

Then paste https://github.com/Open-Building-Management/emoncms in the Box and click on Add

You should see the addon in your store

Sorry I did manage to do that but when I start the addon and try to run it I get this error.

maybe you have to wait the database to be ready, what do you have in the addon’s log ?

have attached log file.
60ed1c84_emoncms_2024-05-02T12-39-02.688Z.txt (8.4 KB)

Strange, i run the arm64 docker image on a raspberry pi4 (armv8) and it is working fine.

According to the log, it is starting, crashing and restarting, the mariadb database does not succeed in finalizing its initialization process…i see block size is 4096, so running on a rapsberry 5 ? Don’t have one myself…

You should stop the addon. Is the machine slowed down by those repeated crashes ?

Could please you check if the official mariadb addon is able to run ? It should be available in the store