xirixiz / dsmr-reader-docker

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

NGINX port incorrect after restart when using NGINX_LISTEN_PORT #332

Closed n9iels closed 1 year ago

n9iels commented 1 year ago

Support guidelines

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

Description

When setting the NGINX_LISTEN_PORT environment variable the port is correctly changed upon creation of the container. However, after restarting the container the default port 80 and the port set in the environment variable seems to merge and the container crashes.

Expected behaviour

The custom port should work after restarting the container.

Actual behaviour

The customly set port and the default port 80 seems to merge after restarting the container. Also the following error appears in the logs:

nginx: [emerg] invalid port in "808081" of the "listen"directive in /etc/nginx/http.d/dsmr-webinterface.conf:6

Steps to reproduce

  1. Create a conatiner and use the NGINX_LISTEN_PORT environment variable
  2. Build and start the container. Everything should work as normal and the normal and DSMR reader is reachable on the customly set port
  3. Restart the container
  4. Observe that DSMR reader is no longer reachable and the logs show the mentioned error

Docker info

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.10.4
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.17.2
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 3
  Running: 3
  Paused: 0
  Stopped: 0
 Images: 3
 Server Version: 23.0.4
 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: 2806fc1057397dbaeefbea0e4e17bddfbd388f38
 runc version: v1.1.5-0-gf19387a
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.0-70-generic
 Operating System: Ubuntu 22.04.2 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 1
 Total Memory: 1.93GiB
 Name: vps9301
 ID: de0757d1-21bb-415d-9d7d-1e6c27003765
 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

Docker compose

services:
  dsmr:
    image: xirixiz/dsmr-reader-docker:amd64-5.10.3-2023.03.01
    container_name: dsmr
    mem_limit: 521M
    restart: always
    network_mode: host
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - ./backups:/app/backups
    environment:
      - TZ=Europe/Amsterdam
      - DJANGO_DATABASE_HOST=localhost
      - DJANGE_DATABASE_PORT=5432
      - DJANGO_DATABASE_USER=dsmrreader
      - DJANGO_DATABASE_PASSWORD=xxxxxxx
      - DJANGO_DATABASE_NAME=dsmrreader
      - DSMRREADER_LOGLEVEL=WARNING
      - DSMRREADER_ADMIN_USER=admin
      - DSMRREADER_ADMIN_PASSWORD=xxxxxx
      - DSMRREADER_REMOTE_DATALOGGER_MODE=receiver
      - DSMRREADER_BACKUP_NAME_PREFIX=dsmrreader
      - DSMRREADER_OPERATION_MODE=api_server
      - NGINX_LISTEN_PORT=8081

Container logs

nginx: [emerg] invalid port in "808081" of the "listen"directive in /etc/nginx/http.d/dsmr-webinterface.conf:6

Additional info

No response

xirixiz commented 1 year ago

Ah yes, ofcourse. I just fixed it (try at least). A new release will be available soon.

xirixiz commented 1 year ago

Ja, ik denk dat ik het hele nginx config stuk eruit ga slopen. Het is denk ik beter dat wanneer je een specifieke config wenst, dat je die dan mount in de container. Het geknip en geplak met bash is onbetrouwbaar helaas.

Rolling back.