Merge branch 'data-dirs-config' into 'master'
Update configuration to allow multiple settings per data directory See merge request !1363
This commit is contained in:
commit
ee831d9d53
|
@ -9,6 +9,7 @@ omnibus-gitlab repository.
|
|||
- Fix the issue that prevents registry from starting when user and group
|
||||
are not the same (O Schwede) 62b5cc
|
||||
- Setup RSA private key for OpenID Connect
|
||||
- Update directory configuration structure to allow multiple settings per data directory
|
||||
|
||||
8.17.3
|
||||
- Changing call to create tmp dir as the database user 7b54cd76
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# Configuration options
|
||||
|
||||
GitLab is configured by setting the relevant options in
|
||||
`/etc/gitlab/gitlab.rb`. See [package defaults](../package-information/defaults.md)
|
||||
`/etc/gitlab/gitlab.rb`. See [package defaults](../package-information/defaults.md)
|
||||
for a list of default settings and visit the
|
||||
[gitlab.rb.template](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-config-template/gitlab.rb.template)
|
||||
for a complete list of available options.
|
||||
New installations starting from GitLab 7.6, will have
|
||||
all the options of the template as of installation listed in
|
||||
all the options of the template as of installation listed in
|
||||
`/etc/gitlab/gitlab.rb` by default.
|
||||
|
||||
## Configuring the external URL for GitLab
|
||||
|
@ -147,7 +147,7 @@ the `git-data` parent directory by adding the following line to
|
|||
`/etc/gitlab/gitlab.rb`.
|
||||
|
||||
```ruby
|
||||
git_data_dirs({"default" => "/mnt/nas/git-data"})
|
||||
git_data_dirs({ "default" => { "path" => "/mnt/nas/git-data" } })
|
||||
```
|
||||
|
||||
Starting from GitLab 8.10 you can also add more than one git data directory by
|
||||
|
@ -155,8 +155,8 @@ adding the following lines to `/etc/gitlab/gitlab.rb` instead.
|
|||
|
||||
```ruby
|
||||
git_data_dirs({
|
||||
"default" => "/var/opt/gitlab/git-data",
|
||||
"alternative" => "/mnt/nas/git-data"
|
||||
"default" => { "path" => "/var/opt/gitlab/git-data" },
|
||||
"alternative" => { "path" => "/mnt/nas/git-data" }
|
||||
})
|
||||
```
|
||||
|
||||
|
|
|
@ -440,7 +440,7 @@ sudo tee -a /etc/gitlab/gitlab.rb <<'EOF'
|
|||
external_url 'http://gitlab.example.com'
|
||||
|
||||
# We assume your repositories are in /home/git/repositories (default for source installs)
|
||||
git_data_dirs({ 'default' => '/home/git' })
|
||||
git_data_dirs({ 'default' => { 'path' => '/home/git' } })
|
||||
|
||||
# Re-use the Postgres that is already running on your system
|
||||
postgresql['enable'] = false
|
||||
|
|
|
@ -254,7 +254,7 @@ external_url 'GENERATED_EXTERNAL_URL'
|
|||
###! Docs: https://docs.gitlab.com/omnibus/settings/configuration.html#storing-git-data-in-an-alternative-directory
|
||||
###! **If you want to use a single non-default directory to store git data use a
|
||||
###! path that doesn't contain symlinks.**
|
||||
# git_data_dirs({"default" => "/var/opt/gitlab/git-data"})
|
||||
# git_data_dirs({ "default" => { "path" => "/var/opt/gitlab/git-data" } })
|
||||
|
||||
### For storing GitLab application uploads, eg. LFS objects, build artifacts
|
||||
###! Docs: https://docs.gitlab.com/ce/development/shared_files.html
|
||||
|
|
|
@ -322,10 +322,10 @@ default['gitlab']['gitlab-shell']['log_directory'] = "/var/log/gitlab/gitlab-she
|
|||
default['gitlab']['gitlab-shell']['log_level'] = nil
|
||||
default['gitlab']['gitlab-shell']['audit_usernames'] = nil
|
||||
default['gitlab']['gitlab-shell']['git_data_directories'] = {
|
||||
"default" => "/var/opt/gitlab/git-data"
|
||||
"default" => { "path" => "/var/opt/gitlab/git-data" }
|
||||
}
|
||||
default['gitlab']['gitlab-rails']['repositories_storages'] = {
|
||||
"default" => "/var/opt/gitlab/git-data/repositories"
|
||||
"default" => { "path" => "/var/opt/gitlab/git-data/repositories" }
|
||||
}
|
||||
default['gitlab']['gitlab-shell']['http_settings'] = nil
|
||||
default['gitlab']['gitlab-shell']['git_annex_enabled'] = nil
|
||||
|
|
|
@ -29,20 +29,27 @@ module GitlabShell
|
|||
|
||||
Gitlab['gitlab_shell']['git_data_directories'] ||=
|
||||
if git_data_dirs.any?
|
||||
git_data_dirs
|
||||
Hash[git_data_dirs.map do |name, data_directory|
|
||||
if data_directory.is_a?(String)
|
||||
Chef::Log.warn "Your git_data_dirs settings are deprecated. Please refer to https://docs.gitlab.com/omnibus/settings/configuration.html#storing-git-data-in-an-alternative-directory for updated documentation."
|
||||
[name, { 'path' => data_directory }]
|
||||
else
|
||||
[name, data_directory]
|
||||
end
|
||||
end]
|
||||
else
|
||||
{ 'default' => git_data_dir }
|
||||
{ 'default' => { 'path' => git_data_dir } }
|
||||
end
|
||||
|
||||
Gitlab['gitlab_rails']['repositories_storages'] ||=
|
||||
Hash[Gitlab['gitlab_shell']['git_data_directories'].map do |name, path|
|
||||
[name, File.join(path, 'repositories')]
|
||||
Hash[Gitlab['gitlab_shell']['git_data_directories'].map do |name, data_directory|
|
||||
[name, { 'path' => File.join(data_directory['path'], 'repositories') }]
|
||||
end]
|
||||
|
||||
# Important: keep the satellites.path setting until GitLab 9.0 at
|
||||
# least. This setting is fed to 'rm -rf' in
|
||||
# db/migrate/20151023144219_remove_satellites.rb
|
||||
Gitlab['gitlab_rails']['satellites_path'] ||= File.join(Gitlab['gitlab_shell']['git_data_directories']['default'], "gitlab-satellites")
|
||||
Gitlab['gitlab_rails']['satellites_path'] ||= File.join(Gitlab['gitlab_shell']['git_data_directories']['default']['path'], "gitlab-satellites")
|
||||
end
|
||||
|
||||
def parse_auth_file
|
||||
|
|
|
@ -30,14 +30,14 @@ hooks_directory = node['gitlab']['gitlab-rails']['gitlab_shell_hooks_path']
|
|||
gitlab_shell_keys_check = File.join(gitlab_shell_dir, 'bin/gitlab-keys')
|
||||
|
||||
git_data_directories.each do |_name, git_data_directory|
|
||||
storage_directory git_data_directory do
|
||||
storage_directory git_data_directory['path'] do
|
||||
owner git_user
|
||||
mode "0700"
|
||||
end
|
||||
end
|
||||
|
||||
repositories_storages.each do |_name, repositories_storage|
|
||||
storage_directory repositories_storage do
|
||||
storage_directory repositories_storage['path'] do
|
||||
owner git_user
|
||||
mode "2770"
|
||||
end
|
||||
|
|
|
@ -438,7 +438,7 @@ test:
|
|||
path: tmp/tests/gitlab-satellites/
|
||||
repositories:
|
||||
storages:
|
||||
default: tmp/tests/repositories/
|
||||
default: { "path": "tmp/tests/repositories/" }
|
||||
gitlab_shell:
|
||||
path: tmp/tests/gitlab-shell/
|
||||
hooks_path: tmp/tests/gitlab-shell/hooks/
|
||||
|
|
|
@ -231,33 +231,64 @@ describe 'gitlab_shell::git_data_dir' do
|
|||
|
||||
it 'correctly sets the shell git data directories' do
|
||||
expect(chef_run.node['gitlab']['gitlab-shell']['git_data_directories'])
|
||||
.to eql('default' => '/tmp/user/git-data')
|
||||
.to eql('default' => { 'path' => '/tmp/user/git-data' })
|
||||
end
|
||||
|
||||
it 'correctly sets the repository storage directories' do
|
||||
expect(chef_run.node['gitlab']['gitlab-rails']['repositories_storages'])
|
||||
.to eql('default' => '/tmp/user/git-data/repositories')
|
||||
.to eql('default' => { 'path' => '/tmp/user/git-data/repositories' })
|
||||
end
|
||||
end
|
||||
|
||||
context 'when git_data_dirs is set to multiple directories' do
|
||||
before do
|
||||
stub_gitlab_rb({
|
||||
git_data_dirs: { 'default' => '/tmp/default/git-data', 'overflow' => '/tmp/other/git-overflow-data' }
|
||||
git_data_dirs: {
|
||||
'default' => { 'path' => '/tmp/default/git-data' },
|
||||
'overflow' => { 'path' => '/tmp/other/git-overflow-data' }
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
it 'correctly sets the shell git data directories' do
|
||||
expect(chef_run.node['gitlab']['gitlab-shell']['git_data_directories']).to eql({
|
||||
'default' => '/tmp/default/git-data',
|
||||
'overflow' => '/tmp/other/git-overflow-data'
|
||||
'default' => { 'path' => '/tmp/default/git-data' },
|
||||
'overflow' => { 'path' => '/tmp/other/git-overflow-data' }
|
||||
})
|
||||
end
|
||||
|
||||
it 'correctly sets the repository storage directories' do
|
||||
expect(chef_run.node['gitlab']['gitlab-rails']['repositories_storages']).to eql({
|
||||
'default' => '/tmp/default/git-data/repositories',
|
||||
'overflow' => '/tmp/other/git-overflow-data/repositories'
|
||||
'default' => { 'path' => '/tmp/default/git-data/repositories' },
|
||||
'overflow' => { 'path' => '/tmp/other/git-overflow-data/repositories' }
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
context 'when git_data_dirs is set with deprecated settings structure' do
|
||||
before do
|
||||
stub_gitlab_rb({
|
||||
git_data_dirs: {
|
||||
'default' => '/tmp/default/git-data',
|
||||
'overflow' => '/tmp/other/git-overflow-data'
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
it 'correctly sets the shell git data directories' do
|
||||
# Allow warn to be called for other messages without failing the test
|
||||
allow(Chef::Log).to receive(:warn)
|
||||
expect(Chef::Log).to receive(:warn).with("Your git_data_dirs settings are deprecated. Please refer to https://docs.gitlab.com/omnibus/settings/configuration.html#storing-git-data-in-an-alternative-directory for updated documentation.")
|
||||
expect(chef_run.node['gitlab']['gitlab-shell']['git_data_directories']).to eql({
|
||||
'default' => { 'path' => '/tmp/default/git-data' },
|
||||
'overflow' => { 'path' => '/tmp/other/git-overflow-data' }
|
||||
})
|
||||
end
|
||||
|
||||
it 'correctly sets the repository storage directories' do
|
||||
expect(chef_run.node['gitlab']['gitlab-rails']['repositories_storages']).to eql({
|
||||
'default' => { 'path' => '/tmp/default/git-data/repositories' },
|
||||
'overflow' => { 'path' => '/tmp/other/git-overflow-data/repositories' }
|
||||
})
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue