Commit 20795aec authored by Ash McKenzie's avatar Ash McKenzie

Geo: Check for DB replication enabled and working

parent 5c2ec7af
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
module SystemCheck module SystemCheck
module Geo module Geo
class DatabaseReplicationCheck < SystemCheck::BaseCheck class DatabaseReplicationEnabledCheck < SystemCheck::BaseCheck
set_name 'Using database streaming replication?' set_name 'Database replication enabled?'
set_skip_reason 'not a secondary node' set_skip_reason 'not a secondary node'
def skip? def skip?
...@@ -11,16 +11,22 @@ module SystemCheck ...@@ -11,16 +11,22 @@ module SystemCheck
end end
def check? def check?
Gitlab::Database.db_read_only? geo_health_check.replication_enabled?
end end
def show_error def show_error
try_fixing_it( try_fixing_it(
'Follow Geo setup instructions to configure primary and secondary nodes for streaming replication' 'Follow Geo setup instructions to configure primary and secondary nodes for replication'
) )
for_more_information('doc/gitlab-geo/database.md') for_more_information('doc/gitlab-geo/database.md')
end end
private
def geo_health_check
@geo_health_check ||= Gitlab::Geo::HealthCheck.new
end
end end
end end
end end
# frozen_string_literal: true
module SystemCheck
module Geo
class DatabaseReplicationWorkingCheck < SystemCheck::BaseCheck
set_name 'Database replication working?'
set_skip_reason 'not a secondary node'
def skip?
!Gitlab::Geo.secondary?
end
def check?
geo_health_check.replication_enabled? && geo_health_check.replication_working?
end
def show_error
try_fixing_it(
'Follow Geo setup instructions to configure primary and secondary nodes for replication'
)
for_more_information('doc/gitlab-geo/database.md')
end
private
def geo_health_check
@geo_health_check ||= Gitlab::Geo::HealthCheck.new
end
end
end
end
...@@ -15,7 +15,8 @@ module SystemCheck ...@@ -15,7 +15,8 @@ module SystemCheck
SystemCheck::Geo::LicenseCheck, SystemCheck::Geo::LicenseCheck,
SystemCheck::Geo::EnabledCheck, SystemCheck::Geo::EnabledCheck,
SystemCheck::Geo::GeoDatabaseConfiguredCheck, SystemCheck::Geo::GeoDatabaseConfiguredCheck,
SystemCheck::Geo::DatabaseReplicationCheck, SystemCheck::Geo::DatabaseReplicationEnabledCheck,
SystemCheck::Geo::DatabaseReplicationWorkingCheck,
SystemCheck::Geo::FdwEnabledCheck, SystemCheck::Geo::FdwEnabledCheck,
SystemCheck::Geo::FdwSchemaUpToDateCheck, SystemCheck::Geo::FdwSchemaUpToDateCheck,
SystemCheck::Geo::HttpConnectionCheck, SystemCheck::Geo::HttpConnectionCheck,
......
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