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
09751c75
Commit
09751c75
authored
Apr 03, 2017
by
Ahmad Sherif
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for Gitaly calls over TCP connection
Closes gitaly#166
parent
2fceb437
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
3 deletions
+31
-3
config/gitlab.yml.example
config/gitlab.yml.example
+1
-1
config/initializers/8_gitaly.rb
config/initializers/8_gitaly.rb
+1
-1
lib/gitlab/gitaly_client.rb
lib/gitlab/gitaly_client.rb
+3
-1
spec/lib/gitlab/gitaly_client_spec.rb
spec/lib/gitlab/gitaly_client_spec.rb
+26
-0
No files found.
config/gitlab.yml.example
View file @
09751c75
...
@@ -461,7 +461,7 @@ production: &base
...
@@ -461,7 +461,7 @@ production: &base
storages: # You must have at least a `default` storage path.
storages: # You must have at least a `default` storage path.
default:
default:
path: /home/git/repositories/
path: /home/git/repositories/
gitaly_address: unix:/home/git/gitlab/tmp/sockets/private/gitaly.socket
gitaly_address: unix:/home/git/gitlab/tmp/sockets/private/gitaly.socket
# TCP connections are supported too (e.g. tcp://host:port)
## Backup settings
## Backup settings
backup:
backup:
...
...
config/initializers/8_gitaly.rb
View file @
09751c75
...
@@ -9,7 +9,7 @@ if Gitlab.config.gitaly.enabled || Rails.env.test?
...
@@ -9,7 +9,7 @@ if Gitlab.config.gitaly.enabled || Rails.env.test?
raise
"storage
#{
name
.
inspect
}
is missing a gitaly_address"
raise
"storage
#{
name
.
inspect
}
is missing a gitaly_address"
end
end
unless
URI
(
address
).
scheme
==
'unix'
unless
URI
(
address
).
scheme
.
in?
(
%w(tcp unix)
)
raise
"Unsupported Gitaly address:
#{
address
.
inspect
}
"
raise
"Unsupported Gitaly address:
#{
address
.
inspect
}
"
end
end
...
...
lib/gitlab/gitaly_client.rb
View file @
09751c75
...
@@ -12,9 +12,11 @@ module Gitlab
...
@@ -12,9 +12,11 @@ module Gitlab
end
end
def
self
.
new_channel
(
address
)
def
self
.
new_channel
(
address
)
# NOTE: Gitaly currently runs on a Unix socket, so permissions are
address
=
address
.
sub
(
%r{^tcp://}
,
''
)
if
URI
(
address
).
scheme
==
'tcp'
# NOTE: When Gitaly runs on a Unix socket, permissions are
# handled using the file system and no additional authentication is
# handled using the file system and no additional authentication is
# required (therefore the :this_channel_is_insecure flag)
# required (therefore the :this_channel_is_insecure flag)
# TODO: Add authentication support when Gitaly is running on a TCP socket.
GRPC
::
Core
::
Channel
.
new
(
address
,
{},
:this_channel_is_insecure
)
GRPC
::
Core
::
Channel
.
new
(
address
,
{},
:this_channel_is_insecure
)
end
end
...
...
spec/lib/gitlab/gitaly_client_spec.rb
0 → 100644
View file @
09751c75
require
'spec_helper'
describe
Gitlab
::
GitalyClient
,
lib:
true
do
describe
'.new_channel'
do
context
'when passed a UNIX socket address'
do
it
'passes the address as-is to GRPC::Core::Channel initializer'
do
address
=
'unix:/tmp/gitaly.sock'
expect
(
GRPC
::
Core
::
Channel
).
to
receive
(
:new
).
with
(
address
,
any_args
)
described_class
.
new_channel
(
address
)
end
end
context
'when passed a TCP address'
do
it
'strips tcp:// prefix before passing it to GRPC::Core::Channel initializer'
do
address
=
'localhost:9876'
prefixed_address
=
"tcp://
#{
address
}
"
expect
(
GRPC
::
Core
::
Channel
).
to
receive
(
:new
).
with
(
address
,
any_args
)
described_class
.
new_channel
(
prefixed_address
)
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