Up to date docker container image?

I just installed emoncms in docker (because redis/ubuntu etc) but I notice that the UI around the HeatPump app was a little different (no instantaneous COP for example). I see that the bottom of the page announces

Powered by OpenEnergyMonitor.org 11.3.24

which makes me wonder if the docker image is a little stale?

Is there a way to get a more up to date one anywhere? Or to update one? On the whole, the docker solution is looking good for me, especially now I’ve tweaked it to bind mount rather than hide everything away in volumes. Makes backup/restore much more straightforward.

Thanks
Miles

Hello,

This is up to date : https://hub.docker.com/r/alexjunk/emoncms

It is a standalone image with everything inside

Included modules : graph, dashboard, app, sync, postprocess, backup

If you want emonhub, you have to run it in as a separate container

https://hub.docker.com/r/alexjunk/emonhub

2 Likes

Thanks @alexandrecuer,

I’ve updated the emoncms-docker repo to suggest using your version, I hope this is ok?

2 Likes

Thanks.

I managed to build a local container from the git sources, probably about the same time @alexandrecuer but I had no means to push it public (or confidence that it would work for anyone else).

Cheers.

Hi,

I tried swapping this image in today (I need the post-processor module) and it’s not working. I have a working setup and simply edited the top of my docker-compose.yml file

  web:
    image: alexjunk/emoncms
    #image: openenergymonitor/emoncms:latest

When I bring it up, there’s no database connectivity. I can jump into the db with mysql from the host running the docker containers and I can see that both root and emoncms users specify host ‘%’ in the mysql.users table, which was my first thought. Clearly I can connect from 127.0.0.1 (as root or emoncms).

db-1     | 2024-12-06 15:15:44 4 [Warning] Access denied for user 'root'@'172.18.0.4' (using password: NO)
web-1    | 2024-12-06 15:15:44 3 [Warning] Access denied for user 'emoncms'@'localhost' (using password: YES)
web-1    | [Fri Dec 06 15:15:44.744076 2024] [php:error] [pid 155:tid 155] [client 192.168.246.104:53340] PHP Fatal error:  Uncaught mysqli_sql_exception: Access denied for user 'emoncms'@'localhost' (using password: YES) in /var/www/emoncms/index.php:74\nStack trace:\n#0 /var/www/emoncms/index.php(74): mysqli->__construct()\n#1 {main}\n  thrown in /var/www/emoncms/index.php on line 74

My docker compose file remains otherwise unchanged:

services:
  # PHP & apache container using offical Docker PHP iamge
  web:
    image: alexjunk/emoncms
    #image: openenergymonitor/emoncms:latest
    build: web/.
    env_file:
    - '.docker-env'
    ports:
      # Expose Emoncms to the world on port 8080
      - 8080:80
    volumes:
    - type: bind
      source: /mnt/emoncms/phpfiwa
      target: /var/opt/emoncms/phpfiwa
      bind:
        create_host_path: true
    - type: bind
      source: /mnt/emoncms/phpfina
      target: /var/opt/emoncms/phpfina
      bind:
        create_host_path: true
    - type: bind
      source: /etc/localtime
      target: /etc/localtime
      read_only: true
      bind:
        create_host_path: true
    links:
      - db
      - redis

  redis:
    image: redis:7.0
    volumes:
    - type: bind
      source: /mnt/emoncms/redis-data
      target: /data
      bind:
        create_host_path: true
    logging:
      driver: json-file
      options:
        max-size: "10m"

  db:
    image: mariadb:11.0
    env_file:
    - '.docker-env'
    restart: always
    environment:
      - "MYSQL_HOST=localhost"
      - "MARIADB_AUTO_UPGRADE=1"
      - "MARIADB_INITDB_SKIP_TZINFO=1"
    ports:
      # Expose Emoncms to the world on port 80
      - 3306:3306
    volumes:
    - type: bind
      source: /mnt/emoncms/db-data
      target: /var/lib/mysql
      bind:
        create_host_path: true
    - type: bind
      source: /etc/localtime
      target: /etc/localtime
      read_only: true
      bind:
        create_host_path: true
    logging:
      driver: json-file
      options:
        max-size: "10m"

Do you have any ideas?

Cheers
Miles

Hello,

It is not a one to one replacement. Architectures and design decisions are different. alexjunk/emoncms is a multi services container, it ships everything on board, ie mariadb, redis, the mqtt broker and the workers like feedwriter or service runner

The container waits for a data folder with an emoncms folder inside structured like that :

As I do not use the openenergymonitor/emoncms image, I cannot test anything from my side. I would say it would be easier to backup the datas as an emoncms backup and then to restore into a container in the alexjunk/emoncms using the backup module.

So I would rather add a new service called emoncms in the compose using the alexjunk/emoncms, create an account, restore the tar.gz…see this :
https://emoncms-docker.github.io/setup/

1 Like

Hi Alex,

Thanks for the quick reply. I hadn’t realised that it was all-in-one. However, I think I can work with what you suggest. I’ll try it later. As I already have an mqtt broker on my network, can I use that instead? Is that configurable by environment variable?

Secondly, as this is not drop-in compatible, it perhaps ought to be noted as such in the wiki documentation @glyn.hudson as any user will need a radically different docker compose file?

Thanks
Miles

Alex,

I have it working and now that I see what you’ve done I like it very much - better than the official docker compose/images. Much simpler and cleaner, but I guess that’s why you did it…

I’ve installed emoncms many times in this adventure, but this was by far the easiest and quickest.

I didn’t have a “backup.tar.gz” but I got a shell inside the docker and mysql < dump.sql to restore, and once I worked out what the file owner needed to be, I copied the phpfina files into the right place and it just works.

Thank you very much!
Miles

1 Like

Good idea, I’ve added a note

Great that you found it be easy. This was the goal :slight_smile:
I was using the scripted install before and always add problems with the logs filling up when going to production monitoring quite large industrial grade installations with pumps an 3 way valves to manage.

Now i do everything with that image and it works like a charm in one or two clicks :slight_smile:

Glyn,

Could you add this link to your wiki note, please? It was in Alex’s reply to me in this thread and it’s the killer information.

Running the App with docker-compose | Emoncms docker

I can’t emphasise enough how simple this install of emoncms is - it would be worth considering as the recommended way unless you’re on dedicated hardware like a pi and needing the hub.

Thanks.
Miles

It should work on raspberry pi. I now use more jetson devices but i have 2 monitoring setups on raspberry pi3 and they run this image. One runs also emonhub on it as a separate container