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
5c0d8d59
Commit
5c0d8d59
authored
Jul 07, 2017
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'gitaly-mandatory' into 'master'
Remove option to disable Gitaly in Rails See merge request !12677
parents
d40445e4
78089d11
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
45 additions
and
74 deletions
+45
-74
changelogs/unreleased/gitaly-mandatory.yml
changelogs/unreleased/gitaly-mandatory.yml
+4
-0
config/gitlab.yml.example
config/gitlab.yml.example
+0
-4
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+0
-1
config/initializers/8_gitaly.rb
config/initializers/8_gitaly.rb
+3
-5
doc/README.md
doc/README.md
+1
-0
doc/administration/gitaly/index.md
doc/administration/gitaly/index.md
+10
-31
doc/update/9.3-to-9.4.md
doc/update/9.3-to-9.4.md
+2
-0
lib/gitlab/gitaly_client.rb
lib/gitlab/gitaly_client.rb
+1
-5
lib/gitlab/workhorse.rb
lib/gitlab/workhorse.rb
+19
-21
spec/support/gitaly.rb
spec/support/gitaly.rb
+4
-6
spec/support/test_env.rb
spec/support/test_env.rb
+1
-1
No files found.
changelogs/unreleased/gitaly-mandatory.yml
0 → 100644
View file @
5c0d8d59
---
title
:
Remove option to disable Gitaly
merge_request
:
12677
author
:
config/gitlab.yml.example
View file @
5c0d8d59
...
@@ -450,10 +450,6 @@ production: &base
...
@@ -450,10 +450,6 @@ production: &base
# Gitaly settings
# Gitaly settings
gitaly:
gitaly:
# 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: true
# Default Gitaly authentication token. Can be overriden per storage. Can
# Default Gitaly authentication token. Can be overriden per storage. Can
# be left blank when Gitaly is running locally on a Unix socket, which
# be left blank when Gitaly is running locally on a Unix socket, which
# is the normal way to deploy Gitaly.
# is the normal way to deploy Gitaly.
...
...
config/initializers/1_settings.rb
View file @
5c0d8d59
...
@@ -483,7 +483,6 @@ Settings.rack_attack.git_basic_auth['bantime'] ||= 1.hour
...
@@ -483,7 +483,6 @@ Settings.rack_attack.git_basic_auth['bantime'] ||= 1.hour
# Gitaly
# Gitaly
#
#
Settings
[
'gitaly'
]
||=
Settingslogic
.
new
({})
Settings
[
'gitaly'
]
||=
Settingslogic
.
new
({})
Settings
.
gitaly
[
'enabled'
]
=
true
if
Settings
.
gitaly
[
'enabled'
].
nil?
#
#
# Webpack settings
# Webpack settings
...
...
config/initializers/8_gitaly.rb
View file @
5c0d8d59
require
'uri'
require
'uri'
if
Gitlab
.
config
.
gitaly
.
enabled
||
Rails
.
env
.
test?
Gitlab
.
config
.
repositories
.
storages
.
keys
.
each
do
|
storage
|
Gitlab
.
config
.
repositories
.
storages
.
keys
.
each
do
|
storage
|
# Force validation of each address
# Force validation of each address
Gitlab
::
GitalyClient
.
address
(
storage
)
Gitlab
::
GitalyClient
.
address
(
storage
)
end
end
end
doc/README.md
View file @
5c0d8d59
...
@@ -179,6 +179,7 @@ have access to GitLab administration tools and settings.
...
@@ -179,6 +179,7 @@ have access to GitLab administration tools and settings.
### Admin tools
### Admin tools
-
[
Gitaly
](
administration/gitaly/index.md
)
: Configuring Gitaly, GitLab's Git repository storage service
-
[
Raketasks
](
raketasks/README.md
)
: Backups, maintenance, automatic webhook setup and the importing of projects.
-
[
Raketasks
](
raketasks/README.md
)
: Backups, maintenance, automatic webhook setup and the importing of projects.
-
[
Backup and restore
](
raketasks/backup_restore.md
)
: Backup and restore your GitLab instance.
-
[
Backup and restore
](
raketasks/backup_restore.md
)
: Backup and restore your GitLab instance.
-
[
Reply by email
](
administration/reply_by_email.md
)
: Allow users to comment on issues and merge requests by replying to notification emails.
-
[
Reply by email
](
administration/reply_by_email.md
)
: Allow users to comment on issues and merge requests by replying to notification emails.
...
...
doc/administration/gitaly/index.md
View file @
5c0d8d59
...
@@ -2,8 +2,7 @@
...
@@ -2,8 +2,7 @@
[
Gitaly
](
https://gitlab.com/gitlab-org/gitaly
)
(
introduced
in GitLab
[
Gitaly
](
https://gitlab.com/gitlab-org/gitaly
)
(
introduced
in GitLab
9.
0) is a service that provides high-level RPC access to Git
9.
0) is a service that provides high-level RPC access to Git
repositories. As of GitLab 9.3 it is still an optional component with
repositories. Gitaly is a mandatory component in GitLab 9.4 and newer.
limited scope.
GitLab components that access Git repositories (gitlab-rails,
GitLab components that access Git repositories (gitlab-rails,
gitlab-shell, gitlab-workhorse) act as clients to Gitaly. End users do
gitlab-shell, gitlab-workhorse) act as clients to Gitaly. End users do
...
@@ -149,6 +148,8 @@ git_data_dirs({
...
@@ -149,6 +148,8 @@ git_data_dirs({
{
'default'
=>
{
'path'
=>
'/mnt/gitlab/default'
,
'gitaly_address'
=>
'tcp://gitlab.internal:9999'
}
},
{
'default'
=>
{
'path'
=>
'/mnt/gitlab/default'
,
'gitaly_address'
=>
'tcp://gitlab.internal:9999'
}
},
{
'storage1'
=>
{
'path'
=>
'/mnt/gitlab/storage1'
,
'gitaly_address'
=>
'tcp://gitlab.internal:9999'
}
},
{
'storage1'
=>
{
'path'
=>
'/mnt/gitlab/storage1'
,
'gitaly_address'
=>
'tcp://gitlab.internal:9999'
}
},
})
})
gitlab_rails
[
'gitaly_token'
]
=
'abc123secret'
```
```
Source installations:
Source installations:
...
@@ -164,6 +165,9 @@ gitlab:
...
@@ -164,6 +165,9 @@ gitlab:
storage1
:
storage1
:
path
:
/mnt/gitlab/storage1/repositories
path
:
/mnt/gitlab/storage1/repositories
gitaly_address
:
tcp://gitlab.internal:9999
gitaly_address
:
tcp://gitlab.internal:9999
gitaly
:
token
:
'
abc123secret'
```
```
Now reconfigure (Omnibus) or restart (source). When you tail the
Now reconfigure (Omnibus) or restart (source). When you tail the
...
@@ -172,36 +176,11 @@ Gitaly logs on your Gitaly server (`sudo gitlab-ctl tail gitaly` or
...
@@ -172,36 +176,11 @@ Gitaly logs on your Gitaly server (`sudo gitlab-ctl tail gitaly` or
coming in. One sure way to trigger a Gitaly request is to clone a
coming in. One sure way to trigger a Gitaly request is to clone a
repository from your GitLab server over HTTP.
repository from your GitLab server over HTTP.
## Configuring GitLab to not use Gitaly
Gitaly is still an optional component in GitLab 9.3. This means you
can choose to not use it.
In Omnibus you can make the following change in
`/etc/gitlab/gitlab.rb`
and reconfigure. This will both disable the
Gitaly service and configure the rest of GitLab not to use it.
```
ruby
gitaly
[
'enable'
]
=
false
```
In source installations, edit
`/home/git/gitlab/config/gitlab.yml`
and
make sure
`enabled`
in the
`gitaly`
section is set to 'false'. This
does not disable the Gitaly service in your init script; it only
prevents it from being used.
Apply the change with
`service gitlab restart`
.
```
yaml
gitaly
:
enabled
:
false
```
## Disabling or enabling the Gitaly service
## Disabling or enabling the Gitaly service
Be careful: if you disable Gitaly without instructing the rest of your
If you are running Gitaly
[
as a remote
GitLab installation not to use Gitaly, you may end up with errors
service
](
#running-gitaly-on-its-own-server
)
you may want to disable
because GitLab tries to access a service that is not running
.
the local Gitaly service that runs on your Gitlab server by default
.
To disable the Gitaly service in your Omnibus installation, add the
To disable the Gitaly service in your Omnibus installation, add the
following line to
`/etc/gitlab/gitlab.rb`
:
following line to
`/etc/gitlab/gitlab.rb`
:
...
@@ -220,4 +199,4 @@ following to `/etc/default/gitlab`:
...
@@ -220,4 +199,4 @@ following to `/etc/default/gitlab`:
gitaly_enabled
=
false
gitaly_enabled
=
false
```
```
When you run
`service gitlab restart`
Gitaly will be disabled.
When you run
`service gitlab restart`
Gitaly will be disabled.
\ No newline at end of file
doc/update/9.3-to-9.4.md
View file @
5c0d8d59
...
@@ -148,6 +148,8 @@ sudo -u git -H make
...
@@ -148,6 +148,8 @@ sudo -u git -H make
If you have not yet set up Gitaly then follow
[
Gitaly section of the installation
If you have not yet set up Gitaly then follow
[
Gitaly section of the installation
guide
](
../install/installation.md#install-gitaly
)
.
guide
](
../install/installation.md#install-gitaly
)
.
As of GitLab 9.4, Gitaly is a mandatory component of GitLab.
#### Check Gitaly configuration
#### Check Gitaly configuration
Due to a bug in the
`rake gitlab:gitaly:install`
script your Gitaly
Due to a bug in the
`rake gitlab:gitaly:install`
script your Gitaly
...
...
lib/gitlab/gitaly_client.rb
View file @
5c0d8d59
...
@@ -70,12 +70,8 @@ module Gitlab
...
@@ -70,12 +70,8 @@ module Gitlab
params
[
'gitaly_token'
].
presence
||
Gitlab
.
config
.
gitaly
[
'token'
]
params
[
'gitaly_token'
].
presence
||
Gitlab
.
config
.
gitaly
[
'token'
]
end
end
def
self
.
enabled?
Gitlab
.
config
.
gitaly
.
enabled
end
def
self
.
feature_enabled?
(
feature
,
status:
MigrationStatus
::
OPT_IN
)
def
self
.
feature_enabled?
(
feature
,
status:
MigrationStatus
::
OPT_IN
)
return
false
if
!
enabled?
||
status
==
MigrationStatus
::
DISABLED
return
false
if
status
==
MigrationStatus
::
DISABLED
feature
=
Feature
.
get
(
"gitaly_
#{
feature
}
"
)
feature
=
Feature
.
get
(
"gitaly_
#{
feature
}
"
)
...
...
lib/gitlab/workhorse.rb
View file @
5c0d8d59
...
@@ -25,27 +25,25 @@ module Gitlab
...
@@ -25,27 +25,25 @@ module Gitlab
RepoPath
:
repo_path
RepoPath
:
repo_path
}
}
if
Gitlab
.
config
.
gitaly
.
enabled
server
=
{
server
=
{
address:
Gitlab
::
GitalyClient
.
address
(
project
.
repository_storage
),
address:
Gitlab
::
GitalyClient
.
address
(
project
.
repository_storage
),
token:
Gitlab
::
GitalyClient
.
token
(
project
.
repository_storage
)
token:
Gitlab
::
GitalyClient
.
token
(
project
.
repository_storage
)
}
}
params
[
:Repository
]
=
repository
.
gitaly_repository
.
to_h
params
[
:Repository
]
=
repository
.
gitaly_repository
.
to_h
feature_enabled
=
case
action
.
to_s
feature_enabled
=
case
action
.
to_s
when
'git_receive_pack'
when
'git_receive_pack'
Gitlab
::
GitalyClient
.
feature_enabled?
(
:post_receive_pack
)
Gitlab
::
GitalyClient
.
feature_enabled?
(
:post_receive_pack
)
when
'git_upload_pack'
when
'git_upload_pack'
Gitlab
::
GitalyClient
.
feature_enabled?
(
:post_upload_pack
)
Gitlab
::
GitalyClient
.
feature_enabled?
(
:post_upload_pack
)
when
'info_refs'
when
'info_refs'
true
true
else
else
raise
"Unsupported action:
#{
action
}
"
raise
"Unsupported action:
#{
action
}
"
end
end
if
feature_enabled
if
feature_enabled
params
[
:GitalyAddress
]
=
server
[
:address
]
# This field will be deprecated
params
[
:GitalyAddress
]
=
server
[
:address
]
# This field will be deprecated
params
[
:GitalyServer
]
=
server
params
[
:GitalyServer
]
=
server
end
end
end
params
params
...
...
spec/support/gitaly.rb
View file @
5c0d8d59
if
Gitlab
::
GitalyClient
.
enabled?
RSpec
.
configure
do
|
config
|
RSpec
.
configure
do
|
config
|
config
.
before
(
:each
)
do
|
example
|
config
.
before
(
:each
)
do
|
example
|
next
if
example
.
metadata
[
:skip_gitaly_mock
]
next
if
example
.
metadata
[
:skip_gitaly_mock
]
allow
(
Gitlab
::
GitalyClient
).
to
receive
(
:feature_enabled?
).
and_return
(
true
)
allow
(
Gitlab
::
GitalyClient
).
to
receive
(
:feature_enabled?
).
and_return
(
true
)
end
end
end
end
end
spec/support/test_env.rb
View file @
5c0d8d59
...
@@ -69,7 +69,7 @@ module TestEnv
...
@@ -69,7 +69,7 @@ module TestEnv
# Setup GitLab shell for test instance
# Setup GitLab shell for test instance
setup_gitlab_shell
setup_gitlab_shell
setup_gitaly
if
Gitlab
::
GitalyClient
.
enabled?
setup_gitaly
# Create repository for FactoryGirl.create(:project)
# Create repository for FactoryGirl.create(:project)
setup_factory_repo
setup_factory_repo
...
...
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