Improve NTP detection using system defined one and fallback to the predefined otherwise in `gitlab:geo:check`
https://gitlab.slack.com/archives/C32LCGC1H/p1524775031000032
See discussion:We initially decided to predefine a NTP server in our gitlab:geo:check
as a way to guarantee we will always have an endpoint to ping. This however doesn't work all the time, as the server may be firewalled or in an isolated environment without access to the open internet.
A better approach here would be to try to resolve NTP in the following order:
- Try to check for system defined NTP in most common places (ex:
/etc/ntp.conf
), if we find one, try to use that - If we can't find an NTP server or the server defined in
/etc/ntp.conf
times out, we fall back to the pre-defined one - If even the pre-defined one fails, we should print a human-readable message explaining what that check is trying to do, why it can't succeed, suggest to check the firewall or define a custom NTP server that is accessible to the machine and explain that the clock must be in sync with MAX of X seconds deviation from the two machines.
Edited by Gabriel Mazetto