syncthing-relay-discovery icon indicating copy to clipboard operation
syncthing-relay-discovery copied to clipboard

Docker health check?

Open tdtgit opened this issue 7 months ago • 0 comments

Not sure if it is my network issue but the relay keeps stop working after awhile for. The error is the external IP is not matching and my relay disappear on relays pool. So I made this script for the healthcheck:

healthcheck.sh:

#!/bin/bash

# Fetch the current public IP
IP=$(curl -s http://checkip.amazonaws.com)

# Fetch the relay data and check if the IP exists
if curl -s https://relays.syncthing.net/endpoint | grep -q $IP; then
  echo "Health check passed: IP $IP found in relays" >> /proc/1/fd/1
  exit 0
else
  echo "Health check failed: IP $IP not found in relays" >> /proc/1/fd/1
  exit 1
fi

docker-compose.yml healthcheck part:

healthcheck:
      test: ["CMD", "/healthcheck.sh"]
      interval: 60s
      retries: 3
      start_period: 60s
      timeout: 5s

Is this sufficient healthcheck? Seems status port 22070 keep running and the response of /status cannot determine if the relay is still exist on the pool.

tdtgit avatar Jul 19 '24 15:07 tdtgit