Commit 56bea218 authored by James Fargher's avatar James Fargher

Remove broken "default" storage initialiser

This initialiser was trying to setup the "default" storage if it didn't
exist in the config file but since the settingslogic tries to validate
that back to gitlab.yml it finds the setting doesn't exist and blows up.

Since this code doesn't actually work and since this is one part of the
reason why users cannot run gitlab without a "default" storage we should
remove it.

Changelog: fixed
parent c1b0422c
...@@ -760,13 +760,6 @@ Settings.gitlab_kas['internal_url'] ||= 'grpc://localhost:8153' ...@@ -760,13 +760,6 @@ Settings.gitlab_kas['internal_url'] ||= 'grpc://localhost:8153'
# #
Settings['repositories'] ||= Settingslogic.new({}) Settings['repositories'] ||= Settingslogic.new({})
Settings.repositories['storages'] ||= {} Settings.repositories['storages'] ||= {}
unless Settings.repositories.storages['default']
Settings.repositories.storages['default'] ||= {}
# We set the path only if the default storage doesn't exist, in case it exists
# but follows the pre-9.0 configuration structure. `6_validations.rb` initializer
# will validate all storages and throw a relevant error to the user if necessary.
Settings.repositories.storages['default']['path'] ||= Settings.gitlab['user_home'] + '/repositories/'
end
Settings.repositories.storages.each do |key, storage| Settings.repositories.storages.each do |key, storage|
Settings.repositories.storages[key] = Gitlab::GitalyClient::StorageSettings.new(storage) Settings.repositories.storages[key] = Gitlab::GitalyClient::StorageSettings.new(storage)
......
...@@ -120,17 +120,23 @@ For compatibility reasons `gitlab.yml` has a different structure than Omnibus Gi ...@@ -120,17 +120,23 @@ For compatibility reasons `gitlab.yml` has a different structure than Omnibus Gi
1. [Restart GitLab](restart_gitlab.md#installations-from-source) for the changes to take effect. 1. [Restart GitLab](restart_gitlab.md#installations-from-source) for the changes to take effect.
1. [Configure where new repositories are stored](#configure-where-new-repositories-are-stored).
**For Omnibus installations** **For Omnibus installations**
Edit `/etc/gitlab/gitlab.rb` by appending the rest of the paths to the default one: 1. Edit `/etc/gitlab/gitlab.rb` by appending the rest of the paths to the default one:
```ruby
git_data_dirs({
"default" => { "path" => "/var/opt/gitlab/git-data" },
"storage1" => { "path" => "/mnt/storage1/git-data" },
"storage2" => { "path" => "/mnt/storage2/git-data" }
})
```
1. [Restart GitLab](restart_gitlab.md#omnibus-gitlab-reconfigure) for the changes to take effect.
```ruby 1. [Configure where new repositories are stored](#configure-where-new-repositories-are-stored).
git_data_dirs({
"default" => { "path" => "/var/opt/gitlab/git-data" },
"storage1" => { "path" => "/mnt/storage1/git-data" },
"storage2" => { "path" => "/mnt/storage2/git-data" }
})
```
NOTE: NOTE:
Omnibus stores the repositories in a `repositories` subdirectory of the `git-data` directory. Omnibus stores the repositories in a `repositories` subdirectory of the `git-data` directory.
...@@ -153,6 +159,17 @@ The higher the weight of a given repository storage path relative to other repos ...@@ -153,6 +159,17 @@ The higher the weight of a given repository storage path relative to other repos
paths, the more often it is chosen. That is, paths, the more often it is chosen. That is,
`(storage weight) / (sum of all weights) * 100 = chance %`. `(storage weight) / (sum of all weights) * 100 = chance %`.
By default, if repository weights have not been configured earlier:
- `default` is weighted `100`.
- All other storages are weighted `0`.
NOTE:
If all storage weights are `0` (for example, when `default` does not exist), GitLab attempts to
create new repositories on `default`, regardless of the configuration or if `default` exists.
See [the tracking issue](https://gitlab.com/gitlab-org/gitlab/-/issues/36175) for more information.
information.
## Move repositories ## Move repositories
To move a repository to a different repository storage (for example, from `default` to `storage2`), use the To move a repository to a different repository storage (for example, from `default` to `storage2`), use the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment