Commit 4c37cf27 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'fix-2760' into 'master'

Set the default value for geo_secondary_role flag to false for test environment

Closes #2760

See merge request !2304
parents e3b5f246 ea90f9dc
class Geo::BaseRegistry < ActiveRecord::Base class Geo::BaseRegistry < ActiveRecord::Base
self.abstract_class = true self.abstract_class = true
if Gitlab::Geo.secondary_role_enabled? if Gitlab::Geo.secondary_role_enabled? && Gitlab::Geo.geo_database_configured?
establish_connection Rails.configuration.geo_database establish_connection Rails.configuration.geo_database
end end
end end
...@@ -732,7 +732,7 @@ test: ...@@ -732,7 +732,7 @@ test:
geo_primary_role: geo_primary_role:
enabled: true enabled: true
geo_secondary_role: geo_secondary_role:
enabled: true enabled: false
staging: staging:
<<: *base <<: *base
...@@ -50,6 +50,10 @@ module Gitlab ...@@ -50,6 +50,10 @@ module Gitlab
Gitlab.config.geo_secondary_role['enabled'] Gitlab.config.geo_secondary_role['enabled']
end end
def self.geo_database_configured?
Rails.configuration.respond_to?(:geo_database)
end
def self.license_allows? def self.license_allows?
::License.feature_available?(:geo) ::License.feature_available?(:geo)
end end
......
...@@ -6,7 +6,7 @@ module Gitlab ...@@ -6,7 +6,7 @@ module Gitlab
return '' unless Gitlab::Geo.secondary? return '' unless Gitlab::Geo.secondary?
return 'The Geo secondary role is disabled.' unless Gitlab::Geo.secondary_role_enabled? return 'The Geo secondary role is disabled.' unless Gitlab::Geo.secondary_role_enabled?
return 'The Geo database configuration file is missing.' unless self.geo_database_configured? return 'The Geo database configuration file is missing.' unless Gitlab::Geo.geo_database_configured?
return 'The Geo node has a database that is not configured for streaming replication with the primary node.' unless self.database_secondary? return 'The Geo node has a database that is not configured for streaming replication with the primary node.' unless self.database_secondary?
database_version = self.get_database_version.to_i database_version = self.get_database_version.to_i
...@@ -61,10 +61,6 @@ module Gitlab ...@@ -61,10 +61,6 @@ module Gitlab
.first .first
.fetch('pg_is_in_recovery') == 't' .fetch('pg_is_in_recovery') == 't'
end end
def self.geo_database_configured?
Rails.configuration.respond_to?(:geo_database)
end
end end
end end
end end
...@@ -58,3 +58,6 @@ if [ "$SETUP_DB" != "false" ]; then ...@@ -58,3 +58,6 @@ if [ "$SETUP_DB" != "false" ]; then
# EE-only # EE-only
bundle exec rake geo:db:drop geo:db:create geo:db:schema:load geo:db:migrate bundle exec rake geo:db:drop geo:db:create geo:db:schema:load geo:db:migrate
fi fi
# EE-only
sed -i -e '/geo_secondary_role\:/ {' -e 'n; s/enabled\: false/enabled\: true/' -e '}' config/gitlab.yml
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