[GH-ISSUE #140] Feature Request: Healthcheck for newt container #227

Closed
opened 2026-04-12 06:37:04 -05:00 by GiteaMirror · 5 comments
Owner

Originally created by @daddeldash on GitHub (Sep 18, 2025).
Original GitHub issue: https://github.com/fosrl/newt/issues/140

Hey guys,

as docker has a built in mechanism to restart malfunctioning containers, it could be a good idea to use a healthcheck for the newt containers. Sorry for not directly opening a pull request, but I‘m not very familliar with git and its mechanisms. So here is what I actually use for healthchecks


  newt:
    image: fosrl/newt:latest
    environment:
      - PANGOLIN_ENDPOINT=${NEWT_ENDPOINT}
      - NEWT_ID=${NEWT_ID}
      - NEWT_SECRET=${NEWT_SECRET}
      - DOCKER_SOCKET=/var/run/docker.sock
    healthcheck:
      test:
        - CMD
        - wget
        - --no-verbose
        - --tries=1
        - --spider
        - --quiet
        - ${NEWT_ENDPOINT}
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 30s
      start_interval: 1s
Originally created by @daddeldash on GitHub (Sep 18, 2025). Original GitHub issue: https://github.com/fosrl/newt/issues/140 Hey guys, as docker has a built in mechanism to restart malfunctioning containers, it could be a good idea to use a healthcheck for the newt containers. Sorry for not directly opening a pull request, but I‘m not very familliar with git and its mechanisms. So here is what I actually use for healthchecks ``` newt: image: fosrl/newt:latest environment: - PANGOLIN_ENDPOINT=${NEWT_ENDPOINT} - NEWT_ID=${NEWT_ID} - NEWT_SECRET=${NEWT_SECRET} - DOCKER_SOCKET=/var/run/docker.sock healthcheck: test: - CMD - wget - --no-verbose - --tries=1 - --spider - --quiet - ${NEWT_ENDPOINT} interval: 30s timeout: 10s retries: 3 start_period: 30s start_interval: 1s ```
Author
Owner

@oschwartz10612 commented on GitHub (Sep 20, 2025):

We have a health file which I think solves this? We should create an
example maybe!

From the readme:

health-file (optional): Check if connection to WG server (pangolin) is
ok. creates a file if ok, removes it if not ok. Can be used with docker
healtcheck to restart newt

<!-- gh-comment-id:3315055638 --> @oschwartz10612 commented on GitHub (Sep 20, 2025): We have a health file which I think solves this? We should create an example maybe! From the readme: health-file (optional): Check if connection to WG server (pangolin) is ok. creates a file if ok, removes it if not ok. Can be used with docker healtcheck to restart newt
Author
Owner

@daddeldash commented on GitHub (Sep 20, 2025):

Sorry, I completely overlooked that point.
Perhaps it would be a good idea to integrate the health check directly into the container via the Dockerfile. Then it would be used automatically.

<!-- gh-comment-id:3315292973 --> @daddeldash commented on GitHub (Sep 20, 2025): Sorry, I completely overlooked that point. Perhaps it would be a good idea to integrate the health check directly into the container via the Dockerfile. Then it would be used automatically.
Author
Owner

@jakbutler commented on GitHub (Oct 6, 2025):

Here's an example that worked for me, using the health file:

services:
  newt:
    image: fosrl/newt
    container_name: newt
    volumes:
      - ${CONFIG}/newt:/var/newt #optional, if you want the health file available outside of the container
    environment:
      - PANGOLIN_ENDPOINT=${NEWT_ENDPOINT}
      - NEWT_ID=${NEWT_ID}
      - NEWT_SECRET=${NEWT_SECRET}
      - DOCKER_SOCKET=/var/run/docker.sock
      - HEALTH_FILE=/var/newt/healthy
    healthcheck:
      test: ["CMD-SHELL", "[ -f /var/newt/healthy ]"]
      interval: 30s
      timeout: 5s
      retries: 5
      start_period: 30s
<!-- gh-comment-id:3373872033 --> @jakbutler commented on GitHub (Oct 6, 2025): Here's an example that worked for me, using the health file: ```yaml services: newt: image: fosrl/newt container_name: newt volumes: - ${CONFIG}/newt:/var/newt #optional, if you want the health file available outside of the container environment: - PANGOLIN_ENDPOINT=${NEWT_ENDPOINT} - NEWT_ID=${NEWT_ID} - NEWT_SECRET=${NEWT_SECRET} - DOCKER_SOCKET=/var/run/docker.sock - HEALTH_FILE=/var/newt/healthy healthcheck: test: ["CMD-SHELL", "[ -f /var/newt/healthy ]"] interval: 30s timeout: 5s retries: 5 start_period: 30s ```
Author
Owner

@Wireheadbe commented on GitHub (Feb 16, 2026):

@oschwartz10612 - it would maybe be good to update the example at https://docs.pangolin.net/manage/sites/install-site#environment-variables-recommended with something like:

services:
  newt:
    image: fosrl/newt
    container_name: newt
    restart: unless-stopped
    environment:
      - PANGOLIN_ENDPOINT=https://app.pangolin.net
      - NEWT_ID=2ix2t8xk22ubpfy
      - NEWT_SECRET=nnisrfsdfc7prqsp9ewo1dvtvci50j5uiqotez00dgap0ii2
      - HEALTH_FILE=/var/healthy
    healthcheck:
      test: ["CMD-SHELL", "[ -f /var/healthy ]"]
      interval: 30s
      timeout: 5s
      retries: 5
      start_period: 30s

That works great, and it does restart the container properly when "anomalies" happen.

<!-- gh-comment-id:3908142293 --> @Wireheadbe commented on GitHub (Feb 16, 2026): @oschwartz10612 - it would maybe be good to update the example at https://docs.pangolin.net/manage/sites/install-site#environment-variables-recommended with something like: ``` services: newt: image: fosrl/newt container_name: newt restart: unless-stopped environment: - PANGOLIN_ENDPOINT=https://app.pangolin.net - NEWT_ID=2ix2t8xk22ubpfy - NEWT_SECRET=nnisrfsdfc7prqsp9ewo1dvtvci50j5uiqotez00dgap0ii2 - HEALTH_FILE=/var/healthy healthcheck: test: ["CMD-SHELL", "[ -f /var/healthy ]"] interval: 30s timeout: 5s retries: 5 start_period: 30s ``` That works great, and it does restart the container properly when "anomalies" happen.
Author
Owner

@oschwartz10612 commented on GitHub (Feb 25, 2026):

@Wireheadbe that would be good! Could you open a PR over at https://github.com/fosrl/docs-v2?

<!-- gh-comment-id:3961772715 --> @oschwartz10612 commented on GitHub (Feb 25, 2026): @Wireheadbe that would be good! Could you open a PR over at https://github.com/fosrl/docs-v2?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/newt#227