Emoncms in a LXD container

For anyone at the confluence of the “homebrew energy monitoring” and “Linux sysadmin” and “self-hosting” Venn diagram, it’s possible to run Emoncms in a LXD container, instead of on bare metal. I have a VPS hosted with Hetzner, and I use LXD containers on it for just about everything - DB, web, mail, etcetera.

I wrote up some short notes on getting it to work at Running emoncms in a Linux container – Cricalix.Net - basically you make the container look like a Pi in terms of username and available OS (the whole PHP 8 thing) packages, and it just works.

The only annoyance has been the requirement for the SHA fingerprint of the TLS certificate. With LetsEncrypt, my certs rotate every 90 days, and I don’t want to be updating the ESP8266 configuration every 90 days, so I live with port 80 traffic.

I’m waiting for an Mac Mini server to be shipped so I can setup Proxmox on it and LXCs for several apps I use at home (Pi-Hole, HA, etc).

There are scripts to set them up here: Proxmox VE Helper Scripts | Scripts for Streamlining Your Homelab with Proxmox VE
But none for emonCMS yet…

I have an old i5 laptop setup with Proxmox. Install the Ununtu LXC then just run the emonScripts (following the docs) and it just works!

Personally I do not install the Mosquitto Broker but have that on a separate LXC installed by those scripts you mention.

LXD? Only heard of LXC containers before.

Have you tried installation in a “Diet Pi” LXC (instead of Ubuntu)?

Many moons ago, but not an LXC as they didn’t support it then. Just as emoncms installed on a DietPi OS system on a Pi. Trouble with that was that the 2 different disk management systems tended to fight (emonSD uses log2ram - DietPi has this baked in).

The Ubuntu LXC is so lightweight anyway, it doesn’t need the added complexity of DietPi.

Thanks a lot.

1 Like