summaryrefslogtreecommitdiff
path: root/lib/gitaly
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2018-01-30 11:11:47 +0100
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2018-01-31 08:54:45 +0100
commit94a3dbca33634dd4f6a1de8b14cd2a4f0a9a0abc (patch)
tree6a21432626eb9b37b748cb8a94403ea771025f22 /lib/gitaly
parente74e6fcb5eecb7841a412cb0d3e9627556d83eaf (diff)
downloadgitlab-ce-94a3dbca33634dd4f6a1de8b14cd2a4f0a9a0abc.tar.gz
Gitaly Server info for admin panel
Implements the client side for gitlab-org/gitaly#819. Which is a server info command. This checks the server version and git binairy version on the server. A small UI was added for administrators, so they can check the status of the Gitaly server. This is done for each storage the monolith knows. Because of this commit, gitlab-org/gitlab-ce!15580 is now closed. That MR removed the Git version too, but didn't replace it with anything.
Diffstat (limited to 'lib/gitaly')
-rw-r--r--lib/gitaly/server.rb43
1 files changed, 43 insertions, 0 deletions
diff --git a/lib/gitaly/server.rb b/lib/gitaly/server.rb
new file mode 100644
index 00000000000..605e93022e7
--- /dev/null
+++ b/lib/gitaly/server.rb
@@ -0,0 +1,43 @@
+module Gitaly
+ class Server
+ def self.all
+ Gitlab.config.repositories.storages.keys.map { |s| Gitaly::Server.new(s) }
+ end
+
+ attr_reader :storage
+
+ def initialize(storage)
+ @storage = storage
+ end
+
+ def server_version
+ info.server_version
+ end
+
+ def git_binary_version
+ info.git_version
+ end
+
+ def up_to_date?
+ server_version == Gitlab::GitalyClient.expected_server_version
+ end
+
+ def address
+ Gitlab::GitalyClient.address(@storage)
+ rescue RuntimeError => e
+ "Error getting the address: #{e.message}"
+ end
+
+ private
+
+ def info
+ @info ||=
+ begin
+ Gitlab::GitalyClient::ServerService.new(@storage).info
+ rescue GRPC::Unavailable, GRPC::GRPC::DeadlineExceeded
+ # This will show the server as being out of date
+ Gitaly::ServerInfoResponse.new(git_version: '', server_version: '')
+ end
+ end
+ end
+end