I’ve spent a happy (hah!) evening trying to work out why emoncms wasn’t recording any data from MQTT. The documentation seems to claim it “just works”, but I just couldn’t see anything happening, even when I’d checked that the code is all starting with the correct configuration.
It’s taken quite a few hours to realise that the reason it doesn’t work in the Docker image is that there’s a second process to manage the incoming data feed that isn’t enabled. What’s more, Docker is really only set up with the intention of running one main process per container.
There are a couple of potential ways around this. The first is to run a script that starts both processes as the main command in the image. That might be ok, but it’s probably not good if one of them dies. In fairness, Apache itself seems pretty unlikely to die, but the php code for handling the MQTT data might. So whilst I might do this just to get a bit further with testing, it doesn’t seem like the right way to go long-term.
The other possibility is to use supervisord to start everything off. That means adding it to the image, but I think in the long run it’s the better bet.
It’s late now though, so this is something to look into tomorrow.