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

Add healthcheck #83

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add healthcheck #83

wants to merge 1 commit into from

Conversation

skrul
Copy link

@skrul skrul commented Jan 12, 2025

Temporary measure to restart TeslaBleHttpProxy until #76 is fixed. Adds a heathcheck that causes the container to go unhealthy when it is consuming more than 100MB of memory. This requires willfarrell/autoheal to be added to your docker-compose.yaml since docker itself does not restart unhealthy containers:

services:
  tesla-ble-http-proxy:
    image: wimaha/tesla-ble-http-proxy
    environment:
      - logLevel=debug
    container_name: tesla-ble-http-proxy
    volumes:
      - /root/key:/key
      - /var/run/dbus:/var/run/dbus
    restart: always
    privileged: true
    network_mode: host
    cap_add:
      - NET_ADMIN
      - SYS_ADMIN
    labels:
      autoheal-app: true
  autoheal:
    deploy:
      replicas: 1
    environment:
      AUTOHEAL_CONTAINER_LABEL: autoheal-app
    image: willfarrell/autoheal:latest
    network_mode: none
    restart: always
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

Not sure if this should be merged, but could be useful to others experiencing this problem.

@skrul skrul force-pushed the skrul--healthcheck branch from 5ca1409 to 1b6c2cd Compare January 12, 2025 03:33
@skrul skrul force-pushed the skrul--healthcheck branch from 1b6c2cd to 9debb93 Compare January 12, 2025 04:08
@wimaha
Copy link
Owner

wimaha commented Jan 12, 2025

Hi, thanks for the PR. It would be a good workaround, but not a real solution. Personally I don't want the FROM alpine:3.21 because the image would become very big file size.

If it's ok for you we wait for a real fix for this issue.

@skrul
Copy link
Author

skrul commented Jan 12, 2025

Yes, I was not expecting this to be accepted, was mostly just for me 😄 That said, it might be interesting to have some kind of health check since the proxy is intended to run all the time. I was first thinking of adding a check for "time since last command processed" but this makes a lot of assumptions about usage (having a predictable client like evcc helps) plus I wasn't sure if I could tell when the car was not present -- would the context deadline exceeded error from NewConnection work for this?

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

Successfully merging this pull request may close these issues.

2 participants