Git Product home page Git Product logo

dsmr-reader-docker's Introduction

Docker Pulls Docker Stars GitHub Build Status GitHub Stars Donate

"Buy Me A Coffee"

DSMR-reader - Docker

DSMR-protocol reader, telegram data storage and energy consumption visualizer. Can be used for reading the smart meter DSMR (Dutch Smart Meter Requirements) P1 port yourself at your home. You will need a cable and hardware that can run Docker. Free for non-commercial use.


Table of contents


General info

The purpose of this project is to provide a simplified installation of DSMR-reader using all the benefits of Docker.

Contribution

Special thanks to the following persons for their great contribution(s) @dennissiemensma @bjw-s @Caroga


Screenshots

Example screenshot


Technologies

* Docker >= 20.x
* Python 3.x
* Postgres >= 13.x, max 16.x
* MySQL ??.?? (untested by me)

Releases

This is a multi-arch image and will also run on a Raspberry Pi or other Docker-enabled ARMv6/7/8 devices.

Image Tag Architectures Image OS
latest amd64, arm32v6, arm32v7, arm64v8 Alpine Linux 3.19
development amd64, arm32v6, arm32v7, arm64v8 Alpine Linux 3.19

Docker tags/releases can be found here: https://hub.docker.com/r/xirixiz/dsmr-reader-docker/tags?page=1&ordering=last_updated


Setup / parameters

  • Public access warning

    Exposing your DSMR-reader installation to the Internet? Consider additionally using HTTP Auth (see below) or enabling "Force password login everywhere" in the Frontend settings in DSMR-reader, to prevent public access.

  • Settings

    For DSMR Reader specific environment settings, please refer to: DSMR-reader env settings docs

    It's possible to set the following settings as environment variables, for example:

    # Required (defaults are shown as value):
    - DJANGO_TIME_ZONE=Europe/Amsterdam
    - VIRTUAL_HOST=localhost
    # It's possible to map a UID/GID with a user/group from you local system.
    # This will not change the username, only match ID's to prevent issues with access rights!
    - DUID=803
    - DGID=803
  • Nginx related:
  # Default inside the container nginx is running on port 80.
  # In some cases (host network f.e.), some people requested to be able to change the default listen port.
  # However, in most cases this setting isn't being used.
  NGINX_LISTEN_PORT=80
  # Default nginx generated access logs.
  # In some cases you want to disable this, because f.e. you use a reverse proxy which also generated access logs
  DISABLE_NGINX_ACCESS_LOGS=true
# Enables port 443 for nginx
# /etc/ssl/private/fullchain.pem and /etc/ssl/private/privkey.pem are required to be mounted!
ENABLE_NGINX_SSL=false
  # ENABLE HSTS on SSL: https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security
  ENABLE_NGINX_ENABLE_HSTS=false
# Redirect HTTP traffic to HTTPS
ENABLE_NGINX_SSL_REDIRECT=false

Nginx .httpassword:

ENABLE_HTTP_AUTH=false
HTTP_AUTH_USERNAME=
HTTP_AUTH_PASSWORD=

It's not possible to combine those settings!!!:

ENABLE_NGINX_SSL
NGINX_LISTEN_PORT
  • DSMR related (defaults are shown as value):
    # Webinterface user:
    DSMRREADER_ADMIN_USER=admin
    # Webinterface user password:
    DSMRREADER_ADMIN_PASSWORD=admin
    # Loglevel. Valid values are WARNING, INFO, DEBUG:
    DSMRREADER_LOGLEVEL=WARNING
    # Secret key for encryption:
    DJANGO_SECRET_KEY=dsmrreader
    # Ignore database size notifications:
    DSMRREADER_SUPPRESS_STORAGE_SIZE_WARNINGS=True
    # Plugins (custom) setup:
    DSMRREADER_PLUGINS=dsmr_plugins.modules.plugin_name1,dsmr_plugins.modules.plugin_name2
    # Enable IFrame support (f.e. for use in HASS).
    ENABLE_IFRAME=false
  • DB related (defaults are shown as value):
    # Optional. Vacuum clean Postgres on startup:
    VACUUM_DB_ON_STARTUP=false
    # Required. Defaults are set to:
    DJANGO_DATABASE_ENGINE=django.db.backends.postgresql
    DJANGO_DATABASE_NAME=dsmrreader
    DJANGO_DATABASE_USER=dsmrreader
    DJANGO_DATABASE_PASSWORD=dsmrreader
    DJANGO_DATABASE_HOST=dsmrdb
    DJANGO_DATABASE_PORT=5432
    DJANGO_DATABASE_CONN_MAX_AGE=60
  • DSMR Datalogger related

    When you are connecting to P1 via a network socket, you need to run DSMR Reader in standalone mode. Ignore the errors about /dev/ttyUSB* and head over to the DSMR Reader datalogger configuration in the admin panel and configure the setting so it matches your environment. More info: #303 (comment)

    • DSMRREADER_OPERATION_MODE - Run DSMR Reader in 1 of the following modes (default is standalone with the serial flavor):
      • standalone - Run all processes, including backend, GUI and datalogger. There are two flavors:
        • standalone - serial - Use a serial connection for the datalogger.
        • standalone - ipv4 - Use a network socket for the datalogger.
      • api_server - Run all processes, except the datalogger process. A remote datalogger is required to collect DSMR Reader telegrams.
      • api_client - Only start the datalogger client, which sends the P1 telegrams to the api_server. It is required to setup DATALOGGER_API_* environment variables.

    image

    image

    image

  • DSMR Reader datalogger - standalone - serial (default):

    More info: DSMR-reader remote datalogger installation docs. The default startup values for DSMR Reader standalone are:

    DSMRREADER_REMOTE_DATALOGGER_INPUT_METHOD=serial
    DSMRREADER_REMOTE_DATALOGGER_SERIAL_PORT=/dev/ttyUSB0
    
    # DSMR meter version 4/5
    DSMRREADER_REMOTE_DATALOGGER_SERIAL_BAUDRATE=115200
    DSMRREADER_REMOTE_DATALOGGER_SERIAL_BYTESIZE=8
    DSMRREADER_REMOTE_DATALOGGER_SERIAL_PARITY=N

    Some meters are running on an older version and can be set providing the values:

    # DSMR meter version 2/3 settings
    DSMRREADER_REMOTE_DATALOGGER_SERIAL_BAUDRATE=9600
    DSMRREADER_REMOTE_DATALOGGER_SERIAL_BYTESIZE=7
    DSMRREADER_REMOTE_DATALOGGER_SERIAL_PARITY=E
  • DSMR Reader datalogger - standalone - ipv4:

    More info: DSMR-reader remote datalogger installation docs. Instead of a serial connection it's also possible to use a network socket instead. You need to define the following variables:

    DSMRREADER_REMOTE_DATALOGGER_INPUT_METHOD=ipv4
    DSMRREADER_REMOTE_DATALOGGER_NETWORK_HOST=127.0.0.1 (default)
    DSMRREADER_REMOTE_DATALOGGER_NETWORK_PORT=2000 (default)
  • Remote DSMR datalogger - api_client

    More info: DSMR-reader remote datalogger installation docs.

    # Required. Instructs dsmr reader to start in api_client mode
    DSMRREADER_OPERATION_MODE=api_client
    # Required. Destination(s) of the DSMR Reader (Docker) host(s)
    DSMRREADER_REMOTE_DATALOGGER_API_HOSTS=x
    # Required. Add the API keys of the DSMR Reader (Docker) destination host(s)
    DSMRREADER_REMOTE_DATALOGGER_API_KEYS=x
  • Remote DSMR datalogger - api_server

    More info: DSMR-reader remote datalogger installation docs. The configured api_client will push data to the api_server. The only difference between standalone and api_server is that the datalogger process isn't running.

    # Required. Instructs dsmr reader to start in api_server mode, which means no datalogger process.
    # all telegrams are coming in through the API
    DSMRREADER_OPERATION_MODE=api_server
  • Remote DSMR datalogger - Optional settings

    More info: DSMR-reader remote datalogger installation docs.

    DSMRREADER_REMOTE_DATALOGGER_TIMEOUT=x
    DSMRREADER_REMOTE_DATALOGGER_SLEEP=x
    DSMRREADER_REMOTE_DATALOGGER_DEBUG_LOGGING=false
  • Run with docker-compose

    An example docker-compose.yaml file can be found here: https://raw.githubusercontent.com/xirixiz/dsmr-reader-docker/main/examples/docker-compose.example.yaml.

    You should modify the docker-compose file with parameters that suit your environment, then run docker-compose afterwards:

    docker-compose up -d

    After starting the containers with docker-compose, the dashboard is reachable at

    http://<hostname>:7777
    

    After starting the containers, don't forget to modify the default DSMR version (default is DSMR v4):

    http://<hostname>:7777/admin/dsmr_datalogger/dataloggersettings/
    
  • Run with Docker run

    Keep in mind the example below only runs dsmr, you need to run a postgres docker container or traditional postgres environment as well, since a database is needed.

    docker run -d \
      --name dsmr \
      --restart always \
      -p 7777:80 \
      -p 7779:443 \
      -e DJANGO_TIME_ZONE=Europe/Amsterdam \
      -e DJANGO_DATABASE_HOST=x.x.x.x \
      -e DJANGO_DATABASE_USER=dsmrreader \
      -e DJANGO_DATABASE_PASSWORD=dsmrreader \
      -e VIRTUAL_HOST=localhost \
      --no-healthcheck \
      --device /dev/ttyUSB0:/dev/ttyUSB0 \
      xirixiz/dsmr-reader-docker

The --no-healthcheck argument should only be used when the containers function NOT presenting the DSMR Reader webinterface, for example the datalogger sender mode. By default this argument should not be used!

  • Environment variables from files (Docker secrets)

You can set any environment variable from a file by using a special prepend FILE__.

As an example:

services:
    some_service:
    image: some_image
    environment:
        FILE__SECRET: /run/secrets/a_secret_file
    secrets:
        - a_secret_file

secrets:
    a_secret_file:
        file : somedir/my_secret.txt

Basiccally, the bottom secrets section mounts my_secrets.txt as /run/secrets/a_secret_file. The secrets section under the service authorize the service to use the a_secret_file secret. The environment variable FILE__SECRET tells the service what file to read to set/get the value of the environment variable SECRET.


Features

  • DSMR Reader - Database cleanup/vacuum

    It could be that you receive a notification that the database is growing, like in this issue: dsmrreader/dsmr-reader#1165.

    You can cleanup the Docker database by running the following command from the application container:

    docker exec -ti dsmr bash -c '/app/cleandb.sh'

    Or if you'd like to run verbose:

    docker exec -ti dsmr bash -c '/app/cleandb.sh -v'
  • DSMR Reader - Plugins

    DSMR Reader plugins (https://dsmr-reader.readthedocs.io/en/latest/plugins.html) can be added by adding the plugin with a volume mapping and using it in the environmental variable to load it.

    volumes:
      - ./modules/forward_telegram_to_api.py:/app/dsmr_plugins/modules/forward_telegram_to_api.py
    environment:
      - DSMRREADER_PLUGINS=dsmr_plugins.modules.forward_telegram_to_api
  • Backup and restore mechanism 1

    dsmrdb in docker-compose is configured to use a docker volume. So when the application and docker containter have been removed, the postgres data still persists.

    Also you could easily create a backup. Values depend on docker/docker-compose user and database variables:

    docker-compose stop dsmr
    docker exec -t dsmrdb pg_dumpall -c -U dsmrreader > dsmrreader.sql
    docker-compose start dsmr

    It's also possible to gzip ofcourse:

    docker exec -t dsmrdb pg_dumpall -c -U dsmrreader | /bin/gzip > dsmrreader.sql.gz

    Or drop the database and restore a backup. Values depend on docker/docker-compose user and database variables:

    docker-compose stop dsmr
    docker exec -t dsmrdb dropdb dsmrreader -U dsmrreader
    docker exec -t dsmrdb createdb -O dsmrreader dsmrreader -U dsmrreader
    cat dsmrreader.sql | docker exec -i dsmrdb psql -U dsmrreader
    docker-compose start dsmr
  • Backup and restore mechanism 2

    Ofcourse it's also possible to use Docker's own volume backup and restore megansim.

    Backup:

    docker run -it --rm -v dsmrdb:/volume -v /tmp:/backup alpine \
      tar -cjf /backup/dsmrdb.tar.bz2 -C /volume ./

    Restore:

    docker run -it --rm -v dsmrdb:/volume -v /tmp:/backup alpine \
      sh -c "rm -rf /volume/* /volume/..?* /volume/.[!.]* ; tar -C /volume/ -xjf /backup/dsmrdb.tar.bz2"
  • Backup mechanism 3

    Be aware this backup is done via the dsmr container, not via the dsmrdb container! Backup:

    docker exec -ti dsmr bash -c 'PGPASSWORD=${DJANGO_DATABASE_PASSWORD} /usr/bin/pg_dump \
      -h "${DJANGO_DATABASE_HOST}" \
      -p "${DJANGO_DATABASE_PORT}" \
      -d "${DJANGO_DATABASE_NAME}" \
      -U "${DJANGO_DATABASE_USER}"'
  • Postgres upgrade (docker)
    - stop the dsmr reader container ONLY
    - backup the dsmrdb database (see "Backup and restore mechanism" in the README.md)
    - validate the dsmrdb backup!
    - you could also consider to "vacuum" the database following "DSMR Reader - Database cleanup/vacuum" in the README.md.
    - stop and remove the dsmrdb container
    - rename the db folder that is mounted in the Docker container, containing the database data, to something else (.old, or whatever you like)
    - create a new db folder with the name used to mount the folder in the Docker container (so, the folder name just before you renamed it in the previous step)
    - update docker-compose or your docker run command with the new postgres version
    - be aware the client package has to be compatible with the postgres version you're going to use. Check here which version is within the dsmr image.
    - start dsmrdb (it's an empty but valid postgres db now).
    - restore the database backup created in step 2 (see "Backup and restore mechanism" in the README.md)
    - restart the dsmrdb container
    - start the dsmr container
    
  • UID/GID

    When using volumes (-v or --volume flags) permissions issues can occur between the host OS and the container, to avoid this you can specify a user id DUID and group id DGID from the local system in the Docker container. Make sure the owner of the directory has all permissions on the volume you'd like to mount into the Docker container.

    You can identify a UID or GID by executing the following command

      id xirixiz
      uid=1000(xirixiz) gid=1000(xirixiz) groups=1000(xirixiz) 1001(docker)

Issues

  • MySQL backend - issue with DSMR running on top of MySQL - configured timezone info tables.

    It manifests as "Data processing is lagging behind" message on the web-interface and with only leading information in the logs if they set to DEBUG "Missing consumption data for:"
    If you drill down from here then you can eventually find this issue: dsmrreader/dsmr-reader#909
    Which can be resolved by installing timezone info tables in MySQL: https://dev.mysql.com/doc/refman/8.0/en/mysql-tzinfo-to-sql.html

  • Raspberry Pi

    This issue is caused by the upgrade from Alpine 3.12 to 3.13. Alpine 3.13 requires the following on the host OS (https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.13.0#time64_requirements):

    - Docker 19.03.9 or newer
    - libseccomp 2.4.2 or newer
    

    The libseccomp package hasn't been updated for Debian stable yet, Therefore, this image won't run on any Debian (or Raspbian) stable host.

    Fix:

    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 04EE7237B7D453EC 648ACFD622F3D138
    echo 'deb http://httpredir.debian.org/debian buster-backports main contrib non-free' | sudo tee -a /etc/apt/sources.list.d/debian-backports.list
    sudo apt update
    sudo apt install libseccomp2 -t buster-backports
  • Incorrect timestamps

    Mounting /etc/localtime:/etc/localtime results most of the times in an incorrect timestamp in DSMR Reader (+/- 1 hour). Removig the mount usually solves the problem.

  • Synology

    For Synology, or maybe other NAS appliances, an additional driver is required:

    Addition link:


Inspiration

Project inspired by the hard work and effort of @dennissiemensma


Contact

Created by @xirixiz - feel free to contact me!

dsmr-reader-docker's People

Contributors

azhiltsov avatar bjw-s avatar caroga avatar dennissiemensma avatar erikminekus avatar fonta avatar frankforpresident avatar goegol avatar jellevankraaij avatar jorkzijlstra avatar ju5t avatar readysteadyflow avatar rogierlommers avatar stejoo avatar tomkooij avatar watskebart avatar xirixiz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dsmr-reader-docker's Issues

Hoe te updaten?

Ik draai met volle tevredenheid jou dockers dmv een dockercompose file.
Toch heb ik een vraag: ik wil namelijk antwoord kunnen geven op:
dsmrreader/dsmr-reader#613
DSMRreader maakt namelijk wel backups maar niet naar mijn dropbox.
In de dockercompose heb ik:
volumes:
- ./Docker/dsmrdb:/var/lib/postgresql/data
- ./Docker/dsmr_backups:/dsmr/backups
waar ze inderdaad netjes staan.

Mijn idee is daarom: updaten (gelukt door de latest tage te gebruiken), logs aanpassen en kijken of het aan mijn docker config ligt of aan iets anders. Als ik in portainer een console open ben ik niet de goede user.
als ik via putty inlog op de host weet ik vervolgens niet hoe via de docker commando's uit te voeren.

kan je me misschien wat tips geven?

Foutmelding bij starten dsmr-docker

Ik probeer dit pakket met Docker op Ubuntu server aan de gang te krijgen, maar helaas krijg ik een foutmelding.

Nadat ik 'm heb gepulld: docker pull xirixiz/dsmr-reader-docker
Voer ik het volgende commando in: docker-compose start dsmr
Bleek dat ik docker-compose nog moest installeren, prima, gedaan.
Vervolgens dit commando gegeven: docker-compose start dsmr.
Daarna krijg ik een foutmelding:
ERROR: Can't find a suitable configuration file in this directory or any parent. Are you in the right directory? Supported filenames: docker-compose.yml, docker-compose.yaml

Wat doe ik fout? Mis ik iets? Begrijp ik het niet goed?

MQTT support needs upgrade

With the update to 1.23, MQTT doesn't work anymore. it needs an update


sudo cp /home/dsmr/dsmr-reader/dsmrreader/provisioning/supervisor/dsmr-reader.conf /etc/supervisor/conf.d/

sudo supervisorctl reread

sudo supervisorctl update

But, it doesn't work in your Docker version. Which command / directories do I need for updating the supervisor?

Error while running update_image.sh

I want to run your docker image on an Raspberry Pi 3. If I do ./update_images.sh --local --arch arm64v8 --debug it fails at some point with the following error (in Dutch, translation is mine):

sed: kan s|QEMU_ARCH|aarch64|g niet lezen: Bestand of map bestaat niet

(sed: cannot read s|QEMU_ARCH|aarch64|g: File or folder does not exist)

Any idea on how to fix this?

Postgresql v11 werkt niet meer.

Voor de dsmrdb pakt hij nu (latest) postgres versie 11, die niet compatible is. Ik heb nu maar versie 10.4 genomen, daar doet 'ie het perfect mee. Moet de applicatie geupdate worden?

DSMR-reader docker on Raspberry Pi

Hi, I'm trying to run this container on my Raspberry Pi within Docker. I successfully downloaded the image using:
docker pull xirixiz/dsmr-reader-docker

However when I try to run:
sudo docker run xirixiz/dsmr-reader-docker

I get the following error:
standard_init_linux.go:178: exec user process caused "exec format error"

What am I doing wrong?

Rename docker-compose.yaml to example

Just a thought.
Maybe it's an idea to rename the docker-compose.yaml file to docker-compose.example.yaml.
This way it won't block git pull when you changed it locally.

after upgrading, dsmr container fails due to supervisord issues

after pulling the latest image (9e07f0609aac) I'm encountering some issues:

[ INFO ] Starting supervisord...
dsmr      | /usr/lib/python2.7/site-packages/supervisor/options.py:461: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
dsmr      |   'Supervisord is running as root and it is searching '
dsmr      | Error: Format string '%(ENV_SD_USER)s' for 'supervisord.user' contains names ('ENV_SD_USER') which cannot be expanded. Available names: ENV_AUTORESTART_DATALOGGER, ENV_DB_HOST, ENV_DB_NAME, ENV_DB_PASS, ENV_DB_USER, ENV_DSMR_EMAIL, ENV_DSMR_PASSWORD, ENV_DSMR_USER, ENV_GPG_KEY, ENV_HOME, ENV_HOSTNAME, ENV_LANG, ENV_PATH, ENV_PWD, ENV_PYTHON_GET_PIP_SHA256, ENV_PYTHON_GET_PIP_URL, ENV_PYTHON_PIP_VERSION, ENV_PYTHON_VERSION, ENV_QEMU_EXECVE, ENV_SHLVL, ENV_VIRTUAL_HOST, ENV__, here
dsmr      | For help, use /usr/bin/supervisord -h
dsmr exited with code 2

With tag :2.2.1 the dsmr container works fine.
I'm using a postgress image as db service.

docker-compose:

version: "3.6"
services:
  dsmrdb:
#    image: 084ec18124c8 
    image: postgres
    container_name: dsmrdb
    user: 1000:1000
    volumes:
      - ./dsmrdb:/var/lib/postgresql/data
      - ./dsmrdb_backups:/dsmr/backups
    restart: always
    environment:
      - POSTGRES_USER=dsmrreader
      - POSTGRES_PASSWORD=dsmrreader
      - POSTGRES_DB=dsmrreader

  dsmr:
    image: xirixiz/dsmr-reader-docker
    container_name: dsmr
    user: root
    depends_on:
      - dsmrdb
    cap_add:
      - NET_ADMIN    
    links: #deze feature schijnt depricated te worden
      - dsmrdb
    restart: always
    environment:
      - DB_HOST=dsmrdb
      - DSMR_USER=admin
      - DSMR_EMAIL=root@localhost
      - DSMR_PASSWORD=admin
      - VIRTUAL_HOST=localhost
    ports:
      - 7777:80
      - 7779:443
    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0
    volumes:
      - ./data/dsmr-webinterface.conf:/etc/nginx/conf.d/dsmr-webinterface.conf
      - ./data/htpasswd:/etc/nginx/htpasswd

cannot start after upgrade

after upgrading to new version docker won's start.
any idea? also did add SDgroup as root and my own user but didn't help

zoeperman@zoepermanhs:~/docker/DSMR$ sudo docker-compose up
Starting dsmrdb ... done
Recreating dsmr ... done
Attaching to dsmrdb, dsmr
[ INFO ] Checking if the DSMR web credential variables have been set...
dsmrdb | 2019-08-11 13:35:16.313 CEST [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
dsmrdb | 2019-08-11 13:35:16.313 CEST [1] LOG: listening on IPv6 address "::", port 5432
dsmrdb | 2019-08-11 13:35:16.326 CEST [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
dsmrdb | 2019-08-11 13:35:16.361 CEST [18] LOG: database system was shut down at 2019-08-11 13:34:40 CEST
dsmrdb | 2019-08-11 13:35:16.371 CEST [1] LOG: database system is ready to accept connections
[ INFO ] Fixing /dev/ttyUSB* security...
[ INFO ] Removing existing PID files...
[ INFO ] Verifying if Postgres in running...
[ INFO ] Adding setting DSMRREADER_BACKEND_SLEEP...
[ INFO ] Adding setting DSMRREADER_DATALOGGER_SLEEP...
[ INFO ] Running post configuration...
dsmr | Operations to perform:
dsmr | Apply all migrations: admin, auth, contenttypes, dsmr_api, dsmr_backend, dsmr_backup, dsmr_consumption, dsmr_datalogger, dsmr_frontend, dsmr_mindergas, dsmr_mqtt, dsmr_notification, dsmr_pvoutput, dsmr_stats, dsmr_weather, sessions
dsmr | Running migrations:
dsmr | No migrations to apply.
dsmr |
dsmr | 2046 static files copied to '/var/www/dsmrreader/static'.
dsmr | admin already exists
[ INFO ] Starting supervisord...
dsmr | /usr/lib/python2.7/site-packages/supervisor/options.py:461: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
dsmr | 'Supervisord is running as root and it is searching '
dsmr | Error: Format string '%(ENV_DAEMON_USER)s' for 'supervisord.user' contains names ('ENV_DAEMON_USER') which cannot be expanded. Available names: ENV_AUTORESTART_DATALOGGER, ENV_DB_HOST, ENV_DB_NAME, ENV_DB_PASS, ENV_DB_PORT, ENV_DB_USER, ENV_DSMRREADER_BACKEND_SLEEP, ENV_DSMRREADER_DATALOGGER_SLEEP, ENV_DSMR_EMAIL, ENV_DSMR_PASSWORD, ENV_DSMR_USER, ENV_GPG_KEY, ENV_HOME, ENV_HOSTNAME, ENV_LANG, ENV_PATH, ENV_PWD, ENV_PYTHON_PIP_VERSION, ENV_PYTHON_VERSION, ENV_QEMU_EXECVE, ENV_SD_AUTORESTART_DATALOGGER, ENV_SD_GROUP, ENV_SD_LOGLEVEL, ENV_SD_USER, ENV_SHLVL, ENV_TZ, ENV_VIRTUAL_HOST, ENV__, here
dsmr | For help, use /usr/bin/supervisord -h

`version: '3.6'

services:
dsmrdb:
image: postgres:10.5-alpine
container_name: dsmrdb
restart: always
volumes:
- /etc/localtime:/etc/localtime:ro
- ./dsmrdb:/var/lib/postgresql/data
environment:
- TZ=Europe/Amsterdam
- PG_TZ=Europe/Amsterdam
- POSTGRES_USER=dsmrreader
- POSTGRES_PASSWORD=dsmrreader
- POSTGRES_DB=dsmrreader

dsmr:

build: .

image: xirixiz/dsmr-reader-docker:test-latest
container_name: dsmr
depends_on:
  - dsmrdb
cap_add:
  - NET_ADMIN
links:
  - dsmrdb
restart: always
volumes:
  - /etc/localtime:/etc/localtime:ro
  - ./dsmr_backups:/dsmr/backups
environment:
  - TZ=Europe/Amsterdam
  - SD_LOGLEVEL=info
  - SD_AUTORESTART_DATALOGGER=true
  - DB_HOST=dsmrdb
  - DB_USER=dsmrreader
  - DB_PASS=dsmrreader
  - DB_PORT=5432
  - SD_USER=root
  - SD_GROUP=root
  - DSMR_USER=admin
  - DSMR_EMAIL=root@localhost
  - DSMR_PASSWORD=admin
  - VIRTUAL_HOST=localhost
  - DSMRREADER_BACKEND_SLEEP=5
  - DSMRREADER_DATALOGGER_SLEEP=5
ports:
  - 7777:80
  - 7779:443
devices:
  - /dev/ttyUSB0:/dev/ttyUSB0

#volumes:

dsmrdb:

dsmrdb_backups:

`

after updating it won't start

I updated the dockers to the laters version and gave the up command.
now it don't start.

logs of the container:
2019-08-09T20:04:21.699593139Z Apply all migrations: admin, auth, contenttypes, dsmr_api, dsmr_backend, dsmr_backup, dsmr_consumption, dsmr_datalogger, dsmr_frontend, dsmr_mindergas, dsmr_mqtt, dsmr_notification, dsmr_pvoutput, dsmr_stats, dsmr_weather, sessions 2019-08-09T20:04:21.699607733Z Running migrations: 2019-08-09T20:04:21.699609848Z No migrations to apply. 2019-08-09T20:04:22.354008579Z 2019-08-09T20:04:22.354025908Z 0 static files copied to '/var/www/dsmrreader/static', 2046 unmodified. 2019-08-09T20:04:22.783479567Z admin already exists 2019-08-09T20:04:22.827114765Z [ �[00;34mINFO�[0m ] Starting supervisord... 2019-08-09T20:04:22.938412334Z /usr/lib/python2.7/site-packages/supervisor/options.py:461: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security. 2019-08-09T20:04:22.938424872Z 'Supervisord is running as root and it is searching ' 2019-08-09T20:04:22.939965155Z Error: Format string '%(ENV_SD_USER)s' for 'supervisord.user' contains names ('ENV_SD_USER') which cannot be expanded. Available names: ENV_AUTORESTART_DATALOGGER, ENV_DB_HOST, ENV_DB_NAME, ENV_DB_PASS, ENV_DB_USER, ENV_DSMR_EMAIL, ENV_DSMR_LOGLEVEL, ENV_DSMR_PASSWORD, ENV_DSMR_USER, ENV_GPG_KEY, ENV_HOME, ENV_HOSTNAME, ENV_LANG, ENV_PATH, ENV_PGTZ, ENV_PWD, ENV_PYTHON_GET_PIP_SHA256, ENV_PYTHON_GET_PIP_URL, ENV_PYTHON_PIP_VERSION, ENV_PYTHON_VERSION, ENV_QEMU_EXECVE, ENV_SHLVL, ENV_TZ, ENV_VIRTUAL_HOST, ENV__, here 2019-08-09T20:04:22.940007283Z For help, use /usr/bin/supervisord -h

what can I do?
is this easy to fix by changing parameters in my compose file?

Mindergas uploading not working

I've enabled the mindergas upload in the DSMR config. However no data is being sent over. I have a feeling the dsmr-container cannot reach the 'outside internet'. I am pretty new to docker and I am running your repo using the docker-compose file on my Synology NAS. Not sure if I need to change the network-bridge, so it allows connecting to the internet?
note: if you believe my question doesn't relate to your repo, my apologies.

backups directory not exposed

The "/home/dsmr/app/backups" directory isn't exposed, so it is 'lost' when you remove the container. I think this directory should be persistent?

502 Bad Gateway

I'm trying to run your docker image but when using the docker compose file I'm getting a 502 Bad Gateway error from Nginx. It appears that the dsmr application itself is not running. Would you have any idea why this could be the case?

RPI

Nice nice nice, Any change of a raspberry pi3 version?

Thanks.

High CPU in docker stats

Thanks for creating this docker repo for DSMR. I am running it for over half a year.
I just noticed that the container uses a lot of CPU, I have no idea if this was due to a recent upgrade.
docker stats gives me:
06ae462c091e dsmr 88.34% 211.1MiB / 4.569GiB 4.51% 15.8MB / 22.9MB 16.9MB / 0B 11

CPU is around 100%, drops to 20-ish for a second and the goes up again.

I am running the latest docker image. I have no serial device connected (DSMR is updated using the API).
'top' inside the docker container gives:

CPU: 13% usr 6% sys 33% nic 44% idle 0% io 0% irq 2% sirq
Load average: 1.89 1.76 2.22 4/2032 1286
PID PPID USER STAT VSZ %VSZ CPU %CPU COMMAND
20 14 root SN 159m 3% 2 1% python3 -u /dsmr/manage.py dsmr_backend
14 1 root S 86264 2% 0 0% {supervisord} /usr/bin/python2 /usr/bin/supervisord -n
26 18 root SN 147m 3% 2 0% {gunicorn} /usr/local/bin/python /usr/local/bin/gunicorn dsmrreader.wsgi --timeout 60 --max-requests 500 --bind unix:
1283 14 root SN 141m 3% 1 0% python3 -u /dsmr/manage.py dsmr_mqtt
1286 14 root RN 136m 3% 1 0% python3 -u /dsmr/manage.py dsmr_datalogger
18 14 root SN 81556 2% 0 0% {gunicorn} /usr/local/bin/python /usr/local/bin/gunicorn dsmrreader.wsgi --timeout 60 --max-requests 500 --bind unix:
23 16 nginx S 15392 0% 2 0% nginx: worker process
22 16 nginx S 15368 0% 0 0% nginx: worker process
21 16 nginx S 15368 0% 1 0% nginx: worker process
16 14 root S 14888 0% 0 0% nginx: master process /usr/sbin/nginx -g daemon off;
1272 0 root S 6356 0% 0 0% /bin/bash
1 0 root S 6252 0% 2 0% {run.sh} /bin/bash /run.sh
1279 1272 root R 1520 0% 2 0% top

Any clue why CPU usage is this high?

Run as different user?

I have a docker-compose file that starts (among others) the dsmr-reader-docker container.

For most containers, I can specify the user id/group used to run the main processes within the container:

  • Most containers that use supervisord can be configured with the PUID and PGID environment variables, telling supervisord to start processes with the given user/group.
  • Most containers that just run a single process (i.e. not using supervisord) can be started using the - user: someUser:someGroup docker-compose option.

Neither of these approaches work with dsmr-reader-docker; with the - user: someUser:someGroup option supervisord fails to start up, and the PUID/PGID environment variables don't seem to be taken into account for this container. In fact, /etc/supervisor.d/supervisord.ini has the root user hardcoded.

Would it be possible to update the container to use the PUID/PGID environment variables if defined, falling back to root if these variables have not been defined?

Webinterface not always available after docker restart

When restarting the DSMR Docker container, the WebGUI doesn't always start. I found the following in the /var/log/supervisor directory:

-mEtlkZ.loga8b451:/var/log/supervisor# cat dsmr_webinterface-stderr---supervisor
[2018-06-06 09:11:44 +0000] [32] [INFO] Starting gunicorn 19.7.1

Error: Already running on PID 31 (or pid file '/var/tmp/gunicorn--dsmr_webinterface.pid' is stale)

It seems there is an existing file with a pid for the webinterface, where this old pid value is used by another application (this time it is nginx).

Possible the /var/tmp/*.pid files need to be deleted at the end/start of the Docker?

Hoe veilig te updaten naar laatste Docker-image?

Hi, ik gebruik momenteel met veel plezier DSMR-reader via jouw Docker image.
Momenteel gebruik ik de image met DSMR 1.28 op een RPI2. E.a. gestart met Docker-compose met koppeling naar een volume voor behoud van de data, en ik gebruik Portainer voor het Docker-beheer.

Ik zou graag upgraden, maar lijkt me niet verstandig om gewoon de nieuwste Docker-image op te starten aangezien de database mogelijk van de nieuwe versie mogelijk niet backwards compatible is.

Hoe kan ik dit het beste aanpakken? Eerst op een of andere manier zorgen dat deploy.sh binnen de huidige Docker-container wordt uitgevoerd?

(excuus als dit niet de goede plek is voor dit soort vragen en mijn beperkte kennis van Docker, maar ik kon geen andere zinvolle plek vinden).

ARM support

Hi,

I tried running your docker container on a raspberry pi and of course this didn't work because your solution is based on a x86/x64 base image.

I took the liberty to adjust some stuff so it works on ARM architectures in my fork: https://github.com/Geertvdc/dsmr-reader-docker

What do you think. Do you want to merge it? (the script is quite different now that you run alpine) or shall i keep it in my own repository and support it there?

Old Docker images uploaded to Docker Hub

Hoi,

It seems that (at least) for the amd64 version an old version has been uploaded to the Docker Hub registry.

$ docker pull xirixiz/dsmr-reader-docker
Using default tag: latest
latest: Pulling from xirixiz/dsmr-reader-docker
Digest: sha256:666af253003500d45242ee4f0f0eef4a315dd7077972cced39deb4246ae09275
Status: Image is up to date for xirixiz/dsmr-reader-docker:latest

xirixiz/dsmr-reader-docker latest e8a6676a3c7c 3 weeks ago 204MB

Thoughts on this?

Thank you.

best regards, Jurgen

Not receiving telegrams anymore

I am using this docker on a NUC (running Ubuntu Server) with this P1/USB cable https://www.sossolutions.nl/slimme-meter-kabel connected to ttyUSB0: https://i.imgur.com/kWyLRej.png

Since a few days, no telegrams are received anymore and I am not sure why.
In my docker compose and in the datalogger configuration, /dev/ttyUSB0/ is entered: https://i.imgur.com/Q7jS2Ca.png

docker-compose:

  dsmr:
    image: xirixiz/dsmr-reader-docker
    container_name: dsmr
    depends_on:
      - dsmrdb
    cap_add:
      - NET_ADMIN    
    links:
      - dsmrdb
    restart: always
    environment:
      - DB_HOST=dsmrdb
      - DSMR_USER=admin
      - DSMR_EMAIL=root@localhost
      - DSMR_PASSWORD=admin
      - VIRTUAL_HOST=localhost
    ports:
      - 7777:80
      - 7779:443
    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0

This was working fine for almost 1 week, but out of the blue, no telegrams anymore.
Any clue what could be the problem?

/DEV/SERIAL/BY-ID/ isn't present

I'm trying to use the path; /dev/serial/by-id/ in the docker container.
But when i use LS in the container his path it isn't available in the docker container...

Please help!

Page cannot be displayed after update

Hi,

Watchtower did an update this night because of the changes you committed. But dsmr reader is not working any more. Log file is showing a loop:

[ INFO ] Removing existing PID files...,

[ INFO ] Verifying if Postgres in running...,

[ INFO ] Running post configuration...,
Operations to perform:,
  Apply all migrations: admin, auth, contenttypes, dsmr_api, dsmr_backend, dsmr_backup, dsmr_consumption, dsmr_datalogger, dsmr_frontend, dsmr_mindergas, dsmr_mqtt, dsmr_notification, dsmr_pvoutput, dsmr_stats, dsmr_weather, sessions,
Running migrations:,
  No migrations to apply.,
,
0 static files copied to '/var/www/dsmrreader/static', 2046 unmodified.,
admin already exists,

[ INFO ] Starting supervisord...,
/usr/lib/python2.7/site-packages/supervisor/options.py:461: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.,
  'Supervisord is running as root and it is searching ',
Error: Format string '%(ENV_DAEMON_USER)s' for 'supervisord.user' contains names ('ENV_DAEMON_USER') which cannot be expanded. Available names: ENV_AUTORESTART_DATALOGGER, ENV_DB_HOST, ENV_DB_NAME, ENV_DB_PASS, ENV_DB_USER, ENV_DSMR_EMAIL, ENV_DSMR_PASSWORD, ENV_DSMR_USER, ENV_GPG_KEY, ENV_HOME, ENV_HOSTNAME, ENV_LANG, ENV_PATH, ENV_PWD, ENV_PYTHON_GET_PIP_SHA256, ENV_PYTHON_GET_PIP_URL, ENV_PYTHON_PIP_VERSION, ENV_PYTHON_VERSION, ENV_QEMU_EXECVE, ENV_SHLVL, ENV_VIRTUAL_HOST, ENV__, here,
For help, use /usr/bin/supervisord -h,

[ INFO ] Checking if the DSMR web credential variables have been set...,

[ INFO ] Fixing /dev/ttyUSB* security...,

[ INFO ] Removing existing PID files...,

[ INFO ] Verifying if Postgres in running...,

[ INFO ] Running post configuration...,
Operations to perform:,
  Apply all migrations: admin, auth, contenttypes, dsmr_api, dsmr_backend, dsmr_backup, dsmr_consumption, dsmr_datalogger, dsmr_frontend, dsmr_mindergas, dsmr_mqtt, dsmr_notification, dsmr_pvoutput, dsmr_stats, dsmr_weather, sessions,
Running migrations:,
  No migrations to apply.,
,
0 static files copied to '/var/www/dsmrreader/static', 2046 unmodified.,
admin already exists,

[ INFO ] Starting supervisord...,
/usr/lib/python2.7/site-packages/supervisor/options.py:461: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.,
  'Supervisord is running as root and it is searching ',
Error: Format string '%(ENV_DAEMON_USER)s' for 'supervisord.user' contains names ('ENV_DAEMON_USER') which cannot be expanded. Available names: ENV_AUTORESTART_DATALOGGER, ENV_DB_HOST, ENV_DB_NAME, ENV_DB_PASS, ENV_DB_USER, ENV_DSMR_EMAIL, ENV_DSMR_PASSWORD, ENV_DSMR_USER, ENV_GPG_KEY, ENV_HOME, ENV_HOSTNAME, ENV_LANG, ENV_PATH, ENV_PWD, ENV_PYTHON_GET_PIP_SHA256, ENV_PYTHON_GET_PIP_URL, ENV_PYTHON_PIP_VERSION, ENV_PYTHON_VERSION, ENV_QEMU_EXECVE, ENV_SHLVL, ENV_VIRTUAL_HOST, ENV__, here,
For help, use /usr/bin/supervisord -h,

[ INFO ] Checking if the DSMR web credential variables have been set...,

[ INFO ] Fixing /dev/ttyUSB* security...,

[ INFO ] Removing existing PID files...,

[ INFO ] Verifying if Postgres in running...,

[ INFO ] Running post configuration...,
Operations to perform:,
  Apply all migrations: admin, auth, contenttypes, dsmr_api, dsmr_backend, dsmr_backup, dsmr_consumption, dsmr_datalogger, dsmr_frontend, dsmr_mindergas, dsmr_mqtt, dsmr_notification, dsmr_pvoutput, dsmr_stats, dsmr_weather, sessions,
Running migrations:,
  No migrations to apply.,
,
0 static files copied to '/var/www/dsmrreader/static', 2046 unmodified.,
admin already exists,

[ INFO ] Starting supervisord...,
/usr/lib/python2.7/site-packages/supervisor/options.py:461: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.,
  'Supervisord is running as root and it is searching ',
Error: Format string '%(ENV_DAEMON_USER)s' for 'supervisord.user' contains names ('ENV_DAEMON_USER') which cannot be expanded. Available names: ENV_AUTORESTART_DATALOGGER, ENV_DB_HOST, ENV_DB_NAME, ENV_DB_PASS, ENV_DB_USER, ENV_DSMR_EMAIL, ENV_DSMR_PASSWORD, ENV_DSMR_USER, ENV_GPG_KEY, ENV_HOME, ENV_HOSTNAME, ENV_LANG, ENV_PATH, ENV_PWD, ENV_PYTHON_GET_PIP_SHA256, ENV_PYTHON_GET_PIP_URL, ENV_PYTHON_PIP_VERSION, ENV_PYTHON_VERSION, ENV_QEMU_EXECVE, ENV_SHLVL, ENV_VIRTUAL_HOST, ENV__, here,
For help, use /usr/bin/supervisord -h,

[ INFO ] Checking if the DSMR web credential variables have been set...,

[ INFO ] Fixing /dev/ttyUSB* security...,

[ INFO ] Removing existing PID files...,

[ INFO ] Verifying if Postgres in running...,

[ INFO ] Running post configuration...,
Operations to perform:,
  Apply all migrations: admin, auth, contenttypes, dsmr_api, dsmr_backend, dsmr_backup, dsmr_consumption, dsmr_datalogger, dsmr_frontend, dsmr_mindergas, dsmr_mqtt, dsmr_notification, dsmr_pvoutput, dsmr_stats, dsmr_weather, sessions,
Running migrations:,
  No migrations to apply.,
,
0 static files copied to '/var/www/dsmrreader/static', 2046 unmodified.,
admin already exists,

[ INFO ] Starting supervisord...,
/usr/lib/python2.7/site-packages/supervisor/options.py:461: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.,
  'Supervisord is running as root and it is searching ',
Error: Format string '%(ENV_DAEMON_USER)s' for 'supervisord.user' contains names ('ENV_DAEMON_USER') which cannot be expanded. Available names: ENV_AUTORESTART_DATALOGGER, ENV_DB_HOST, ENV_DB_NAME, ENV_DB_PASS, ENV_DB_USER, ENV_DSMR_EMAIL, ENV_DSMR_PASSWORD, ENV_DSMR_USER, ENV_GPG_KEY, ENV_HOME, ENV_HOSTNAME, ENV_LANG, ENV_PATH, ENV_PWD, ENV_PYTHON_GET_PIP_SHA256, ENV_PYTHON_GET_PIP_URL, ENV_PYTHON_PIP_VERSION, ENV_PYTHON_VERSION, ENV_QEMU_EXECVE, ENV_SHLVL, ENV_VIRTUAL_HOST, ENV__, here,
For help, use /usr/bin/supervisord -h,

[ INFO ] Checking if the DSMR web credential variables have been set...,

[ INFO ] Fixing /dev/ttyUSB* security...,

[ INFO ] Removing existing PID files...,

[ INFO ] Verifying if Postgres in running...,

[ INFO ] Running post configuration...,
Operations to perform:,
  Apply all migrations: admin, auth, contenttypes, dsmr_api, dsmr_backend, dsmr_backup, dsmr_consumption, dsmr_datalogger, dsmr_frontend, dsmr_mindergas, dsmr_mqtt, dsmr_notification, dsmr_pvoutput, dsmr_stats, dsmr_weather, sessions,
Running migrations:,
  No migrations to apply.,
,
0 static files copied to '/var/www/dsmrreader/static', 2046 unmodified.,
admin already exists,

[ INFO ] Starting supervisord...,
/usr/lib/python2.7/site-packages/supervisor/options.py:461: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.,
  'Supervisord is running as root and it is searching ',
Error: Format string '%(ENV_DAEMON_USER)s' for 'supervisord.user' contains names ('ENV_DAEMON_USER') which cannot be expanded. Available names: ENV_AUTORESTART_DATALOGGER, ENV_DB_HOST, ENV_DB_NAME, ENV_DB_PASS, ENV_DB_USER, ENV_DSMR_EMAIL, ENV_DSMR_PASSWORD, ENV_DSMR_USER, ENV_GPG_KEY, ENV_HOME, ENV_HOSTNAME, ENV_LANG, ENV_PATH, ENV_PWD, ENV_PYTHON_GET_PIP_SHA256, ENV_PYTHON_GET_PIP_URL, ENV_PYTHON_PIP_VERSION, ENV_PYTHON_VERSION, ENV_QEMU_EXECVE, ENV_SHLVL, ENV_VIRTUAL_HOST, ENV__, here,
For help, use /usr/bin/supervisord -h,

[ INFO ] Checking if the DSMR web credential variables have been set...,

[ INFO ] Fixing /dev/ttyUSB* security...,

[ INFO ] Removing existing PID files...,

[ INFO ] Verifying if Postgres in running...,

[ INFO ] Running post configuration...,
Operations to perform:,
  Apply all migrations: admin, auth, contenttypes, dsmr_api, dsmr_backend, dsmr_backup, dsmr_consumption, dsmr_datalogger, dsmr_frontend, dsmr_mindergas, dsmr_mqtt, dsmr_notification, dsmr_pvoutput, dsmr_stats, dsmr_weather, sessions,
Running migrations:,
  No migrations to apply.,
,
0 static files copied to '/var/www/dsmrreader/static', 2046 unmodified.,
admin already exists,

[ INFO ] Starting supervisord...,
/usr/lib/python2.7/site-packages/supervisor/options.py:461: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.,
  'Supervisord is running as root and it is searching ',
Error: Format string '%(ENV_DAEMON_USER)s' for 'supervisord.user' contains names ('ENV_DAEMON_USER') which cannot be expanded. Available names: ENV_AUTORESTART_DATALOGGER, ENV_DB_HOST, ENV_DB_NAME, ENV_DB_PASS, ENV_DB_USER, ENV_DSMR_EMAIL, ENV_DSMR_PASSWORD, ENV_DSMR_USER, ENV_GPG_KEY, ENV_HOME, ENV_HOSTNAME, ENV_LANG, ENV_PATH, ENV_PWD, ENV_PYTHON_GET_PIP_SHA256, ENV_PYTHON_GET_PIP_URL, ENV_PYTHON_PIP_VERSION, ENV_PYTHON_VERSION, ENV_QEMU_EXECVE, ENV_SHLVL, ENV_VIRTUAL_HOST, ENV__, here,
For help, use /usr/bin/supervisord -h,

Previous version was working ok.

No connection from DSMR with Mosquitto MQTT broker

Using Mosquitto MQTT broker as a Hass.io add-on and created a login for DSMR reader, but there will be no connection (request) from DSMR to Mosquitto MQTT. Also when using a wrong username/passwor in the DSMR configuration, there will be nothing in the Mosquitto MQTT log.

Running this docker with docker dompose and using the newest version v2.0.2.

Any suggestions what could be the issue? Other application are able to connect to the same Mosquitto MQTT broker.

Dubbele installatie Python requirements

In de Dockerfile worden de requirements voor de applicatie geïnstalleerd maar in entrypoint.sh gebeurt dit nog een keer. Alleen deze keer in een eigen virtualenv. Volgens mij is dat aan de ene kant dubbelop maar aan de andere kant ook overbodig. Je hebt voor alle applicaties dezelfde requirements en in supervisor wordt er verwezen naar dezelfde virtualenv.

Zou het handiger zijn om virtualenv te laten vallen en alles gewoon globaal te installeren? Dat is wat ik meestal doe maar misschien is dat niet logisch.

Ik kan dit trouwens zelf wel recht trekken als je wilt. Dan zorg ik er gelijk voor dat de applicatie onder een unprivileged user draait. Het mag dan wel een container zijn maar dan nog wil je liever niet alles als root draaien.

Postgres port

I'm interested in trying the DSMR reader, and I would like to run it on my Synology NAS on Docker since I've got all my smart home stuff running there. I've got the Postgres Docker running already. Tried connecting to it via pgAdmin, and that seems to work great. I've made a database for DSMR so I'm all set, right?

Well, not really, since I can't seem to get this Docker running. I've downloaded it from the Docker GUI in DSM and downloaded it. I've then entered the right values in the environment settings. The onyl thing is that I have a different Postgres DB port since 5432 was already used. I've changed it to 6432 and I am able to connect via pgAdmin.

But how do I enter that here? I've tried ip:6432 but when I check the log it keeps doing this and reboots:

[ INFO ] Checking if the DSMR web credential variables have been set...
[ INFO ] Fixing /dev/ttyUSB* security...
[ INFO ] Removing existing PID files...
[ INFO ] Verifying if Postgres in running...

There's obviously no hardware connected, I am trying to fill the data via an external Raspberry 1 via the API. Is there a hidden environment setting or something? Tried PORT and DB_PORT as well.

Also, how do I set it to persist data on a specific folder I want? In all other Dockers I have a path I can set where data is saved.

1.19.0 released

Trying to upgrade to 1.19.0 but stuck on 1.17.0
Could you upgrade to the latest version please?

WARNING: The xdp3UZK6JlGcE2TznUl variable is not set

when doing a docker-compose pull on your dsmr container I get the following warning:
WARNING: The xdp3UZK6JlGcE2TznUl variable is not set. Defaulting to a blank string.
If I only have dsmrdb in my compose yaml file I don't get this warning.

dsmr_datalogger (exit status 1; not expected)

When I start the docker images I see the following:

dsmr | 2017-11-30 07:57:01,030 INFO spawned: 'dsmr_datalogger' with pid 139
dsmr | 2017-11-30 07:57:01,520 INFO exited: dsmr_datalogger (exit status 1; not expected)

The webinterface does also not come online.
What can be the issue?

Web user interface op andere port dan 8888

Om te beginnen een groot compliment voor dit werk. Het is met deze docker werkwijze een stuk gemakkelijker geworden om als niet-expert de nodige toepassingen op een linux systeem te installeren.

Vanwege problemen met een andere toepassing wil ik de web user interface op een andere poort dan 8888.
Ik dacht dat een voudig te doen door in de docker-compose.yaml file een ander poortnummer in te geven. Maar zo eenvoudig is het blijkbaar niet, Dit mislukte. Via deze andere poort kan ik de web user interface niet bereiken.
Hoe is dit wel mogelijk??

dsmr_datalogger (exit status 1; not expected)

When running "docker-compose up -d" and watching the logs the data-logger will not repeatedly exit.
The following 2 lines keep repeating themselves:

dsmr | 2018-03-04 20:15:01,030 INFO spawned: 'dsmr_datalogger' with pid 139
dsmr | 2018-03-04 20:15:01,520 INFO exited: dsmr_datalogger (exit status 1; not expected)

I've fixed this by adding "sudo chmod 666 /dev/ttyUSB0" to entrypoint.sh and after that rebuilding.
But I guess there might be a nicer option to do this. Perhaps by adding this line to the Dockerfile.

Splitsen van de interface en logger

Is het een idee om de interface en de logger te splitsen? Vooral omdat de kleine RPi die op de P1 poort aangesloten zit het anders wat zwaar voor z'n kiezen krijgt.

Aantal vraagjes

Superproject, dat eerst gezegd. een aantal vraagjes:

  1. Ik krijg geen readings te zien. Dit terwijl als ik met docker exec de container in ga en een cu doe dan zie ik met v2 readings voorbij komen. ttyUSB0 is netjes doorgezet, toch geen readings.

  2. restore van een backup geeft een error op de laatst import met cat.
    Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.35/containers/dsmrdb/json: dial unix /var/run/docker.sock: connect: permission denied

dus met docker exec de container in gegaan en hier de imort gedaan middels:
cat ./dsmrreader-postgresql-backup-Monday.sql | psql -U postgres
dit werkt wel, maar na reboot, geen gegevens.

  1. de configuratie in DSMR reader lijkt niet onthouden. is het niet handig een volume te mappen voor de config file?

thanks

DSMR 5 inlees interval

Is het mogelijk om een variabele aan de docker toe te voegen met welke frequentie hij data in leest.
DSMR 5 leest iedere seconde data in, wat meestal overkill is en hoge cpu load geeft.
in DSMR is het in de config aan te passen, kan dat ook in de docker?

dsmrreader/dsmr-reader#413

SSL cert from host into docker container

Thanks for creating this great container. Is it possible to create a docker option to give up an local SSL cert that can be used inside the container?

For example, I want to use something like this in the docker-compose

version: '3'
services:
 unifi-controller-goofball:
   container_name: unifi.controller.goofball
   image: goofball222/unifi:latest
   restart: unless-stopped
   network_mode: host
   volumes:
     - '/docker/unifi-goofball/kpn_config/config.gateway.json:/usr/lib/unifi/data/sites/default/config.gateway.json'
     - '/usr/share/hassio/ssl:/usr/lib/unifi/cert'
     - './data:/usr/lib/unifi/data'
     - './logs:/usr/lib/unifi/logs'
   environment:
     - TZ=Europe/Amsterdam
     - RUNAS_UID0=true

standard_init_linux.go:207: exec user process caused "exec format error"

Tried running dsmr on my raspberrypi 3b+ (ARMv7/8).

I keep receiving the following error:

standard_init_linux.go:207: exec user process caused "exec format error"

and the container keeps rebooting.

I use almost an identical copy of your compose file. Only difference is

  1. My mapped volumes are hard
  2. I omitted the commented out line # build: .
  3. I point to the ARMv8 version of your image
  4. I skipped exposing port 433
  5. Restart policy is unless-stopped:
version: '3.6'
services:

  dsmrdb:
    image: postgres:10.5-alpine
    container_name: dsmrdb
    restart: unless-stopped
    volumes:
      - /opt/dsmrdb:/var/lib/postgresql/data
    environment:
      - POSTGRES_USER=dsmrreader
      - POSTGRES_PASSWORD=dsmrreader
      - POSTGRES_DB=dsmrreader

  dsmr:
    image: xirixiz/dsmr-reader-docker:arm64v8-latest
    container_name: dsmr
    depends_on:
      - dsmrdb
    restart: unless-stopped
    cap_add:
      - NET_ADMIN
    links:
      - dsmrdb
    volumes:
      - /opt/dsmrdb:/var/lib/postgresql/data
      - /opt/dsmr_backups:/home/dsmr/app/backups
    environment:
      - DB_HOST=dsmrdb
      - DSMR_USER=admin
      - DSMR_EMAIL=root@localhost
      - DSMR_PASSWORD=admin
      - VIRTUAL_HOST=localhost
    ports:
      - 7777:80
    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0

Any thoughts?

edit:
ohh and yes, my user is part of the docker user group. dsmrdb is running fine and awaiting connection (and I'm already running other images like portainer, homeassistant, mariadb, influxdb, unifi)

Change password admin area

Unfortunately I lost my admin password to login at the configuration part of the DSMR Reader. Any change to reset this password?

At https://dsmr-reader.readthedocs.io/nl/latest/installation/explained.html I found the command './manage.py changepassword admin' but after I SSH into the running DSMR container and changed the password for 'admin'.

alt text

logging in with that new password results in

Verboden (403)
CSRF-verificatie mislukt. Aanvraag afgebroken.

\Solved: It was the reverse Proxy Traefik which was causing the CSFR-validation error.
Logging in on the local IP address is working.

DSMRREADER_BACKEND_SLEEP: unbound variable

Getting this error DSMRREADER_BACKEND_SLEEP: unbound variable.
This happens with and without passing the vars.

Back to v1.27.0 and problems gone.

At this time of the day no time to reproduce yet in a test environment. 😀
Oh and good thing these vars are being added. 👍
Maybe add DSMRREADER_MQTT_SLEEP too?

TimeZone not being picked up

Hoi Bram,

Ik probeer dus de timezone hetzelfde te krijgen als de server waarop de docker instantie draait.

In mijn docker compose heb ik nu het volgende staan

    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
    environment:
      - TZ=Europe/Amsterdam

Het commando date geeft alleen nog steeds aan dat het UTC is.

Het gaat werken wanneer ik de package tzdata installeer in de docker image.
apk add --no-cache tzdata. date heeft nu aan dat het CEST is.

Doe ik nog iets verkeerd in de docker compose of is het probleem idd de missende package?

Grt, Jork

X-Frame-Options sameorigin uitzetten in Django of filteren in NGINX?

Niet zozeer een issue maar een vraag;

Wil graag de dsmr-reader embedden in een iframe panel in HASS, nu ben ik tegen gekomen dat het framework deze header meestuurt echter kom ik niet veel config tegen of dat nu vanuit de app of default enabled is.

Heeft iemand een idee hoe ik dit kan uitzetten in Django en of kan filteren in NGINX.
Het gaat iedergeval om de clickjacking module in Django.
daarnaast kan het natuurlijk ook zo zijn dat dit vooral in de dsmr reader app zelf aangepast moet worden ipv hier in de docker image.

Groet!

Raspberry PI

Als ik hem wil draaien op een rpi dan krijg ik in de log de volgende foutmelding:

dsmr | standard_init_linux.go:195: exec user process caused "exec format error"
dsmr exited with code 1

Zou de docker moeten werken op een rpi?

Problemen bij installeren op een Synology NAS (216+II)

Ik probeer deze docker op een Synology NAS te installeren.
Het compose bestand geeft al een fout, want de compose version 3 is niet beschikbaar.

Uiteindelijk via de GUI van Synology twee containers gestart met de settings genoemd in de compose.

Tijdens het starten worden de verschillende commando's uitgevoerd, maar zijn er ook enkele foutmeldingen. Die komen altijd neer op:

OperationalError: could not translate host name "dsmrdb" to address: Name or service not known

Nu zie ik geen andere foutmelding. Moet er een host dsmrb gemaakt worden? De postgres container heet dsmrb, zoals de compose aangeeft.

What to do?

migrate seperate DSMR to docker DSMR

i used a dropbox backup file to migrate my standalone dsmr to dsmr running from docker.

used these steps:

docker-compose stop dsmr
docker exec -t dsmrdb dropdb dsmrreader -U postgres
docker exec -t dsmrdb createdb -O dsmrreader dsmrreader -U postgres
cat /tmp/<your_dump>.sql | docker exec -i dsmrdb psql -U postgres
docker-compose start dsmr

But in dsmr docker, my settings are not restored nor is there any previous data to be found.

The postgress file is about 180MB large. But i'm curious if my data is really restored??

what does adding docker user to dialout group do?

Hi, want to try out this docker but would like to understand what you mean with:

You should first add the user you run Docker with on your host file system to the dialout group:
sudo usermod -aG dialout $(whoami)

Can you explain what this does and why it is required?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.