Help installing Emoncms Docker on DSM7

I have done a search for help but not finding anything recent. I have pull the docker image here: https://registry.hub.docker.com/layers/openenergymonitor/emoncms/latest/ from the Synology I have my HA and MQTT docker images on.

The docker container was recently updated and I am hoping is being maintained.

I have tried to point Emoncms to my MQTT broker with environment variables with no luck.

I am new to everything here: MQTT, HomeAssistant and Emon.

Running on a Synology DS920+, running latest 7.2.2

HP hardware does not matter but, I have a split Daikin 16kW unit with buffer and I am using hardware from Arnold Here: P1P2MQTT/doc/HomeAssistant.md at main · Arnold-n/P1P2MQTT · GitHub

I am wanting to add my data to OpenEnergy - not the best but an ok CoP from my calculation. I still need to buy/install a power meter for this to all work but wanted to get the software side up first.

From logs on Emoncms Docker

2025/01/27 14:06:04	stdout	2025-01-27 14:06:04,081 INFO gave up: apache entered FATAL state, too many start retries too quickly
2025/01/27 14:06:03	stdout	2025-01-27 14:06:03,080 INFO exited: apache (exit status 1; not expected)
2025/01/27 14:06:03	stdout	2025-01-27 14:06:03,067 INFO exited: emoncms_mqtt (exit status 255; not expected)
2025/01/27 14:06:03	stdout	2025-01-27 14:06:02,736 INFO spawned: 'emoncms_mqtt' with pid 57
2025/01/27 14:06:02	stdout	2025-01-27 14:06:02,734 INFO spawned: 'apache' with pid 56
2025/01/27 14:06:01	stdout	2025-01-27 14:06:01,731 INFO exited: emoncms_mqtt (exit status 255; not expected)
2025/01/27 14:06:01	stdout	2025-01-27 14:06:01,731 INFO success: emoncms_mqtt entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025/01/27 14:06:00	stdout	2025-01-27 14:06:00,703 INFO spawned: 'emoncms_mqtt' with pid 55
2025/01/27 14:05:59	stdout	2025-01-27 14:05:59,701 INFO exited: apache (exit status 1; not expected)
2025/01/27 14:05:59	stdout	2025-01-27 14:05:59,689 INFO exited: emoncms_mqtt (exit status 255; not expected)
2025/01/27 14:05:59	stdout	2025-01-27 14:05:59,610 INFO spawned: 'emoncms_mqtt' with pid 44
2025/01/27 14:05:59	stdout	2025-01-27 14:05:59,608 INFO spawned: 'apache' with pid 43
2025/01/27 14:05:58	stdout	2025-01-27 14:05:58,605 INFO exited: emoncms_mqtt (exit status 255; not expected)
2025/01/27 14:05:58	stdout	2025-01-27 14:05:58,605 INFO success: emoncms_mqtt entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025/01/27 14:05:57	stdout	2025-01-27 14:05:57,588 INFO exited: apache (exit status 1; not expected)
2025/01/27 14:05:57	stdout	2025-01-27 14:05:57,577 INFO spawned: 'emoncms_mqtt' with pid 42
2025/01/27 14:05:57	stdout	2025-01-27 14:05:57,500 INFO exited: emoncms_mqtt (exit status 255; not expected)
2025/01/27 14:05:57	stdout	2025-01-27 14:05:57,499 INFO success: emoncms_mqtt entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025/01/27 14:05:57	stdout	2025-01-27 14:05:57,499 INFO spawned: 'apache' with pid 31
2025/01/27 14:05:56	stdout	2025-01-27 14:05:56,481 INFO exited: apache (exit status 1; not expected)
2025/01/27 14:05:56	stdout	2025-01-27 14:05:56,471 INFO spawned: 'emoncms_mqtt' with pid 30
2025/01/27 14:05:56	stdout	2025-01-27 14:05:56,469 INFO exited: emoncms_mqtt (exit status 255; not expected)
2025/01/27 14:05:56	stdout	2025-01-27 14:05:56,376 INFO spawned: 'apache' with pid 19
2025/01/27 14:05:56	stdout	2025-01-27 14:05:56,168 INFO exited: apache (exit status 1; not expected)
2025/01/27 14:05:55	stdout	2025-01-27 14:05:54,877 INFO success: emoncms_mqtt entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025/01/27 14:05:54	stdout	2025-01-27 14:05:54,877 INFO success: apache entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2025/01/27 14:05:53	stdout	2025-01-27 14:05:53,875 INFO spawned: 'emoncms_mqtt' with pid 8
2025/01/27 14:05:53	stdout	2025-01-27 14:05:53,860 INFO spawned: 'apache' with pid 7
2025/01/27 14:05:53	stdout	2025-01-27 14:05:52,842 INFO supervisord started with pid 1
2025/01/27 14:05:53	stdout	2025-01-27 14:05:52,842 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2025/01/27 14:05:52	stdout	2025-01-27 14:05:52,842 INFO RPC interface 'supervisor' initialized
2025/01/27 14:05:52	stdout	Unlinking stale socket /tmp/supervisor.sock
2025/01/27 14:05:52	stdout	2025-01-27 14:05:52,444 INFO Set uid to user 0 succeeded

which docker images do you use ?

Try the all in one cf https://emoncms-docker.github.io

I see the link I had in post was wrong. I tried this one.

https://registry.hub.docker.com/r/openenergymonitor/emoncms

I will try the one you suggest tomorrow.

As you are new to all this, as written, the standalone image is a better/simpler choice i think

Alexandre

I have used docker container you pointed to and seems to be working straight out the box. I ran in ephemeral-test. I will do the run compose with my local variables next but unclear on the apache2 files I need from the instruction.

Thanks for the pointer

Alexandre

While the ephemeral-test works out of box I have not had luck with running with my local setup. I know I have done something incorrect. The ephemeral-test show the site and I can see apps available … before spending time setting that all and it would be lost – I wanted to do this fully. After getting the docker up with the compose file I see this message when I try to go to the container:8081

Fatal error : Uncaught mysqli_sql_exception: No such file or directory in /var/www/emoncms/index.php:79 Stack trace: #0 /var/www/emoncms/index.php(79): mysqli->__construct() #1 {main} thrown in /var/www/emoncms/index.php on line 79

@letey1 : Do you have a /data folder on the host ? the container needs that. And this /data folder needs to be mounted inside the container as a volume. Can you show your compose file ? you have one here GitHub - Open-Building-Management/compose-files: compose files to use with docker-compose

I have mapped a data folder. Here is my compose file I used. I have an mqtt broker running in another contain on the same host.

services:
  emoncms:
    image: alexjunk/emoncms:alpine3.18_emoncms11.4.11
    volumes:
      - /volume5/data:/data
    environment:
      - TZ=Europe/London
      - REDIS_BUFFER=1 # 0 to disable low-write mode
      - EMONCMS_LOG_LEVEL=2 # 1=INFO, 2=WARN, 3=ERROR
      - MYSQL_DATABASE=emoncms
      - MYSQL_USER=emoncms
      - MYSQL_PASSWORD=emonpiemoncmsmysql2016
      - MQTT_USER=xxxxxx
      - MQTT_PASSWORD=xxxxxxxx
      - MQTT_HOST=localhost
      - MQTT_LOG_LEVEL=error
      - CRT_FILE=/etc/ssl/apache2/server.pem
      - KEY_FILE=/etc/ssl/apache2/server.key
      - CNAME=localhost
    ports:
       # These ports are in format <host-port>:<container-port>
      - 7443:443 # Public HTTPS Port 
      - 8081:80 # Public HTTP Port
      # - 9883:1883 # Public MQTT Port (if using the internal broker)
    restart: always

Do you have datas in your /volume5/data or nothing ?

It could be a permission problem.
it should be better to use a more recent version of the container (for example alpine3.19.1_emoncms11.5.2) tell me if it permits to avoid the mysqli exception…

By the way, MQTT host should be the broker IP, not locahost and the broker should be available on the 1883 port (there is no possibility to tune the port in the container)

Thanks again, it was a permission issue.
I hadn’t realised that the container was in bridge networking, so I now can see container logging into broker.

1 Like