As I posted yesterday, the kwh_accumulator process in emoncms requires Redis to be available. Fortunately there’s a Docker image for that and it was just a case of pulling the image and starting it. I came up with a systemd unit configuration once I’d checked it was running:
[Unit] Description=Redis Container After=docker.service Requires=docker.service [Service] TimeoutStartSec=0 Restart=always ExecStartPre=-/usr/bin/docker stop redis ExecStartPre=-/usr/bin/docker rm redis ExecStartPre=/usr/bin/docker pull redis ExecStart=/usr/bin/docker run --rm -t -p 6379:6379 redis [Install] WantedBy=multi-user.target
and then it was just a case of
sudo systemctl daemon-reload sudo systemctl start docker-redis
to get it all going.
I was fairly sure I had my emoncms Docker image pretty much where I wanted it at this point, so I produced another systemd config to start it as well:
[Unit] Description=emoncms Container After=docker.service After=docker-redis.service Requires=docker.service Requires=docker-redis.service [Service] TimeoutStartSec=0 Restart=always ExecStartPre=-/usr/bin/docker stop emoncms ExecStartPre=-/usr/bin/docker rm emoncms ExecStart=/usr/bin/docker run --rm -t -p 80:80 -v /var/lib/emoncms:/var/opt/emoncms emoncms [Install] WantedBy=multi-user.target
Happily that also appeared to work first time using
sudo systemctl daemon-reload sudo systemctl start docker-emoncms
I cleared out all of my existing configuration and re-entered it, restarted my script that publishes the data from the RFXcom unit to MQTT and within seconds had data appearing in the emoncms feeds!
I’m very pleased to have got this far. Now I want to go back and submit a few pull requests for various bits of emoncms to resolve the occasional problem and add the supervisord functionality, but first I’ve just discovered that I used the wrong script to grab data from MQTT and push it into emoncms (there are two, near-identical, and I chose the wrong one!), so I need to update my image to use the correct one.
There’s more I want to look at with emoncms, but before I can do that I think I need a bit of data to play with, so I’ll probably let things run for a few days and come back to it next week.