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

Docker health check? #8

Open
tdtgit opened this issue Jul 19, 2024 · 0 comments
Open

Docker health check? #8

tdtgit opened this issue Jul 19, 2024 · 0 comments

Comments

@tdtgit
Copy link

tdtgit commented Jul 19, 2024

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.

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

No branches or pull requests

1 participant