Commit 5e077b0f authored by Nick Thomas's avatar Nick Thomas

Merge remote-tracking branch 'upstream/master' into ce-to-ee

parents 362aad89 b2884238
......@@ -7,7 +7,7 @@ module Projects
end
def execute(new_repository_storage_key)
new_storage_path = Gitlab.config.repositories.storages[new_repository_storage_key]
new_storage_path = Gitlab.config.repositories.storages[new_repository_storage_key]['path']
result = move_storage(project.path_with_namespace, new_storage_path)
if project.wiki.repository_exists?
......
......@@ -20,20 +20,32 @@ def validate_storages_config
storage_validation_error("\"#{name}\" is not a valid storage name") unless storage_name_valid?(name)
if repository_storage.is_a?(String)
<<<<<<< HEAD
raise "#{name} is not a valid storage, because it has no `path` key. " \
"It may be configured as:\n\n#{name}:\n path: #{repository_storage}\n\n" \
"For source installations, update your config/gitlab.yml Refer to gitlab.yml.example for an updated example.\n\n" \
"If you're using the Gitlab Development Kit, you can update your configuration running `gdk reconfigure`.\n"
=======
error = "#{name} is not a valid storage, because it has no `path` key. " \
"It may be configured as:\n\n#{name}:\n path: #{repository_storage}\n\n" \
"Refer to gitlab.yml.example for an updated example"
storage_validation_error(error)
>>>>>>> upstream/master
end
if !repository_storage.is_a?(Hash) || repository_storage['path'].nil?
storage_validation_error("#{name} is not a valid storage, because it has no `path` key. Refer to gitlab.yml.example for an updated example")
end
<<<<<<< HEAD
end
end
def validate_storages_paths
Gitlab.config.repositories.storages.each do |name, repository_storage|
=======
>>>>>>> upstream/master
parent_name, _parent_path = find_parent_path(name, repository_storage['path'])
if parent_name
storage_validation_error("#{name} is a nested path of #{parent_name}. Nested paths are not supported for repository storages")
......
......@@ -50,6 +50,7 @@ Update your current configuration as follows, replacing with your storages names
})
```
<<<<<<< HEAD
#### Git configuration
Configure Git to generate packfile bitmaps (introduced in Git 2.0) on
......@@ -61,6 +62,8 @@ cd /home/git/gitlab
sudo -u git -H git config --global repack.writeBitmaps true
```
=======
>>>>>>> upstream/master
#### Nginx configuration
Ensure you're still up-to-date with the latest NGINX configuration changes:
......
# From Community Edition 9.0 to Enterprise Edition 9.0
This guide assumes you have a correctly configured and tested installation of
GitLab Community Edition 9.0. If you run into any trouble or if you have any
questions please contact us at [support@gitlab.com].
### 0. Backup
Make a backup just in case something goes wrong:
```bash
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
```
For installations using MySQL, this may require granting "LOCK TABLES"
privileges to the GitLab user on the database version.
### 1. Stop server
```bash
sudo service gitlab stop
```
### 2. Get the EE code
```bash
cd /home/git/gitlab
sudo -u git -H git remote add -f ee https://gitlab.com/gitlab-org/gitlab-ee.git
sudo -u git -H git checkout 9-0-stable-ee
```
### 3. Install libs, migrations, etc.
```bash
cd /home/git/gitlab
# MySQL installations (note: the line below states '--without postgres')
sudo -u git -H bundle install --without postgres development test --deployment
# PostgreSQL installations (note: the line below states '--without mysql')
sudo -u git -H bundle install --without mysql development test --deployment
# Run database migrations
sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
# Clean up assets and cache
sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS_ENV=production
```
### 4. Start application
```bash
sudo service gitlab start
sudo service nginx restart
```
### 5. Check application status
Check if GitLab and its environment are configured correctly:
```bash
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
```
To make sure you didn't miss anything run a more thorough check with:
```bash
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
```
If all items are green, then congratulations upgrade complete!
## Things went south? Revert to previous version (Community Edition 9.0)
### 1. Revert the code to the previous version
```bash
cd /home/git/gitlab
sudo -u git -H git checkout 9-0-stable
```
### 2. Restore from the backup
```bash
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production
```
[support@gitlab.com]: mailto:support@gitlab.com
......@@ -46,6 +46,7 @@ module Gitlab
services: Service.where(active: true).count,
snippets: Snippet.count,
todos: Todo.count,
uploads: Upload.count,
web_hooks: WebHook.count
}
}
......
......@@ -48,9 +48,10 @@ namespace :gitlab do
warn_user_is_not_gitlab
remove_flag = ENV['REMOVE']
Gitlab.config.repositories.storages.each do |name, repo_root|
Gitlab.config.repositories.storages.each do |name, repository_storage|
repo_root = repository_storage['path'].chomp('/')
# Look for global repos (legacy, depth 1) and normal repos (depth 2)
IO.popen(%W(find #{repo_root.chomp('/')} -mindepth 1 -maxdepth 2 -name *+moved*.git)) do |find|
IO.popen(%W(find #{repo_root} -mindepth 1 -maxdepth 2 -name *+moved*.git)) do |find|
find.each_line do |path|
path.chomp!
if remove_flag
......
......@@ -12,6 +12,7 @@ describe '6_validations', lib: true do
FileUtils.rm_rf('tmp/tests/paths')
end
<<<<<<< HEAD
describe 'validate_storages_config' do
context 'with correct settings' do
before do
......@@ -21,6 +22,11 @@ describe '6_validations', lib: true do
it 'passes through' do
expect { validate_storages_config }.not_to raise_error
end
=======
context 'with correct settings' do
before do
mock_storages('foo' => { 'path' => 'tmp/tests/paths/a/b/c' }, 'bar' => { 'path' => 'tmp/tests/paths/a/b/d' })
>>>>>>> upstream/master
end
context 'with invalid storage names' do
......@@ -33,6 +39,7 @@ describe '6_validations', lib: true do
end
end
<<<<<<< HEAD
context 'with incomplete settings' do
before do
mock_storages('foo' => {})
......@@ -41,6 +48,11 @@ describe '6_validations', lib: true do
it 'throws an error suggesting the user to update its settings' do
expect { validate_storages_config }.to raise_error('foo is not a valid storage, because it has no `path` key. Refer to gitlab.yml.example for an updated example. Please fix this in your gitlab.yml before starting GitLab.')
end
=======
context 'with invalid storage names' do
before do
mock_storages('name with spaces' => { 'path' => 'tmp/tests/paths/a/b/c' })
>>>>>>> upstream/master
end
context 'with deprecated settings structure' do
......@@ -54,17 +66,25 @@ describe '6_validations', lib: true do
end
end
<<<<<<< HEAD
describe 'validate_storages_paths' do
context 'with correct settings' do
before do
mock_storages('foo' => { 'path' => 'tmp/tests/paths/a/b/c' }, 'bar' => { 'path' => 'tmp/tests/paths/a/b/d' })
end
=======
context 'with nested storage paths' do
before do
mock_storages('foo' => { 'path' => 'tmp/tests/paths/a/b/c' }, 'bar' => { 'path' => 'tmp/tests/paths/a/b/c/d' })
end
>>>>>>> upstream/master
it 'passes through' do
expect { validate_storages_paths }.not_to raise_error
end
end
<<<<<<< HEAD
context 'with nested storage paths' do
before do
mock_storages('foo' => { 'path' => 'tmp/tests/paths/a/b/c' }, 'bar' => { 'path' => 'tmp/tests/paths/a/b/c/d' })
......@@ -73,6 +93,11 @@ describe '6_validations', lib: true do
it 'throws an error' do
expect { validate_storages_paths }.to raise_error('bar is a nested path of foo. Nested paths are not supported for repository storages. Please fix this in your gitlab.yml before starting GitLab.')
end
=======
context 'with similar but un-nested storage paths' do
before do
mock_storages('foo' => { 'path' => 'tmp/tests/paths/a/b/c' }, 'bar' => { 'path' => 'tmp/tests/paths/a/b/c2' })
>>>>>>> upstream/master
end
context 'with similar but un-nested storage paths' do
......@@ -86,6 +111,26 @@ describe '6_validations', lib: true do
end
end
context 'with incomplete settings' do
before do
mock_storages('foo' => {})
end
it 'throws an error suggesting the user to update its settings' do
expect { validate_storages }.to raise_error('foo is not a valid storage, because it has no `path` key. Refer to gitlab.yml.example for an updated example. Please fix this in your gitlab.yml before starting GitLab.')
end
end
context 'with deprecated settings structure' do
before do
mock_storages('foo' => 'tmp/tests/paths/a/b/c')
end
it 'throws an error suggesting the user to update its settings' do
expect { validate_storages }.to raise_error("foo is not a valid storage, because it has no `path` key. It may be configured as:\n\nfoo:\n path: tmp/tests/paths/a/b/c\n\nRefer to gitlab.yml.example for an updated example. Please fix this in your gitlab.yml before starting GitLab.")
end
end
def mock_storages(storages)
allow(Gitlab.config.repositories).to receive(:storages).and_return(storages)
end
......
......@@ -61,6 +61,7 @@ describe Gitlab::UsageData do
services
snippets
todos
uploads
web_hooks
))
end
......
......@@ -1964,9 +1964,14 @@ describe Project, models: true do
storages = {
'a' => { 'path' => 'tmp/tests/storage_a' },
<<<<<<< HEAD
'b' => { 'path' => 'tmp/tests/storage_b' },
}
=======
'b' => { 'path' => 'tmp/tests/storage_b' }
}
>>>>>>> upstream/master
allow(Gitlab.config.repositories).to receive(:storages).and_return(storages)
end
......
......@@ -11,7 +11,10 @@ describe Projects::UpdateRepositoryStorageService, services: true do
FileUtils.mkdir('tmp/tests/storage_a')
FileUtils.mkdir('tmp/tests/storage_b')
storages = { 'a' => 'tmp/tests/storage_a', 'b' => 'tmp/tests/storage_b' }
storages = {
'a' => { 'path' => 'tmp/tests/storage_a' },
'b' => { 'path' => 'tmp/tests/storage_b' }
}
allow(Gitlab.config.repositories).to receive(:storages).and_return(storages)
allow(subject).to receive(:gitlab_shell).and_return(gitlab_shell)
......
......@@ -107,9 +107,14 @@ describe Projects::UpdateService, services: true do
storages = {
'a' => { 'path' => 'tmp/tests/storage_a' },
<<<<<<< HEAD
'b' => { 'path' => 'tmp/tests/storage_b' },
}
=======
'b' => { 'path' => 'tmp/tests/storage_b' }
}
>>>>>>> upstream/master
allow(Gitlab.config.repositories).to receive(:storages).and_return(storages)
end
......
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