Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Container can only start if serial device is on ttyUSB* #310

Closed
3 tasks done
golles opened this issue Dec 13, 2022 · 15 comments
Closed
3 tasks done

Container can only start if serial device is on ttyUSB* #310

golles opened this issue Dec 13, 2022 · 15 comments

Comments

@golles
Copy link

golles commented Dec 13, 2022

Support guidelines

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

  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

Since the latest release, the serial port needs to be on a ttyUSB* port, commit: de0cec3

Getting this error: https://github.com/xirixiz/dsmr-reader-docker/blob/master/rootfs/etc/cont-init.d/20-set-app-defaults#L84

Expected behaviour

The container deals with serial devices on other locations than ttyUSB

Actual behaviour

The container can only start when I set the serial device on a ttyUSB*

Steps to reproduce

See docker-compose below

Docker info

NA.

Version

  • Docker compose version (type docker-compose --version): docker-compose version 1.29.2, build unknown
  • System info (type uname -a): Linux nuc10i3fnh 5.15.0-52-generic WARNING: The xdp3UZK6JlGcE2TznUl variable is not set #58-Ubuntu SMP Thu Oct 13 08:03:55 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Docker compose

dsmr:
    container_name: dsmr
    image: xirixiz/dsmr-reader-docker:latest
    restart: unless-stopped
    depends_on:
      - postgres
    volumes:
      - /etc/localtime:/etc/localtime:ro
    environment:
      - DJANGO_TIME_ZONE=${TZ}
      - VIRTUAL_HOST=localhost
      - DSMRREADER_ADMIN_USER=${DSMRREADER_ADMIN_USER}
      - DSMRREADER_ADMIN_PASSWORD=${DSMRREADER_ADMIN_PASSWORD}
      - DJANGO_DATABASE_HOST=${DJANGO_DATABASE_HOST}
    ports:
      - 7777:80
    devices:
      - /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AQ4KS8IA-if00-port0:/dev/dsmr

Container logs

Haven't stored any logs

Additional info

No response

@xirixiz
Copy link
Owner

xirixiz commented Dec 13, 2022

More info: #309

@xirixiz
Copy link
Owner

xirixiz commented Dec 13, 2022

Ah ok, sorry. What you could do is map to /dev/ttyUSB0 instead of /dev/dsmr. I'll fix it in a new release. Odd thing is that it already was in past releases actually...

Quick fix:

    devices:
      - /dev/serial/by-id/usb-FTDI_FT232R_USB_UART_AQ4KS8IA-if00-port0:/dev/ttyUSB0

@golles
Copy link
Author

golles commented Dec 13, 2022

That is indeed what I did (and why I no longer had the error logs :-) )

I haven't seen this before, and I have the latest version and update usually a few times per week.

Thanks

@xirixiz
Copy link
Owner

xirixiz commented Dec 13, 2022

New release is coming: https://github.com/xirixiz/dsmr-reader-docker/actions/runs/3686579928

It now validates whatever you specify for:

${DSMRREADER_REMOTE_DATALOGGER_SERIAL_PORT}

So in your case you should provide this env var with /dev/dsmr

@pyrocumulus
Copy link

pyrocumulus commented Dec 14, 2022

I have set my container to be a DSMR receiver with:

DSMRREADER_REMOTE_DATALOGGER_MODE=receiver

However with this new version I am unable to start the container. It keeps looking for USB devices, even if I set the aforementioned env var. It get this in the logs:

[ 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/ttyUSB* security...
[ FAIL ] Device /dev/ttyUSB* not found. Exiting...

It's clearly saying "using serial connection" but that's not what I want, as I've set it to receiver. It will never find a serial device on the system DSMR is hosted on. The serial data is coming from a different place in my network.


I see this issue now #303. However I cannot reach those mentioned settings, because my container is in an infinite reboot loop. I always used the receiver mode, because I have a different device with a datalogger script that uses the API to push telegrams in this container. I do not use network sockets or something like that. I just want to disable the datalogger in this container.

How do I do that?

@xirixiz
Copy link
Owner

xirixiz commented Dec 14, 2022

Hi, if you look at the readme on the main page it should become clear.
You need to use api_server now instead of receiver as there we're a lot of questions and unclarities with the previous setup(s) (sender, receiver...)

@xirixiz xirixiz closed this as completed Dec 14, 2022
@pyrocumulus
Copy link

pyrocumulus commented Dec 14, 2022

As you replied I just found that info in the readme indeed. It's getting hard to keep up with these kinds of changes :) I will try it when I get home from work.

Just for future reference, is there somewhere I can read these kinds of backwards incompatible changes before updating? Because it's quite some work going through all the commits and figuring out if something will break when I update the container. This is the second time that the way of telling the container it should not try to run the datalogger itself, has changed in an incompatible way.

Or perhaps it would be wise to also have backwards compatible mappings for these kinds of situations (like mapping the old value of "receiver" to "API_SERVER"). I know it's difficult because you are only wrapping another package (DSMR Reader) but I feel it could be a bit more smooth.

@xirixiz
Copy link
Owner

xirixiz commented Dec 14, 2022

Yes, working on it. I will create releases in GH in the future, so release notes are visible there.

It's api_server btw... lowercase ;). Updated the README

@pyrocumulus
Copy link

Excellent! I'll update my docker-compose tonight and let you know if it works. But I think this is the thing that's causing issues so I think it'll be all right.

@megapearl
Copy link

I'm having the same problem, changed the env to 'api_server' but it is still in a reboot loop.

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 ] Required files /etc/ssl/private/fullchain.pem and /etc/ssl/private/privkey.pem exists.

[ INFO ] SSL has already been enabled...

[ INFO ] NGINX SSL configured and enabled

[ 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...

[ FAIL ] Device /dev/ttyUSB0 not found. Exiting...
[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.
[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: 1019
User GID: 104
-------------------------
[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.02

[ 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: postgresql.flissinger.com with port: 5432...

[ INFO ] Database connectivity successfully verified!

[ 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.
0 static files copied to '/var/www/dsmrreader/static', 559 unmodified.

@puijken
Copy link

puijken commented Dec 14, 2022

PEBKAC here .. it works fine as documented.

@xirixiz
Copy link
Owner

xirixiz commented Dec 14, 2022

DSMRREADER_REMOTE_DATALOGGER_MODE=receiver

The env name has also changed:

DSMRREADER_OPERATION_MODE=api_server

@megapearl
Copy link

The documentation is unclear for me.
I had set the DSMRREADER_REMOTE_DATALOGGER_MODE to api_server but that didn't work out.
I removed that line and added:

DSMRREADER_REMOTE_DATALOGGER_MODE=api_server

And that is working, but I can't find it in the documentation.

@puijken
Copy link

puijken commented Dec 14, 2022

Like xirixiz said, you have to replace the environment variable:
So replace DSMRREADER_REMOTE_DATALOGGER_MODE=receiver with DSMRREADER_OPERATION_MODE=api_server

I had the same "issue" so PEBKAC :)

@pyrocumulus
Copy link

Container is running again. Problem is solved now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants