xirixiz / dsmr-reader-docker

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

unraid docker start niet meer op #313

Closed Ruvetuve closed 1 year ago

Ruvetuve commented 1 year ago

Support guidelines

I've found an issue and checked that ...

Description

Hi,

Ik krijg de volgende log uit unraid, waarna de container direct afsluit. Ik kan mij herinneren dat ik gister de image geupdate heb. Als ik de debug env variable toevoeg aan de startup zie ik nergens debug logs..

`[s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] 10-adduser: executing... usermod: no changes


User UID: 803 User GID: 803

[cont-init.d] 10-adduser: exited 0. [cont-init.d] 20-set-app-defaults: executing... Operations to perform: Apply all migrations: admin, auth, contenttypes, dsmr_api, dsmr_backend, dsmr_backup, dsmr_consumption, dsmr_datalogger, dsmr_dropbox, dsmr_frontend, dsmr_influxdb, 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', 559 unmodified. Updating password of superuser "admin" Deactivating any other existing superusers [cont-init.d] 20-set-app-defaults: exited 1. [cont-finish.d] executing container finish scripts... [cont-finish.d] done. [s6-finish] waiting for services. [s6-finish] sending all processes the TERM signal. [s6-finish] sending all processes the KILL signal and exiting.`

Expected behaviour

startup van de docker of log files

Actual behaviour

container stopt gelijk na starten

Steps to reproduce

Start de docker

Docker info

Client:
 Context:    default
 Debug Mode: false

Server:
 Containers: 38
  Running: 31
  Paused: 0
  Stopped: 7
 Images: 38
 Server Version: 20.10.5
 Storage Driver: btrfs
  Build Version: Btrfs v4.20.1 
  Library Version: 102
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 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.runtime.v1.linux runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b
 runc version: 12644e614e25b05da6fd08a38ffa0cfe1903fdec
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.10.28-Unraid
 Operating System: Slackware 14.2 x86_64 (post 14.2 -current)
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 31.24GiB
 Name: Nuc
 ID: F3E4:UWT3:OWU6:CBZ3:T44O:65B6:YS3K:VBHZ:7LAD:NUTT:A5UO:ACLQ
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

Version

none

Docker compose

none

Container logs

`[s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] 10-adduser: executing... usermod: no changes


User UID: 803 User GID: 803

[cont-init.d] 10-adduser: exited 0. [cont-init.d] 20-set-app-defaults: executing... Operations to perform: Apply all migrations: admin, auth, contenttypes, dsmr_api, dsmr_backend, dsmr_backup, dsmr_consumption, dsmr_datalogger, dsmr_dropbox, dsmr_frontend, dsmr_influxdb, 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', 559 unmodified. Updating password of superuser "admin" Deactivating any other existing superusers [cont-init.d] 20-set-app-defaults: exited 1. [cont-finish.d] executing container finish scripts... [cont-finish.d] done. [s6-finish] waiting for services. [s6-finish] sending all processes the TERM signal. [s6-finish] sending all processes the KILL signal and exiting.`

Additional info

No response

xirixiz commented 1 year ago

Hmm, this is odd as there's no output at all. Somehting like this:

-> docker logs -f dsmr
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 10-adduser: executing...
usermod: no changes

-------------------------
User UID: 803
User GID: 803
-------------------------

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-set-app-defaults: executing...
[ INFO ] DSMR Reader Reader release: 5.9.0
[ INFO ] DSMR Reader Reader Docker release: 2022.12.04
[ 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...
[ INFO ] Database connectivity successfully verified!
[ INFO ] Vacuum cleaning enabled. Vacuming database...
vacuumdb: vacuuming database "dsmrreader"
[ INFO ] Running post configuration...
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, dsmr_api, dsmr_backend, dsmr_backup, dsmr_consumption, dsmr_datalogger, dsmr_dropbox, dsmr_frontend, dsmr_influxdb, dsmr_mindergas, dsmr_mqtt, dsmr_notification, dsmr_pvoutput, dsmr_stats, dsmr_weather, sessions
Running migrations:
  No migrations to apply.

559 static files copied to '/var/www/dsmrreader/static'.
Updating password of superuser "admin"
Deactivating any other existing superusers
[ INFO ] Checking for CLIENT CERTIFICATE AUTHENTICATION configuration...
[ INFO ] ENABLE_CLIENTCERT_AUTH is disabled, nothing to see here. Continuing...
[ INFO ] Checking for NGINX SSL configuration...
[ INFO ] ENABLE_NGINX_SSL is disabled, nothing to see here. Continuing...
[ INFO ] Checking for HTTP AUTHENTICATION configuration...
[ INFO ] ENABLE_HTTP_AUTH is disabled, nothing to see here. Continuing...
[ INFO ] Configuring DSMR Reader to run all processes in a single container with a serial or ipv4 datalogger...
[ INFO ] Using a serial connection for the DSMR Reader remote datalogger...
[ INFO ] Fixing /dev/ttyUSB0 security...
[ INFO ] Adding serial input method configuration settings...
[cont-init.d] 20-set-app-defaults: exited 0.

It looks like something is wrong with caching or something as I also see 0 static files copied to '/var/www/dsmrreader/static', 559 unmodified ...umnodified?? . Can you remove the container fully and retry again?

Ruvetuve commented 1 year ago

same result. but it seems to copy the files now.

log:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] 10-adduser: executing... usermod: no changes


User UID: 803 User GID: 803

[cont-init.d] 10-adduser: exited 0. [cont-init.d] 20-set-app-defaults: executing... Operations to perform: Apply all migrations: admin, auth, contenttypes, dsmr_api, dsmr_backend, dsmr_backup, dsmr_consumption, dsmr_datalogger, dsmr_dropbox, dsmr_frontend, dsmr_influxdb, dsmr_mindergas, dsmr_mqtt, dsmr_notification, dsmr_pvoutput, dsmr_stats, dsmr_weather, sessions Running migrations: No migrations to apply.

559 static files copied to '/var/www/dsmrreader/static'. Updating password of superuser "admin" Deactivating any other existing superusers [cont-init.d] 20-set-app-defaults: exited 1. [cont-finish.d] executing container finish scripts... [cont-finish.d] done. [s6-finish] waiting for services. [s6-finish] sending all processes the TERM signal. [s6-finish] sending all processes the KILL signal and exiting.

Ruvetuve commented 1 year ago

I'm using this instance for receiver only from a rasp pi which is sending the data to this unraid docker.

Ruvetuve commented 1 year ago

Saw you just pushed a new version, which is now taking the DEBUG arg into account, thanks!

Also the container works again, I do see some errors because i use receiver and not standalone (I assume)

`Starting DSMR Reader - datalogger... 192.168.0.5 - - [19/Dec/2022:11:26:29 +0100] "POST /api/v1/datalogger/dsmrreading HTTP/1.1" 201 0 "-" "python-requests/2.28.1" "-" Current logging level set to "ERROR". More information can be found here: https://dsmr-reader.readthedocs.io/en/latest/how-to/troubleshooting/enabling-debug-logging.html

2022-12-19 11:26:29,713 ERROR mixins run_once 107 | dsmr_datalogger.management.commands.dsmr_datalogger: [!] Exception raised. Traceback (most recent call last):

File "/app/dsmr_datalogger/scripts/dsmr_datalogger_api_client.py", line 39, in read_telegram serial_handle = serial.serial_for_url( ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/serial/init.py", line 90, in serial_for_url instance.open() File "/usr/local/lib/python3.11/site-packages/serial/serialposix.py", line 316, in open raise SerialException("Port must be configured before it can be used.") serial.serialutil.SerialException: Port must be configured before it can be used.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/app/dsmr_backend/mixins.py", line 96, in run_once self.run(data=self.data, **options) File "/app/dsmr_datalogger/management/commands/dsmr_datalogger.py", line 29, in run telegram = next(self.telegram_generator) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/dsmr_datalogger/scripts/dsmr_datalogger_api_client.py", line 43, in read_telegram raise RuntimeError("Failed to connect: {}", error) from error

RuntimeError: ('Failed to connect: {}', SerialException('Port must be configured before it can be used.'))

192.168.0.5 - - [19/Dec/2022:11:26:31 +0100] "POST /api/v1/datalogger/dsmrreading HTTP/1.1" 201 0 "-" "python-requests/2.28.1" "-" 192.168.0.47 - - [19/Dec/2022:11:26:31 +0100] "GET /xhr/header HTTP/1.1" 200 146 "http://dsmr.lan/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36" "-"`

xirixiz commented 1 year ago

Great! Check out the readme. Receiver mode doesn't exist anymore with that name:

https://github.com/xirixiz/dsmr-reader-docker#dsmr-datalogger-related

Ruvetuve commented 1 year ago

Ok thanks, ive changed _DATALOGGER_MODE to _apiserver so now the docker startup says _-e 'DATALOGGER_MODE'='apiserver'

by setting the unraid template

DATALOGGER MODE (change if P1 port is on this machine to STANDALONE)

to _receiver|standalone|api_server|apiclient

Still i get these type or errors as shown below. Do i need to set something inside DSMR configuration screens?

` 192.168.0.5 - - [19/Dec/2022:13:40:30 +0100] "POST /api/v1/datalogger/dsmrreading HTTP/1.1" 201 0 "-" "python-requests/2.28.1" "-" 192.168.0.5 - - [19/Dec/2022:13:40:32 +0100] "POST /api/v1/datalogger/dsmrreading HTTP/1.1" 201 0 "-" "python-requests/2.28.1" "-" Starting DSMR Reader - datalogger... Current logging level set to "ERROR". More information can be found here: https://dsmr-reader.readthedocs.io/en/latest/how-to/troubleshooting/enabling-debug-logging.html

2022-12-19 13:40:33,435 ERROR mixins run_once 107 | dsmr_datalogger.management.commands.dsmr_datalogger: [!] Exception raised. Traceback (most recent call last):

File "/app/dsmr_datalogger/scripts/dsmr_datalogger_api_client.py", line 39, in read_telegram serial_handle = serial.serial_for_url( ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/serial/init.py", line 90, in serial_for_url instance.open() File "/usr/local/lib/python3.11/site-packages/serial/serialposix.py", line 316, in open raise SerialException("Port must be configured before it can be used.") serial.serialutil.SerialException: Port must be configured before it can be used.

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/app/dsmr_backend/mixins.py", line 96, in run_once self.run(data=self.data, **options) File "/app/dsmr_datalogger/management/commands/dsmr_datalogger.py", line 29, in run telegram = next(self.telegram_generator) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/dsmr_datalogger/scripts/dsmr_datalogger_api_client.py", line 43, in read_telegram raise RuntimeError("Failed to connect: {}", error) from error

RuntimeError: ('Failed to connect: {}', SerialException('Port must be configured before it can be used.'))

192.168.0.5 - - [19/Dec/2022:13:40:34 +0100] "POST /api/v1/datalogger/dsmrreading HTTP/1.1" 201 0 "-" "python-requests/2.28.1" "-" 192.168.0.5 - - [19/Dec/2022:13:40:36 +0100] "POST /api/v1/datalogger/dsmrreading HTTP/1.1" 201 0 "-" `

xirixiz commented 1 year ago

Correct. The name of the variable is DSMRREADER_OPERATION_MODE 😄

Ruvetuve commented 1 year ago

added variable DSMRREADER_OPERATION_MODE to the unraid template with

Key: DSMRREADER_OPERATION_MODE Value: api_server

And the errors are gone, thanks again!