xirixiz / dsmr-reader-docker

DSMR Reader in Docker.
https://hub.docker.com/r/xirixiz/dsmr-reader-docker
112 stars 33 forks source link

Trying to ru dsmr-reader image in remote-logging client, cannot get it to work #322

Closed rogierlommers closed 1 year ago

rogierlommers commented 1 year ago

Support guidelines

Description

The situation is as follows:

But I want to get rid of a server in the "meterkast", so I hired a VPS. The plan is to run dsmr in "api" mode in the VPS and in my "meterkast" I want to run dsmr in client-mode (so only reading P1 port and sending the telegrams to the API).

I would expect that no db access is required, but I receive a DB connection error.

Why is that? Basically my question is:

Expected behaviour

A very lightweight instance of dsmr reader which only reads the telegrams from the P1 port and sends them to a remote API instance.

Actual behaviour

Container doesn't start, with DB connection errors.

Steps to reproduce

Run the docker-compose snippet

Docker info

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.10.2
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.16.0
    Path:     /usr/local/lib/docker/cli-plugins/docker-compose
  scan: Docker Scan (Docker Inc.)
    Version:  v0.23.0
    Path:     /usr/libexec/docker/cli-plugins/docker-scan

Server:
 Containers: 5
  Running: 4
  Paused: 0
  Stopped: 1
 Images: 4
 Server Version: 23.0.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 2456e983eb9e37e47538f59ea18f2043c9a73640
 runc version: v1.1.4-0-g5fd4c4d
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.0-67-generic
 Operating System: Ubuntu 22.04.2 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 1
 Total Memory: 3.832GiB
 Name: services
 ID: 13456818-92b7-4387-b250-23bc05985eea
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Version

Everything is running on Ubuntu 22.04 LTS, using latest docker versions.

Docker compose

dsmr-logger:
    container_name: dsmr-logger
    image: xirixiz/dsmr-reader-docker:latest
    restart: unless-stopped
    tty: true
    cap_add:
      - NET_ADMIN
    environment:      
      - DSMRREADER_REMOTE_DATALOGGER_API_HOSTS=https://xxx.xxx.com
      - DSMRREADER_REMOTE_DATALOGGER_API_KEYS=xxx
      - DSMRREADER_REMOTE_DATALOGGER_DEBUG_LOGGING=true
      - DSMRREADER_REMOTE_DATALOGGER_INPUT_METHOD=serial
      - DSMRREADER_REMOTE_DATALOGGER_SERIAL_PORT=/dev/ttyUSB0
    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0


### Container logs
`dsmr-logger  | [cont-finish.d] done.
dsmr-logger  | [s6-finish] waiting for services.
dsmr-logger  | [s6-finish] sending all processes the TERM signal.
dsmr-logger  | [s6-finish] sending all processes the KILL signal and exiting.
dsmr-logger  | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
dsmr-logger  | [s6-init] ensuring user provided files have correct perms...exited 0.
dsmr-logger  | [fix-attrs.d] applying ownership & permissions fixes...
dsmr-logger  | [fix-attrs.d] done.
dsmr-logger  | [cont-init.d] executing container initialization scripts...
dsmr-logger  | [cont-init.d] 10-adduser: executing...
dsmr-logger  | usermod: no changes
dsmr-logger  |
dsmr-logger  | -------------------------
dsmr-logger  | User UID: 803
dsmr-logger  | User GID: 803
dsmr-logger  | -------------------------
dsmr-logger  |
dsmr-logger  | [cont-init.d] 10-adduser: exited 0.
dsmr-logger  | [cont-init.d] 20-set-app-defaults: executing...
[ INFO ] DSMR Reader Reader release: 5.10.3
[ INFO ] DSMR Reader Reader Docker release: 2023.02.01
[ INFO ] Ensure permissions...
[ INFO ] Setting architecture requirements...
[ INFO ] X64 Architecture
[ INFO ] Verifying if the DSMR Reader web credential variables have been set...
[ INFO ] Verifying database connectivity to host: dsmrdb with port: 5432...
dsmr-logger  | nc: getaddrinfo: Try again`

### Additional info

_No response_
rogierlommers commented 1 year ago

Sorry, totally my bad. I forgot to add the environment var DSMRREADER_OPERATION_MODE=api_client. After adding this, everything works fine.

rogierlommers commented 1 year ago

Maybe accept this, @xirixiz ? https://github.com/xirixiz/dsmr-reader-docker/pull/323