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

Update failing after internet loss #165

Open
archef2000 opened this issue Nov 29, 2023 · 2 comments
Open

Update failing after internet loss #165

archef2000 opened this issue Nov 29, 2023 · 2 comments
Assignees

Comments

@archef2000
Copy link

Describe the bug
I sometimes losse internet and after that the container never recovers from that and is trowing a authentication error.

To Reproduce
Steps to reproduce the behavior:

  1. cut DSL
  2. reconnect dsl
  3. wait for router
  4. see logs

Expected behavior
Don't try to update the IP if it is failing to get the ip

Server:

  • OS: Ubuntu 22.04
@cdalvaro
Copy link

A healthcheck would be welcome to test the state of the container.

@alangrainger
Copy link

alangrainger commented Sep 21, 2024

Here's a healthcheck you can use.

Add this script healthcheck.sh to the same folder as your docker-compose.yml:

#!/bin/sh

# Check to see if the script is running
if ! ps ax | grep [c]loudflare-ddns > /dev/null 2>&1; then
    echo "cloudflare-ddns process not found. Exiting."
    exit 1
fi

# Get the remote IP from Cloudflare debugging page
local_ip=$(wget -qO - https://www.cloudflare.com/cdn-cgi/trace | grep '^ip=' | cut -d= -f2)

# Get the IP address for one of our DDNS URLs
remote_ip=$(getent hosts YOUR.WEBSITE.HERE | awk '{ print $1 }')

# Compare the two IP addresses
if [[ "$remote_ip" = "$local_ip" ]]; then
    echo "DDNS address is correct: $local_ip"
else
    echo "The IP addresses do not match:"
    echo "Local IP: $local_ip"
    echo "Cloudflare IP: $remote_ip"
    exit 1
fi

Then update your docker-compose.yml to add the healthcheck:

    volumes:
      - ./healthcheck.sh:/healthcheck.sh
    healthcheck:
      test: /healthcheck.sh
      interval: 5m
      retries: 1
      start_period: 20s
      timeout: 10s

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

4 participants