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
b125c8df
Commit
b125c8df
authored
Feb 11, 2017
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check if Geo is enabled and if nodes can be reached through HTTP
parent
98b460df
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
1 deletion
+77
-1
lib/tasks/gitlab/check.rake
lib/tasks/gitlab/check.rake
+77
-1
No files found.
lib/tasks/gitlab/check.rake
View file @
b125c8df
...
@@ -855,7 +855,9 @@ namespace :gitlab do
...
@@ -855,7 +855,9 @@ namespace :gitlab do
warn_user_is_not_gitlab
warn_user_is_not_gitlab
start_checking
'Geo'
start_checking
'Geo'
check_geo_license
check_geo_enabled
check_geo_enabled
check_nodes_http_connection
finished_checking
'Geo'
finished_checking
'Geo'
end
end
...
@@ -863,7 +865,7 @@ namespace :gitlab do
...
@@ -863,7 +865,7 @@ namespace :gitlab do
# Checks
# Checks
########################
########################
def
check_geo_
enabled
def
check_geo_
license
print
'GitLab Geo is available ... '
print
'GitLab Geo is available ... '
if
Gitlab
::
Geo
.
license_allows?
if
Gitlab
::
Geo
.
license_allows?
puts
'yes'
.
color
(
:green
)
puts
'yes'
.
color
(
:green
)
...
@@ -877,6 +879,37 @@ namespace :gitlab do
...
@@ -877,6 +879,37 @@ namespace :gitlab do
for_more_information
(
see_geo_features_page
)
for_more_information
(
see_geo_features_page
)
end
end
end
end
def
check_geo_enabled
print
'GitLab Geo is enabled ... '
if
Gitlab
::
Geo
.
enabled?
puts
'yes'
.
color
(
:green
)
else
puts
'no'
.
color
(
:red
)
try_fixing_it
(
'Follow Geo Setup instructions to configure primary and secondary nodes'
)
for_more_information
(
see_geo_docs
)
end
end
def
check_nodes_http_connection
return
unless
Gitlab
::
Geo
.
enabled?
if
Gitlab
::
Geo
.
primary?
Gitlab
::
Geo
.
secondary_nodes
.
each
do
|
node
|
print
"Can connect to secondary node: '
#{
node
.
url
}
' ... "
check_gitlab_geo_node
(
node
)
end
end
if
Gitlab
::
Geo
.
secondary?
print
'Can connect to the primary node ... '
check_gitlab_geo_node
(
Gitlab
::
Geo
.
primary_node
)
end
end
end
end
# Helper methods
# Helper methods
...
@@ -913,6 +946,10 @@ namespace :gitlab do
...
@@ -913,6 +946,10 @@ namespace :gitlab do
'https://about.gitlab.com/features/gitlab-geo/'
'https://about.gitlab.com/features/gitlab-geo/'
end
end
def
see_geo_docs
'doc/gitlab-geo/README.md'
end
def
sudo_gitlab
(
command
)
def
sudo_gitlab
(
command
)
"sudo -u
#{
gitlab_user
}
-H
#{
command
}
"
"sudo -u
#{
gitlab_user
}
-H
#{
command
}
"
end
end
...
@@ -1059,4 +1096,43 @@ namespace :gitlab do
...
@@ -1059,4 +1096,43 @@ namespace :gitlab do
puts
"no"
.
color
(
:red
)
puts
"no"
.
color
(
:red
)
end
end
end
end
def
check_gitlab_geo_node
(
node
)
begin
response
=
Net
::
HTTP
.
start
(
node
.
uri
.
host
,
node
.
uri
.
port
)
do
|
http
|
http
.
request
(
Net
::
HTTP
::
Get
.
new
(
node
.
uri
))
end
if
response
.
code_type
==
Net
::
HTTPFound
puts
'yes'
.
color
(
:green
)
else
puts
'no'
.
color
(
:red
)
end
rescue
Errno
::
ECONNREFUSED
=>
e
puts
'no'
.
color
(
:red
)
puts
' Reason:'
.
color
(
:blue
)
puts
"
#{
e
.
message
}
"
try_fixing_it
(
'Check if the machine is online and GitLab is running'
,
'Check your firewall rules and make sure this machine can reach target machine'
,
"Make sure port and protocol are correct: '
#{
node
.
url
}
', or change it in Admin > Geo Nodes"
)
rescue
SocketError
=>
e
puts
'no'
.
color
(
:red
)
puts
' Reason:'
.
color
(
:blue
)
puts
"
#{
e
.
message
}
"
if
e
.
cause
&&
e
.
cause
.
message
.
starts_with?
(
'getaddrinfo'
)
try_fixing_it
(
'Check if your machine can connect to a DSN server'
,
"Check if your machine can resolve DNS for: '
#{
node
.
uri
.
host
}
'"
,
'If machine host is incorrect, change it in Admin > Geo Nodes'
)
end
rescue
Exception
=>
e
puts
'no'
.
color
(
:red
)
puts
' Reason:'
.
color
(
:blue
)
puts
"
#{
e
.
message
}
"
end
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