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
eb030bea
Commit
eb030bea
authored
Feb 12, 2020
by
Michael Kozono
Committed by
Dmytro Zaporozhets
Feb 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geo: Fix GeoNode name in geo:update_primary_node_url rake task
parent
283edae7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
6 deletions
+54
-6
changelogs/unreleased/mk-fix-node-name-vs-url.yml
changelogs/unreleased/mk-fix-node-name-vs-url.yml
+5
-0
doc/administration/geo/disaster_recovery/index.md
doc/administration/geo/disaster_recovery/index.md
+19
-0
ee/lib/gitlab/geo/geo_tasks.rb
ee/lib/gitlab/geo/geo_tasks.rb
+1
-1
ee/spec/tasks/geo_rake_spec.rb
ee/spec/tasks/geo_rake_spec.rb
+29
-5
No files found.
changelogs/unreleased/mk-fix-node-name-vs-url.yml
0 → 100644
View file @
eb030bea
---
title
:
'
Geo:
Fix
GeoNode
name
in
geo:update_primary_node_url
rake
task'
merge_request
:
24649
author
:
type
:
fixed
doc/administration/geo/disaster_recovery/index.md
View file @
eb030bea
...
...
@@ -205,6 +205,25 @@ secondary domain, like changing Git remotes and API URLs.
This command will use the changed
`external_url`
configuration defined
in
`/etc/gitlab/gitlab.rb`
.
1.
For GitLab 11.11 through 12.7 only, you may need to update the primary
node's name in the database. This bug has been fixed in GitLab 12.8.
To determine if you need to do this, search for the
`gitlab_rails["geo_node_name"]`
setting in your
`/etc/gitlab/gitlab.rb`
file. If it is commented out with
`#`
or not found at all, then you will
need to update the primary node's name in the database. You can search for it
like so:
```
shell
grep
"geo_node_name"
/etc/gitlab/gitlab.rb
```
To update the primary node's name in the database:
```
shell
gitlab-rails runner
'Gitlab::Geo.primary_node.update!(name: GeoNode.current_node_name)'
```
1.
Verify you can connect to the newly promoted
**primary**
using its URL.
If you updated the DNS records for the primary domain, these changes may
not have yet propagated depending on the previous DNS records TTL.
...
...
ee/lib/gitlab/geo/geo_tasks.rb
View file @
eb030bea
...
...
@@ -27,7 +27,7 @@ module Gitlab
$stdout
.
puts
"Updating primary Geo node with URL
#{
node
.
url
}
..."
if
node
.
update
(
url:
GeoNode
.
current_node_url
)
if
node
.
update
(
name:
GeoNode
.
current_node_name
,
url:
GeoNode
.
current_node_url
)
$stdout
.
puts
"
#{
node
.
url
}
is now the primary Geo node URL"
.
color
(
:green
)
else
$stdout
.
puts
"Error saving Geo node:
\n
#{
node
.
errors
.
full_messages
.
join
(
"
\n
"
)
}
"
.
color
(
:red
)
...
...
ee/spec/tasks/geo_rake_spec.rb
View file @
eb030bea
...
...
@@ -283,17 +283,41 @@ describe 'geo rake tasks', :geo do
end
describe
'geo:update_primary_node_url'
do
let
(
:primary_node
)
{
create
(
:geo_node
,
:primary
,
url:
'https://secondary.geo.example.com'
)
}
before
do
allow
(
GeoNode
).
to
receive
(
:current_node_url
).
and_return
(
'https://primary.geo.example.com'
)
stub_current_geo_node
(
primary_node
)
end
it
'updates Geo primary node URL'
do
context
'when the machine Geo node name is not explicitly configured'
do
let
(
:primary_node
)
{
create
(
:geo_node
,
:primary
,
url:
'https://secondary.geo.example.com'
,
name:
'https://secondary.geo.example.com'
)
}
before
do
# As if Gitlab.config.geo.node_name is defaulting to external_url (this happens in an initializer)
allow
(
GeoNode
).
to
receive
(
:current_node_name
).
and_return
(
'https://primary.geo.example.com'
)
end
it
'updates Geo primary node URL and name'
do
run_rake_task
(
'geo:update_primary_node_url'
)
expect
(
primary_node
.
reload
.
url
).
to
eq
'https://primary.geo.example.com/'
expect
(
primary_node
.
name
).
to
eq
'https://primary.geo.example.com/'
end
end
context
'when the machine Geo node name is explicitly configured'
do
let
(
:node_name
)
{
'Brazil DC'
}
let
(
:primary_node
)
{
create
(
:geo_node
,
:primary
,
url:
'https://secondary.geo.example.com'
,
name:
node_name
)
}
before
do
allow
(
GeoNode
).
to
receive
(
:current_node_name
).
and_return
(
node_name
)
end
it
'updates Geo primary node URL only'
do
run_rake_task
(
'geo:update_primary_node_url'
)
expect
(
primary_node
.
reload
.
url
).
to
eq
'https://primary.geo.example.com/'
expect
(
primary_node
.
name
).
to
eq
node_name
end
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