psa_car_controller icon indicating copy to clipboard operation
psa_car_controller copied to clipboard

Webserver becomes unreachable within the day

Open R-dehaan opened this issue 1 year ago • 11 comments

Describe the bug After some time the server isn't reachable anymore. Also HA is not able to retrieve or send any information to the server.

To Reproduce Steps to reproduce the behavior:

  1. what command did you use No specific command, it just occurs after a while

  2. when the bug append ? Don't know, a while already

  3. Does it persist after restarting the program? After restarting server is reachable both in browser and via HA. But after some time it is unreachable, browser goes into time out.

  4. Does it persist after recreate config by going to http://server_address:port/config? Yes.

Config file Give the anonymize content of the config file

Environment (please complete the following information):

  • OS: [e.g. Windows]: Linux - Running in docker container managed by portainer
  • Brand and model of car: Peugeot E208
  • Application version (commit number, branch or tag): 3.5.3
  • Log from http://server_address:port/log and browser console log Can post the log but nothing special is shown as connection to the car still works. But no incoming traffic from my home network.

Additional context Already reinstalled and repulled the whole image, so I am a bit lost what to do.

R-dehaan avatar Sep 19 '24 17:09 R-dehaan

I have the same problem i think. Need to manually restart the service because it stops working after "some days"

grendyx avatar Sep 23 '24 19:09 grendyx

@grendyx

I have now incoorporated in my docker compose file a health check that checks if the webserver is still reachable. If it isnt reachable it will put the container to "unhealthy". Autoheal (another container) guards all containers and restarts unhealthy containers. In that way it is automatically rebooted, not really tidy but at least it works.

See below the restarts of the service: image

R-dehaan avatar Sep 23 '24 19:09 R-dehaan

@grendyx

I have now incoorporated in my docker compose file a health check that checks if the webserver is still reachable.

If it isnt reachable it will put the container to "unhealthy".

Autoheal (another container) guards all containers and restarts unhealthy containers.

In that way it is automatically rebooted, not really tidy but at least it works.

See below the restarts of the service:

image

Could you share your docker compose file. I'd like to do the same.

wormvortex avatar Sep 27 '24 06:09 wormvortex

Do I need to do anything or should your magic do the trick? I'm just a user and don't know anything about dockers or coding etc :D.. Everything has worked for at least for a few days without restarting!

grendyx avatar Sep 27 '24 07:09 grendyx

@wormvortex see code below:

name: psa_car_controller services: psa_car_controller: tty: true stdin_open: true container_name: peugeot_psa_car_controller ports: - 5000:5000 volumes: - psa_data:/config restart: unless-stopped image: flobz/psa_car_controller labels: - "autoheal=true" healthcheck: test: curl --fail http://localhost:5000 || exit 1 interval: 60s retries: 3 start_period: 90s timeout: 15s

volumes: psa_data: external: true

Can't get the formatting right here, but at least you can copy

R-dehaan avatar Sep 27 '24 08:09 R-dehaan

Same for me. Are there any new findings?

soulcrash14 avatar Oct 30 '24 11:10 soulcrash14

@wormvortex see code below:

name: psa_car_controller services: psa_car_controller: tty: true stdin_open: true container_name: peugeot_psa_car_controller ports: - 5000:5000 volumes: - psa_data:/config restart: unless-stopped image: flobz/psa_car_controller labels: - "autoheal=true" healthcheck: test: curl --fail http://localhost:5000 || exit 1 interval: 60s retries: 3 start_period: 90s timeout: 15s

volumes: psa_data: external: true

Can't get the formatting right here, but at least you can copy

Finally got round to trying this and can't get it to work. Not sure if it's my formatting. I'm getting either `services.healthcheck Additional property interval is not allowed' or '(root) Additional property healthcheck is not allowed'

wormvortex avatar Nov 20 '24 21:11 wormvortex

try:

    healthcheck:
      test: ['CMD-SHELL', 'curl --fail http://localhost:5000 || exit 1']
      interval: 60s
      retries: 3
      start_period: 90s
      timeout: 15s

kurim avatar Nov 20 '24 22:11 kurim

try:

    healthcheck:
      test: ['CMD-SHELL', 'curl --fail http://localhost:5000 || exit 1']
      interval: 60s
      retries: 3
      start_period: 90s
      timeout: 15s

That worked. Thanks!

wormvortex avatar Nov 22 '24 16:11 wormvortex

If you want to use docker compose or stack you can use the following code:

services:
  psa_car_controller:
    container_name: peugeot_psa_car_controller    
    image: flobz/psa_car_controller
    tty: true
    stdin_open: true
    ports:
      - "5000:5000"
    volumes:
      - psa_data:/config
    restart: unless-stopped
    labels:
      - "autoheal=true"
    healthcheck:
      test: ['CMD-SHELL', 'curl --fail http://localhost:5000 || exit 1']
      interval: 60s
      retries: 3
      start_period: 90s
      timeout: 15s
volumes:
  psa_data:

Simanias avatar Dec 16 '24 08:12 Simanias

try: healthcheck: test: ['CMD-SHELL', 'curl --fail http://localhost:5000 || exit 1'] interval: 60s retries: 3 start_period: 90s timeout: 15s

That worked. Thanks!

In my case I also had to add the 'autoheal' label and the autoheal service, but maybe the users above already had that added. Anyway, I had to add the following additions to my docker-compose.yml.

version: '3' services:

autoheal: image: willfarrell/autoheal:1.2.0 restart: always volumes: - /var/run/docker.sock:/var/run/docker.sock environment: - AUTOHEAL_CONTAINER_LABEL=autoheal` and: psa service ... labels: - "autoheal=true" healthcheck: test: ['CMD-SHELL', 'curl --fail http://localhost:5000 || exit 1'] interval: 30s timeout: 10s retries: 3

But this should just be a temporary workaround.

Is anyone already working on a resolution? If not I can try to fix it (not very familiar with python yet though), but before I spend time on it, is this project still active and open for merge requests @flobz?

nickgr6 avatar Jan 22 '25 18:01 nickgr6