Commit 24555adb authored by Gabriel Mazetto's avatar Gabriel Mazetto

Added NTP check to make sure machine clock is in sync

parent 311a77d0
......@@ -394,6 +394,9 @@ gem 'health_check', '~> 2.6.0'
gem 'vmstat', '~> 2.3.0'
gem 'sys-filesystem', '~> 1.1.6'
# NTP client
gem 'net-ntp'
# Gitaly GRPC client
gem 'gitaly', '~> 0.9.0'
......
......@@ -503,6 +503,7 @@ GEM
mustermann (= 0.4.0)
mysql2 (0.4.5)
net-ldap (0.12.1)
net-ntp (2.1.3)
net-ssh (3.0.1)
netrc (0.11.0)
nokogiri (1.6.8.1)
......@@ -1053,6 +1054,7 @@ DEPENDENCIES
mousetrap-rails (~> 1.4.6)
mysql2 (~> 0.4.5)
net-ldap
net-ntp
net-ssh (~> 3.0.1)
nokogiri (~> 1.6.7, >= 1.6.7.2)
oauth2 (~> 1.4)
......
module SystemCheck
module Geo
class ClocksSynchronizationCheck < SystemCheck::BaseCheck
set_name 'Machine clock is synchronized'
def check?
Net::NTP.get.offset.abs < Gitlab::Geo::JwtRequestDecoder::IAT_LEEWAY
end
def show_error
try_fixing_it(
'Enable a NTP service on this machine to keep clocks synchronized'
)
end
end
end
end
......@@ -551,7 +551,8 @@ namespace :gitlab do
SystemCheck::Geo::EnabledCheck,
SystemCheck::Geo::GeoDatabaseConfiguredCheck,
SystemCheck::Geo::DatabaseReplicationCheck,
SystemCheck::Geo::HttpConnectionCheck
SystemCheck::Geo::HttpConnectionCheck,
SystemCheck::Geo::ClocksSynchronizationCheck
]
SystemCheck.run('Geo', checks)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment