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
1904c80f
Commit
1904c80f
authored
Mar 24, 2017
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change socket_path to gitaly_address
parent
eee07f1c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
31 deletions
+48
-31
config/gitlab.yml.example
config/gitlab.yml.example
+8
-8
config/initializers/8_gitaly.rb
config/initializers/8_gitaly.rb
+17
-3
doc/install/installation.md
doc/install/installation.md
+2
-2
lib/gitlab/gitaly_client.rb
lib/gitlab/gitaly_client.rb
+11
-5
lib/gitlab/workhorse.rb
lib/gitlab/workhorse.rb
+5
-4
spec/lib/gitlab/workhorse_spec.rb
spec/lib/gitlab/workhorse_spec.rb
+4
-8
spec/requests/api/internal_spec.rb
spec/requests/api/internal_spec.rb
+1
-1
No files found.
config/gitlab.yml.example
View file @
1904c80f
...
...
@@ -443,14 +443,10 @@ production: &base
# Gitaly settings
gitaly:
# The socket_path setting is optional and obsolete. When this is set
# GitLab assumes it can reach a Gitaly services via a Unix socket at
# this path. When this is commented out GitLab will not use Gitaly.
#
# This setting is obsolete because we expect it to be moved under
# repositories/storages in GitLab 9.1.
#
# socket_path: tmp/sockets/private/gitaly.socket
# This setting controls whether GitLab uses Gitaly (new component
# introduced in 9.0). Eventually Gitaly use will become mandatory and
# this option will disappear.
enabled: false
#
# 4. Advanced settings
...
...
@@ -465,6 +461,7 @@ production: &base
storages: # You must have at least a `default` storage path.
default:
path: /home/git/repositories/
gitaly_address: unix:/home/git/gitlab/tmp/sockets/private/gitaly.socket
## Backup settings
backup:
...
...
@@ -577,6 +574,9 @@ test:
storages:
default:
path: tmp/tests/repositories/
gitaly_address: unix:<%= Rails.root.join('tmp/sockets/private/gitaly.socket') %>
gitaly:
enabled: false
backup:
path: tmp/tests/backups
gitlab_shell:
...
...
config/initializers/8_gitaly.rb
View file @
1904c80f
# Make sure we initialize a Gitaly channel before Sidekiq starts multi-threaded execution.
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
params
|
Gitlab
::
GitalyClient
.
configure_channel
(
name
,
params
[
'socket_path'
])
require
'uri'
# Make sure we initialize our Gitaly channels before Sidekiq starts multi-threaded execution.
if
Gitlab
.
config
.
gitaly
.
enabled
||
Rails
.
env
.
test?
Gitlab
.
config
.
repositories
.
storages
.
each
do
|
name
,
params
|
address
=
params
[
'gitaly_address'
]
unless
address
.
present?
raise
"storage
#{
name
.
inspect
}
is missing a gitaly_address"
end
unless
URI
(
address
).
scheme
==
'unix'
raise
"Unsupported Gitaly address:
#{
address
.
inspect
}
"
end
Gitlab
::
GitalyClient
.
configure_channel
(
name
,
address
)
end
end
doc/install/installation.md
View file @
1904c80f
...
...
@@ -477,12 +477,12 @@ with setting up Gitaly until you upgrade to GitLab 9.1 or later.
# Enable Gitaly in the init script
echo 'gitaly_enabled=true' | sudo tee -a /etc/default/gitlab
Next, edit
`/home/git/gitlab/config/gitlab.yml`
and make sure
`
socket_path
`
in
Next, edit
`/home/git/gitlab/config/gitlab.yml`
and make sure
`
enabled: true
`
in
the
`gitaly:`
section is uncommented.
# <- gitlab.yml indentation starts here
gitaly:
socket_path: tmp/sockets/private/gitaly.socket
enabled: true
For more information about configuring Gitaly see
[
doc/administration/gitaly
](
../administration/gitaly
)
.
...
...
lib/gitlab/gitaly_client.rb
View file @
1904c80f
...
...
@@ -4,9 +4,11 @@ module Gitlab
module
GitalyClient
SERVER_VERSION_FILE
=
'GITALY_SERVER_VERSION'
.
freeze
def
self
.
configure_channel
(
shard
,
socket_path
)
@channel
||=
{}
@channel
[
shard
]
=
new_channel
(
"unix://
#{
socket_path
}
"
)
def
self
.
configure_channel
(
storage
,
address
)
@addresses
||=
{}
@addresses
[
storage
]
=
address
@channels
||=
{}
@channels
[
storage
]
=
new_channel
(
address
)
end
def
self
.
new_channel
(
address
)
...
...
@@ -16,8 +18,12 @@ module Gitlab
GRPC
::
Core
::
Channel
.
new
(
address
,
{},
:this_channel_is_insecure
)
end
def
self
.
get_channel
(
shard
)
@channel
.
fetch
(
shard
)
def
self
.
get_channel
(
storage
)
@channels
[
storage
]
end
def
self
.
get_address
(
storage
)
@addresses
[
storage
]
end
def
self
.
enabled?
...
...
lib/gitlab/workhorse.rb
View file @
1904c80f
require
'base64'
require
'json'
require
'securerandom'
require
'uri'
module
Gitlab
class
Workhorse
...
...
@@ -21,10 +22,10 @@ module Gitlab
RepoPath
:
repository
.
path_to_repo
,
}
params
.
merge!
(
GitalySocketPath
:
Gitlab
.
config
.
gitaly
.
socket_path
,
GitalyResourcePath
:
"/projects/
#{
repository
.
project
.
id
}
/git-http/info-refs"
,
)
if
Gitlab
.
config
.
gitaly
.
socket_path
.
present?
if
Gitlab
.
config
.
gitaly
.
enabled
address
=
Gitlab
::
GitalyClient
.
get_address
(
repository
.
project
.
repository_storage
)
params
[
:GitalySocketPath
]
=
URI
(
address
).
path
end
params
end
...
...
spec/lib/gitlab/workhorse_spec.rb
View file @
1904c80f
...
...
@@ -184,18 +184,14 @@ describe Gitlab::Workhorse, lib: true do
it
{
expect
(
subject
).
to
eq
({
GL_ID
:
"user-
#{
user
.
id
}
"
,
RepoPath
:
repository
.
path_to_repo
})
}
context
'when Gitaly socket path is present'
do
let
(
:gitaly_socket_path
)
{
'/tmp/gitaly.sock'
}
context
'when Gitaly is enabled'
do
before
do
allow
(
Gitlab
.
config
.
gitaly
).
to
receive
(
:
socket_path
).
and_return
(
gitaly_socket_path
)
allow
(
Gitlab
.
config
.
gitaly
).
to
receive
(
:
enabled
).
and_return
(
true
)
end
it
'includes Gitaly params in the returned value'
do
expect
(
subject
).
to
include
({
GitalyResourcePath
:
"/projects/
#{
repository
.
project
.
id
}
/git-http/info-refs"
,
GitalySocketPath
:
gitaly_socket_path
,
})
gitaly_socket_path
=
URI
(
Gitlab
::
GitalyClient
.
get_address
(
'default'
)).
path
expect
(
subject
).
to
include
({
GitalySocketPath
:
gitaly_socket_path
})
end
end
end
...
...
spec/requests/api/internal_spec.rb
View file @
1904c80f
...
...
@@ -424,7 +424,7 @@ describe API::Internal, api: true do
end
before
do
allow
(
Gitlab
.
config
.
gitaly
).
to
receive
(
:
socket_path
).
and_return
(
'path/to/gitaly.socket'
)
allow
(
Gitlab
.
config
.
gitaly
).
to
receive
(
:
enabled
).
and_return
(
true
)
end
it
"calls the Gitaly client if it's enabled"
do
...
...
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