Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
bddb3c14
Commit
bddb3c14
authored
Apr 09, 2019
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add geo node name setting
parent
62ccb122
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
6 deletions
+23
-6
config/gitlab.yml.example
config/gitlab.yml.example
+10
-0
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+3
-0
ee/app/models/geo_node.rb
ee/app/models/geo_node.rb
+8
-5
ee/spec/tasks/geo_rake_spec.rb
ee/spec/tasks/geo_rake_spec.rb
+2
-1
No files found.
config/gitlab.yml.example
View file @
bddb3c14
...
...
@@ -407,6 +407,16 @@ production: &base
# dsn: https://<key>@sentry.io/<project>
# environment: 'production' # e.g. development, staging, production
## Geo
# NOTE: These settings will only take effect if Geo is enabled
geo:
# This is an optional identifier which Geo nodes can use to identify themselves.
# For example, if external_url is the same for two secondaries, you must specify
# a unique Geo node name for those secondaries.
#
# If it is blank, it defaults to external_url.
node_name: ''
#
# 2. GitLab CI settings
# ==========================
...
...
config/initializers/1_settings.rb
View file @
bddb3c14
...
...
@@ -268,6 +268,9 @@ Settings.pages.admin['certificate'] ||= ''
#
# Geo
#
Settings
[
'geo'
]
||=
Settingslogic
.
new
({})
# For backwards compatibility, default to gitlab_url and if so, ensure it ends with "/"
Settings
.
geo
[
'node_name'
]
=
Settings
.
geo
[
'node_name'
].
presence
||
Settings
.
gitlab
[
'url'
].
chomp
(
'/'
).
concat
(
'/'
)
#
# External merge request diffs
...
...
ee/app/models/geo_node.rb
View file @
bddb3c14
...
...
@@ -55,14 +55,17 @@ class GeoNode < ApplicationRecord
encode:
true
class
<<
self
# Set in gitlab.rb as external_url
def
current_node_url
RequestStore
.
fetch
(
'geo_node:current_node_url'
)
do
cfg
=
Gitlab
.
config
.
gitlab
uri
=
URI
.
parse
(
"
#{
cfg
.
protocol
}
://
#{
cfg
.
host
}
:
#{
cfg
.
port
}#{
cfg
.
relative_url_root
}
"
)
uri
.
path
+=
'/'
unless
uri
.
path
.
end_with?
(
'/'
)
Gitlab
.
config
.
gitlab
.
url
end
end
uri
.
to_s
# Set in gitlab.rb as geo_node_name
def
current_node_name
RequestStore
.
fetch
(
'geo_node:current_node_name'
)
do
Gitlab
.
config
.
geo
.
node_name
end
end
...
...
ee/spec/tasks/geo_rake_spec.rb
View file @
bddb3c14
...
...
@@ -10,7 +10,7 @@ describe 'geo rake tasks', :geo do
describe
'set_primary_node task'
do
before
do
stub_config_setting
(
protocol:
'https
'
)
stub_config_setting
(
url:
'https://example.com:1234/relative_part
'
)
end
it
'creates a GeoNode'
do
...
...
@@ -23,6 +23,7 @@ describe 'geo rake tasks', :geo do
node
=
GeoNode
.
first
expect
(
node
.
uri
.
scheme
).
to
eq
(
'https'
)
expect
(
node
.
url
).
to
eq
(
'https://example.com:1234/relative_part/'
)
expect
(
node
.
primary
).
to
be_truthy
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment