caddy-dynamicdns icon indicating copy to clipboard operation
caddy-dynamicdns copied to clipboard

Interface IP source doesn't refresh when server connects to internet on boot

Open jm355 opened this issue 1 year ago • 2 comments

When I reboot my server, docker compose/caddy starts before it connects to the internet and has an IP address, so the interface IP source doesn't return anything and so doesn't update the dynamic dns with the new IP once it does connect.

Possible solutions:

  • Have a "disconnected TTL" option with a default of, say, 20 seconds, so when all sources fail to return an IP address, they will keep trying until it works
  • When all sources fail, check if the system is online and wait to be online before trying again. This could be combined with the above, so the "disconnected TTL" option would only be used once it's online again until a source returns an IP, at which point it will use the normal TTL value
  • Could apply those globally, or only to certain sources like the interface source

jm355 avatar May 18 '24 15:05 jm355

The solution is probably that you delay the Docker service to start after the networking services. If you're using systemd, you'd want to adjust the Docker service with After=network.service, I think.

francislavoie avatar May 18 '24 15:05 francislavoie

Hmm, it looks like my docker service already has After=network-online.target. I'm just using the default one in debian bookworm for docker compose.

jm355 avatar May 18 '24 15:05 jm355